api / org.gradle.api.artifacts.maven / MavenPom

MavenPom

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

Properties

POM_FILE_ENCODING

static val POM_FILE_ENCODING: String

Functions

getArtifactId

abstract fun getArtifactId(): String

Returns the artifact id for this POM.

getConfigurations

abstract fun getConfigurations(): ConfigurationContainer

Returns the configuration container used for mapping configurations to Maven scopes.

getDependencies

abstract fun getDependencies(): MutableList<*>

Returns the dependencies for this POM.

getEffectivePom

abstract fun getEffectivePom(): MavenPom

Returns a POM with the generated dependencies and the #whenConfigured(org.gradle.api.Action) actions applied.

getGroupId

abstract fun getGroupId(): String

Returns the group id for this POM.

getModel

abstract fun getModel(): Any

Returns the underlying native Maven org.apache.maven.model.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).

getPackaging

abstract fun getPackaging(): String

Returns the packaging for this POM.

getScopeMappings

abstract fun getScopeMappings(): Conf2ScopeMappingContainer

Returns the scope mappings used for generating this POM.

getVersion

abstract fun getVersion(): String

Returns the version for this POM.

project

abstract fun project(pom: Closure<Any>): MavenPom
abstract fun project(pom: Action<in GroovyObject>): MavenPom

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' } } } 

setArtifactId

abstract fun setArtifactId(artifactId: String): MavenPom

Sets the artifact id for this POM.

setConfigurations

abstract fun setConfigurations(configurations: ConfigurationContainer): MavenPom

Sets the configuration container used for mapping configurations to Maven scopes.

setDependencies

abstract fun setDependencies(dependencies: MutableList<*>): MavenPom

Sets the dependencies for this POM.

setGroupId

abstract fun setGroupId(groupId: String): MavenPom

Sets the group id for this POM.

setModel

abstract fun setModel(model: Any): MavenPom

Sets the underlying native Maven org.apache.maven.model.Model object.

setPackaging

abstract fun setPackaging(packaging: String): MavenPom

Sets the packaging for this POM.

setVersion

abstract fun setVersion(version: String): MavenPom

Sets the version for this POM.

whenConfigured

abstract fun whenConfigured(closure: Closure<Any>): MavenPom

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

abstract fun whenConfigured(action: Action<MavenPom>): MavenPom

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

withXml

abstract fun withXml(closure: Closure<Any>): MavenPom

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 org.gradle.api.XmlProvider. The action can modify the XML.

abstract fun withXml(action: Action<XmlProvider>): MavenPom

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 org.gradle.api.XmlProvider. The action can modify the XML.

writeTo

abstract fun writeTo(writer: Writer): MavenPom

Writes the #getEffectivePom() XML to a writer while applying the #withXml(org.gradle.api.Action) actions. Closes the supplied Writer when finished.

abstract fun writeTo(path: Any): MavenPom

Writes the #getEffectivePom() XML to a file while applying the #withXml(org.gradle.api.Action) actions. The path is resolved as defined by org.gradle.api.Project#files(Object...) The file will be encoded as UTF-8.