@Incubating public interface PublicationContainer extends NamedDomainObjectSet<Publication>
PublicationContainer
is responsible for creating and managing Publication
instances.
The set of available publication types is dependent on the application of particular plugins:
MavenPublishPlugin
makes it possible to create MavenPublication
instances.IvyPublishPlugin
makes it possible to create IvyPublication
instances.PublishingExtension.publications(org.gradle.api.Action)
for more examples of how to create and configure publications.Publication
,
PublishingExtension
Modifier and Type | Method and Description |
---|---|
<T extends Publication> |
add(String name,
Class<T> type)
Creates a publication with the specified name and type, adding it to the container.
|
<T extends Publication> |
add(String name,
Class<T> type,
Action<? super T> configuration)
Creates a publication with the specified name and type, adding it to the container and configuring it with the supplied action.
|
findAll, matching, matching, withType
add, addAll, addRule, addRule, findByName, getAsMap, getAt, getByName, getByName, getNamer, getRules
all, all, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withType
<T extends Publication> T add(String name, Class<T> type) throws InvalidUserDataException
apply plugin: 'maven-publish' publishing.publications.add('publication-name', MavenPublication)
name
- The publication name.type
- The publication type.InvalidUserDataException
- If type is not a valid publication type, or if a publication named "name" already exists.<T extends Publication> T add(String name, Class<T> type, Action<? super T> configuration) throws InvalidUserDataException
Closure
can be supplied in place of an action, through type coercion.
apply plugin: 'ivy-publish' publishing.publications.add('publication-name', IvyPublication) { // Configure the ivy publication here }
name
- The publication name.type
- The publication type.configuration
- The action or closure to configure the publication with.InvalidUserDataException
- If type is not a valid publication type, or if a publication named "name" already exists.