Interface MavenPom


  • public interface MavenPom
    The POM for a Maven publication.

    The withXml(org.gradle.api.Action) method can be used to modify the descriptor after it has been generated according to the publication data. However, the preferred way to customize the project information to be published is to use the dedicated properties exposed by this class, e.g. getDescription(). Please refer to the official POM Reference for detailed information about the individual properties.

    Since:
    1.4
    • Method Detail

      • getPackaging

        String getPackaging()
        Returns the packaging for the publication represented by this POM.
      • setPackaging

        void setPackaging​(String packaging)
        Sets the packaging for the publication represented by this POM.
      • getDescription

        @Incubating
        Property<String> getDescription()
        The description for the publication represented by this POM.
        Since:
        4.8
      • getInceptionYear

        @Incubating
        Property<String> getInceptionYear()
        The year of the inception for the publication represented by this POM.
        Since:
        4.8
      • scm

        @Incubating
        void scm​(Action<? super MavenPomScm> action)
        Configures the SCM (source control management) for the publication represented by this POM.
        Since:
        4.8
      • withXml

        void withXml​(Action<? super XmlProvider> action)
        Allows configuration of the POM, after it has been generated according to the input data.
         apply plugin: "maven-publish"
        
         publishing {
           publications {
             maven(MavenPublication) {
               pom.withXml {
                 asNode().appendNode('properties').appendNode('my-property', 'my-value')
               }
             }
           }
         }
         
        Note that due to Gradle's internal type conversion system, you can pass a Groovy closure to this method and it will be automatically converted to an Action.

        Each action/closure passed to this method will be stored as a callback, and executed when the publication that this descriptor is attached to is published.

        For details on the structure of the XML to be modified, see the POM reference.

        Parameters:
        action - The configuration action.
        See Also:
        MavenPublication, XmlProvider