Groovy Documentation

org.gradle.api.publish
[Java] Interface PublicationContainer

org.gradle.api.DomainObjectCollection
  java.lang.Iterable
      org.gradle.api.NamedDomainObjectSet
          org.gradle.api.NamedDomainObjectCollection
              java.util.Collection
                  org.gradle.api.publish.PublicationContainer
All Superinterfaces:
DomainObjectCollection, Iterable, NamedDomainObjectSet, NamedDomainObjectCollection, Collection

@Incubating
public interface PublicationContainer
extends NamedDomainObjectSet

A PublicationContainer is responsible for creating and managing Publication instances. The set of available publication types is dependent on the application of particular plugins:

See the documentation for PublishingExtension.publications for more examples of how to create and configure publications.
See Also:
Publication
PublishingExtension
Since:
1.3


Method Summary
Object add(String name, Class type)

Creates a publication with the specified name and type, adding it to the container.

Object add(String name, Class type, Action configuration)

Creates a publication with the specified name and type, adding it to the container and configuring it with the supplied action.

 
Methods inherited from interface NamedDomainObjectSet
findAll, matching, matching, withType
 
Methods inherited from interface Set
add, equals, hashCode, clear, contains, isEmpty, size, toArray, toArray, addAll, iterator, remove, containsAll, removeAll, retainAll
 
Methods inherited from interface NamedDomainObjectCollection
add, addAll, addRule, addRule, findByName, getAsMap, getAt, getByName, getByName, getNamer, getRules, matching, matching, withType
 
Methods inherited from interface DomainObjectCollection
all, all, findAll, matching, matching, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withType, withType
 

Method Detail

add

public Object add(String name, Class type)
Creates a publication with the specified name and type, adding it to the container.
 apply plugin: 'maven-publish'

 publishing.publications.add('publication-name', MavenPublication)
 
throws:
InvalidUserDataException If type is not a valid publication type, or if a publication named "name" already exists.
Parameters:
name - The publication name.
type - The publication type.
Returns:
The added publication


add

public Object add(String name, Class type, Action configuration)
Creates a publication with the specified name and type, adding it to the container and configuring it with the supplied action. A 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
 }
 
throws:
InvalidUserDataException If type is not a valid publication type, or if a publication named "name" already exists.
Parameters:
name - The publication name.
type - The publication type.
configuration - The action or closure to configure the publication with.
Returns:
The added publication


 

Gradle API 1.5