org.gradle.api.artifacts.maven
Interface MavenPom


public interface MavenPom

Is used for generating a Maven pom file and customizing the generation. To learn about the Maven pom see: http://maven.apache.org/pom.html


Method Summary
 String getArtifactId()
           
 ConfigurationContainer getConfigurations()
          Returns the configuration container used for mapping configurations to maven scopes.
 List<Dependency> getDependencies()
           
 MavenPom getEffectivePom()
          Returns a pom with the generated dependencies and the whenConfigured(org.gradle.api.Action) actions applied.
 String getGroupId()
           
 Model getModel()
          Returns the underlying native Maven Model object.
 String getPackaging()
           
 Conf2ScopeMappingContainer getScopeMappings()
          Returns the scope mappings used for generating this pom.
 String getVersion()
           
 MavenPom project(Closure pom)
          Provides a builder for the Maven pom for adding or modifying properties of the Maven getModel().
 MavenPom setArtifactId(String artifactId)
           
 MavenPom setConfigurations(ConfigurationContainer configurations)
          Sets the configuration container used for mapping configurations to maven scopes.
 MavenPom setDependencies(List<Dependency> dependencies)
           
 MavenPom setGroupId(String groupId)
          org.apache.maven.model.Model#getGroupId
 MavenPom setModel(Model model)
          Sets the underlying native Maven Model object.
 MavenPom setPackaging(String packaging)
           
 MavenPom setVersion(String version)
           
 MavenPom whenConfigured(Action<MavenPom> action)
          Adds an action to be called when the pom has been configured.
 MavenPom whenConfigured(Closure closure)
          Adds a closure to be called when the pom has been configured.
 MavenPom withXml(Action<XmlProvider> action)
          Adds an action to be called when the pom xml has been created.
 MavenPom withXml(Closure closure)
          Adds a closure to be called when the pom xml has been created.
 MavenPom writeTo(Object path)
          Writes the getEffectivePom() xml to a file while applying the withXml(org.gradle.api.Action) actions.
 MavenPom writeTo(Writer writer)
          Writes the getEffectivePom() xml to a writer while applying the withXml(org.gradle.api.Action) actions.
 

Method Detail

getScopeMappings

Conf2ScopeMappingContainer getScopeMappings()
Returns the scope mappings used for generating this pom.


project

MavenPom project(Closure pom)
Provides a builder for the Maven pom for adding or modifying properties of the Maven getModel(). The syntax is exactly the same as used by polyglot Maven. For example:
 pom.project {
    inceptionYear '2008'
    licenses {
       license {
          name 'The Apache Software License, Version 2.0'
          url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
          distribution 'repo'
       }
    }
 }
 

Parameters:
pom -
Returns:
this

getGroupId

String getGroupId()
See Also:
Model.setGroupId(String)

setGroupId

MavenPom setGroupId(String groupId)
org.apache.maven.model.Model#getGroupId

Returns:
this

getArtifactId

String getArtifactId()
See Also:
Model.getArtifactId()

setArtifactId

MavenPom setArtifactId(String artifactId)
Returns:
this
See Also:
Model.setArtifactId(String)

getVersion

String getVersion()
See Also:
Model.getVersion()

setVersion

MavenPom setVersion(String version)
Returns:
this
See Also:
Model.setVersion(String)

getPackaging

String getPackaging()
See Also:
Model.getPackaging()

setPackaging

MavenPom setPackaging(String packaging)
Returns:
this
See Also:
Model.setPackaging(String)

setDependencies

MavenPom setDependencies(List<Dependency> dependencies)
Returns:
this
See Also:
ModelBase.setDependencies(java.util.List)

getDependencies

List<Dependency> getDependencies()
See Also:
ModelBase.getDependencies()

getModel

Model getModel()
Returns the underlying native Maven Model object. The MavenPom object delegates all the configuration information to this object. There Gradle MavenPom objects provides delegation methods just for setting the groupId, artifactId, version and packaging. For all other elements, either use the model object or project(groovy.lang.Closure).

Returns:
the underlying native Maven object

setModel

MavenPom setModel(Model model)
Sets the underlying native Maven Model object.

Parameters:
model -
Returns:
this
See Also:
getModel()

writeTo

MavenPom writeTo(Writer writer)
Writes the getEffectivePom() xml to a writer while applying the withXml(org.gradle.api.Action) actions.

Parameters:
writer - The writer to write the pom xml.
Returns:
this

writeTo

MavenPom writeTo(Object path)
Writes the getEffectivePom() xml to a file while applying the withXml(org.gradle.api.Action) actions. The path is resolved as defined by Project.files(Object...)

Parameters:
path - The path of the file to write the pom xml into.
Returns:
this

whenConfigured

MavenPom whenConfigured(Closure closure)

Adds a closure to be called when the pom has been configured. The pom is passed to the closure as a parameter.

Parameters:
closure - The closure to execute when the pom has been configured.
Returns:
this

whenConfigured

MavenPom whenConfigured(Action<MavenPom> action)

Adds an action to be called when the pom has been configured. The pom is passed to the action as a parameter.

Parameters:
action - The action to execute when the pom has been configured.
Returns:
this

withXml

MavenPom withXml(Closure closure)

Adds a closure to be called when the pom xml has been created. The xml is passed to the closure as a parameter in form of a XmlProvider. The xml might be modified.

Parameters:
closure - The closure to execute when the pom xml has been created.
Returns:
this

withXml

MavenPom withXml(Action<XmlProvider> action)

Adds an action to be called when the pom xml has been created. The xml is passed to the action as a parameter in form of a XmlProvider. The xml might be modified.

Parameters:
action - The action to execute when the pom xml has been created.
Returns:
this

getConfigurations

ConfigurationContainer getConfigurations()
Returns the configuration container used for mapping configurations to maven scopes.


setConfigurations

MavenPom setConfigurations(ConfigurationContainer configurations)
Sets the configuration container used for mapping configurations to maven scopes.

Returns:
this

getEffectivePom

MavenPom getEffectivePom()
Returns a pom with the generated dependencies and the whenConfigured(org.gradle.api.Action) actions applied.

Returns:
the effective pom