Package 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
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the artifact id for this POM.Returns the configuration container used for mapping configurations to Maven scopes.List<?>
Returns the dependencies for this POM.Returns a POM with the generated dependencies and thewhenConfigured(org.gradle.api.Action)
actions applied.Returns the group id for this POM.getModel()
Returns the underlying native MavenModel
object.Returns the packaging for this POM.Returns the scope mappings used for generating this POM.Returns the version for this POM.Provides a builder for the Maven POM for adding or modifying properties of the MavengetModel()
.project
(Action<? super GroovyObject> pom) Provides a builder for the Maven POM for adding or modifying properties of the MavengetModel()
.setArtifactId
(String artifactId) Sets the artifact id for this POM.setConfigurations
(ConfigurationContainer configurations) Sets the configuration container used for mapping configurations to Maven scopes.setDependencies
(List<?> dependencies) Sets the dependencies for this POM.setGroupId
(String groupId) Sets the group id for this POM.Sets the underlying native MavenModel
object.setPackaging
(String packaging) Sets the packaging for this POM.setVersion
(String version) Sets the version for this POM.whenConfigured
(Closure closure) Adds a closure to be called when the POM has been configured.whenConfigured
(Action<MavenPom> action) Adds an action to be called when the POM has been configured.Adds a closure to be called when the POM XML has been created.withXml
(Action<XmlProvider> action) Adds an action to be called when the POM XML has been created.Writes thegetEffectivePom()
XML to a writer while applying thewithXml(org.gradle.api.Action)
actions.Writes thegetEffectivePom()
XML to a file while applying thewithXml(org.gradle.api.Action)
actions.
-
Field Details
-
POM_FILE_ENCODING
- See Also:
-
-
Method Details
-
getScopeMappings
Conf2ScopeMappingContainer getScopeMappings()Returns the scope mappings used for generating this POM. -
project
Provides a builder for the Maven POM for adding or modifying properties of the MavengetModel()
. 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' } } }
- Returns:
- this
-
project
Provides a builder for the Maven POM for adding or modifying properties of the MavengetModel()
. 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' } } }
- Returns:
- this
- Since:
- 4.2
-
getGroupId
String getGroupId()Returns the group id for this POM.- See Also:
-
Model.setGroupId(String)
-
setGroupId
Sets the group id for this POM.- Returns:
- this
- See Also:
-
Model.getGroupId()
-
getArtifactId
String getArtifactId()Returns the artifact id for this POM.- See Also:
-
Model.getArtifactId()
-
setArtifactId
Sets the artifact id for this POM.- Returns:
- this
- See Also:
-
Model.setArtifactId(String)
-
getVersion
String getVersion()Returns the version for this POM.- See Also:
-
Model.getVersion()
-
setVersion
Sets the version for this POM.- Returns:
- this
- See Also:
-
Model.setVersion(String)
-
getPackaging
String getPackaging()Returns the packaging for this POM.- See Also:
-
Model.getPackaging()
-
setPackaging
Sets the packaging for this POM.- Returns:
- this
- See Also:
-
Model.setPackaging(String)
-
setDependencies
Sets the dependencies for this POM.- Returns:
- this
- See Also:
-
ModelBase.setDependencies(java.util.List)
-
getDependencies
List<?> getDependencies()Returns the dependencies for this POM.- See Also:
-
ModelBase.getDependencies()
-
getModel
Object getModel()Returns the underlying native MavenModel
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 orproject(groovy.lang.Closure)
.- Returns:
- the underlying native Maven object
-
setModel
Sets the underlying native MavenModel
object.- Returns:
- this
- See Also:
-
writeTo
Writes thegetEffectivePom()
XML to a writer while applying thewithXml(org.gradle.api.Action)
actions. Closes the supplied Writer when finished.- Parameters:
writer
- The writer to write the POM to.- Returns:
- this
-
writeTo
Writes thegetEffectivePom()
XML to a file while applying thewithXml(org.gradle.api.Action)
actions. The path is resolved as defined byProject.files(Object...)
The file will be encoded as UTF-8.- Parameters:
path
- The path of the file to write the POM into.- Returns:
- this
-
whenConfigured
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
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
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 action can modify the XML.- Parameters:
closure
- The closure to execute when the POM XML has been created.- Returns:
- this
-
withXml
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 action can modify the XML.- 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
Sets the configuration container used for mapping configurations to Maven scopes.- Returns:
- this
-
getEffectivePom
MavenPom getEffectivePom()Returns a POM with the generated dependencies and thewhenConfigured(org.gradle.api.Action)
actions applied.- Returns:
- the effective POM
-