Package: org.gradle.api.artifacts.maven

## [Java] 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

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `String` | `POM_FILE_ENCODING` |

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `String` | `getArtifactId()` Returns the artifact id for this POM.
    `ConfigurationContainer` | `getConfigurations()` Returns the configuration container used for mapping configurations to Maven scopes.
    `List<?>` | `getDependencies()` Returns the dependencies for this POM.
    `MavenPom` | `getEffectivePom()` Returns a POM with the generated dependencies and the whenConfigured(org.gradle.api.Action) actions applied.
    `String` | `getGroupId()` Returns the group id for this POM.
    `Object` | `getModel()` Returns the underlying native Maven org.apache.maven.model.Model object.
    `String` | `getPackaging()` Returns the packaging for this POM.
    `Conf2ScopeMappingContainer` | `getScopeMappings()` Returns the scope mappings used for generating this POM.
    `String` | `getVersion()` Returns the version for this POM.
    `MavenPom` | `project(Closure pom)` Provides a builder for the Maven POM for adding or modifying properties of the Maven getModel().
    `MavenPom` | `setArtifactId(String artifactId)` Sets the artifact id for this POM.
    `MavenPom` | `setConfigurations(ConfigurationContainer configurations)` Sets the configuration container used for mapping configurations to Maven scopes.
    `MavenPom` | `setDependencies(List<?> dependencies)` Sets the dependencies for this POM.
    `MavenPom` | `setGroupId(String groupId)` Sets the group id for this POM.
    `MavenPom` | `setModel(Object model)` Sets the underlying native Maven org.apache.maven.model.Model object.
    `MavenPom` | `setPackaging(String packaging)` Sets the packaging for this POM.
    `MavenPom` | `setVersion(String version)` Sets the version for this POM.
    `MavenPom` | `whenConfigured(Closure closure)`
    `MavenPom` | `whenConfigured(Action<MavenPom> action)`
    `MavenPom` | `withXml(Closure closure)`
    `MavenPom` | `withXml(Action<XmlProvider> action)`
    `MavenPom` | `writeTo(Writer writer)` Writes the getEffectivePom() XML to a writer while applying the withXml(org.gradle.api.Action) actions.
    `MavenPom` | `writeTo(Object path)` Writes the getEffectivePom() XML to a file while applying the withXml(org.gradle.api.Action) actions.

- - ### Field Detail

    - #### public String POM_FILE_ENCODING

  - ### Method Detail

    - #### public String getArtifactId()

      Returns the artifact id for this POM.

      See Also:
        org.apache.maven.model.Model#getArtifactId()

    - #### public ConfigurationContainer getConfigurations()

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

    - #### public List<?> getDependencies()

      Returns the dependencies for this POM.

      See Also:
        org.apache.maven.model.Model#getDependencies()

    - #### public MavenPom getEffectivePom()

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

      Returns:
        the effective POM

    - #### public String getGroupId()

      Returns the group id for this POM.

      See Also:
        org.apache.maven.model.Model#setGroupId(String)

    - #### public Object getModel()

      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).

      Returns:
        the underlying native Maven object

    - #### public String getPackaging()

      Returns the packaging for this POM.

      See Also:
        org.apache.maven.model.Model#getPackaging()

    - #### public Conf2ScopeMappingContainer getScopeMappings()

      Returns the scope mappings used for generating this POM.

    - #### public String getVersion()

      Returns the version for this POM.

      See Also:
        org.apache.maven.model.Model#getVersion()

    - #### public 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

    - #### public MavenPom setArtifactId(String artifactId)

      Sets the artifact id for this POM.

      Returns:
        this
      See Also:
        org.apache.maven.model.Model#setArtifactId(String)

    - #### public MavenPom setConfigurations(ConfigurationContainer configurations)

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

      Returns:
        this

    - #### public MavenPom setDependencies(List<?> dependencies)

      Sets the dependencies for this POM.

      Returns:
        this
      See Also:
        org.apache.maven.model.Model#setDependencies(java.util.List)

    - #### public MavenPom setGroupId(String groupId)

      Sets the group id for this POM.

      Returns:
        this
      See Also:
        org.apache.maven.model.Model#getGroupId

    - #### public MavenPom setModel(Object model)

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

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

    - #### public MavenPom setPackaging(String packaging)

      Sets the packaging for this POM.

      Returns:
        this
      See Also:
        org.apache.maven.model.Model#setPackaging(String)

    - #### public MavenPom setVersion(String version)

      Sets the version for this POM.

      Returns:
        this
      See Also:
        org.apache.maven.model.Model#setVersion(String)

    - #### public 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

    - #### public 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

    - #### public 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 action can modify the XML.

      Parameters:
        `closure` - The closure to execute when the POM XML has been created.
      Returns:
        this

    - #### public 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 action can modify the XML.

      Parameters:
        `action` - The action to execute when the POM XML has been created.
      Returns:
        this

    - #### public MavenPom writeTo(Writer writer)

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

      Parameters:
        `writer` - The writer to write the POM to.
      Returns:
        this

    - #### public 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 The file will be encoded as UTF-8.

      Parameters:
        `path` - The path of the file to write the POM into.
      Returns:
        this