Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## org.gradle.api.artifacts.maven
[Java] 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

Authors:
  Hans Dockter

Method Summary
`java.lang.String` | `getArtifactId()` Returns the artifact id for this POM.
`ConfigurationContainer` | `getConfigurations()` Returns the configuration container used for mapping configurations to maven scopes.
`java.util.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.
`java.lang.String` | `getGroupId()` Returns the group id for this POM.
`Model` | `getModel()` Returns the underlying native Maven org.apache.maven.model.Model object.
`java.lang.String` | `getPackaging()` Returns the packaging for this POM.
`Conf2ScopeMappingContainer` | `getScopeMappings()` Returns the scope mappings used for generating this pom.
`java.lang.String` | `getVersion()` Returns the version for this POM.
`MavenPom` | `project(groovy.lang.Closure pom)` Provides a builder for the Maven pom for adding or modifying properties of the Maven getModel().
`MavenPom` | `setArtifactId(java.lang.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(java.util.List dependencies)` Sets the dependencies for this POM.
`MavenPom` | `setGroupId(java.lang.String groupId)` Sets the group id for this POM.
`MavenPom` | `setModel(Model model)` Sets the underlying native Maven org.apache.maven.model.Model object.
`MavenPom` | `setPackaging(java.lang.String packaging)` Sets the packaging for this POM.
`MavenPom` | `setVersion(java.lang.String version)` Sets the version for this POM.
`MavenPom` | `whenConfigured(groovy.lang.Closure closure)` Adds a closure to be called when the pom has been configured.
`MavenPom` | `whenConfigured(Action action)` Adds an action to be called when the pom has been configured.
`MavenPom` | `withXml(groovy.lang.Closure closure)` Adds a closure to be called when the POM XML has been created.
`MavenPom` | `withXml(Action action)` Adds an action to be called when the POM XML has been created.
`MavenPom` | `writeTo(java.io.Writer writer)` Writes the getEffectivePom() xml to a writer while applying the withXml(org.gradle.api.Action) actions.
`MavenPom` | `writeTo(java.lang.Object path)` Writes the getEffectivePom() xml to a file while applying the withXml(org.gradle.api.Action) actions.

Method Detail

### getArtifactId

    public java.lang.String getArtifactId()

  Returns the artifact id for this POM.
  See Also:
    org.apache.maven.model.Model#getArtifactId()

### getConfigurations

    public ConfigurationContainer getConfigurations()

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

### getDependencies

    public java.util.List getDependencies()

  Returns the dependencies for this POM.
  See Also:
    org.apache.maven.model.Model#getDependencies()

### getEffectivePom

    public MavenPom getEffectivePom()

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

### getGroupId

    public java.lang.String getGroupId()

  Returns the group id for this POM.
  See Also:
    org.apache.maven.model.Model#setGroupId(String)

### getModel

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

### getPackaging

    public java.lang.String getPackaging()

  Returns the packaging for this POM.
  See Also:
    org.apache.maven.model.Model#getPackaging()

### getScopeMappings

    public Conf2ScopeMappingContainer getScopeMappings()

  Returns the scope mappings used for generating this pom.

### getVersion

    public java.lang.String getVersion()

  Returns the version for this POM.
  See Also:
    org.apache.maven.model.Model#getVersion()

### project

    public MavenPom project(groovy.lang.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

### setArtifactId

    public MavenPom setArtifactId(java.lang.String artifactId)

  Sets the artifact id for this POM.
  Returns:
    this
  See Also:
    org.apache.maven.model.Model#setArtifactId(String)

### setConfigurations

    public MavenPom setConfigurations(ConfigurationContainer configurations)

  Sets the configuration container used for mapping configurations to maven scopes.
  Returns:
    this

### setDependencies

    public MavenPom setDependencies(java.util.List dependencies)

  Sets the dependencies for this POM.
  Returns:
    this
  See Also:
    org.apache.maven.model.Model#setDependencies(java.util.List)

### setGroupId

    public MavenPom setGroupId(java.lang.String groupId)

  Sets the group id for this POM.
  Returns:
    this
  See Also:
    org.apache.maven.model.Model#getGroupId

### setModel

    public MavenPom setModel(Model model)

  Sets the underlying native Maven org.apache.maven.model.Model object.
  Parameters:
    model
  Returns:
    this
  See Also:
    getModel()

### setPackaging

    public MavenPom setPackaging(java.lang.String packaging)

  Sets the packaging for this POM.
  Returns:
    this
  See Also:
    org.apache.maven.model.Model#setPackaging(String)

### setVersion

    public MavenPom setVersion(java.lang.String version)

  Sets the version for this POM.
  Returns:
    this
  See Also:
    org.apache.maven.model.Model#setVersion(String)

### whenConfigured

    public MavenPom whenConfigured(groovy.lang.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

    public MavenPom whenConfigured(Action 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

    public MavenPom withXml(groovy.lang.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

### withXml

    public MavenPom withXml(Action 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

### writeTo

    public MavenPom writeTo(java.io.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

    public MavenPom writeTo(java.lang.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 xml into.
  Returns:
    this

Groovy Documentation