I was trying out the new Maven publishing plugin for one of my projects. The binary repository I use is a local Artifactory instance with version 3.0.1. The project declares a single Java publication and applies some minor modifications to the POM of this publication. When executing the publish task only the JAR file is uploaded, as shown in the following command line output:
$ gradle publish
:generatePomFileForPluginPublication
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar
:publishPluginPublicationToMavenRepository
Uploading: org/gradle/api/plugins/gradle-cloudbees-plugin/0.1/gradle-cloudbees-plugin-0.1.jar to repository remote at http://localhost:8080/artifactory/libs-release-local
Transferring 179K from remote
Uploaded 179K
:publish
When I have a look at the published POM file on Artifactory the content doesn’t reflect my configuration.
<dependency>
<groupId>org.gradle.api.plugins</groupId>
<artifactId>gradle-cloudbees-plugin</artifactId>
<version>0.1</version>
<type>pom</type>
</dependency>
Shouldn’t the POM get uploaded as well. Is there anything missing from my configuration below? If I publish the artifact to Maven Local I can see the correct POM file.
apply plugin: 'maven-publish'
publishing {
publications {
plugin(MavenPublication) {
from components.java
pom.withXml {
def root = asNode()
root.appendNode('name', 'Gradle CloudBees plugin')
root.appendNode('description', 'Gradle plugin for managing applications and databases on CloudBees RUN@cloud.')
root.appendNode('url', 'https://github.com/bmuschko/gradle-cloudbees-plugin')
root.appendNode('inceptionYear', '2013')
def scm = root.appendNode('scm')
scm.appendNode('url', 'https://github.com/bmuschko/gradle-cloudbees-plugin')
scm.appendNode('connection', 'scm:https://bmuschko@github.com/bmuschko/gradle-cloudbees-plugin.git')
scm.appendNode('developerConnection', 'scm:git://github.com/bmuschko/gradle-cloudbees-plugin.git')
def license = root.appendNode('licenses').appendNode('license')
license.appendNode('name', 'The Apache Software License, Version 2.0')
license.appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
license.appendNode('distribution', 'repo')
def developer = root.appendNode('developers').appendNode('developer')
developer.appendNode('id', 'bmuschko')
developer.appendNode('name', 'Benjamin Muschko')
developer.appendNode('email', 'benjamin.muschko@gmail.com')
}
}
}
repositories {
maven {
url project.version.endsWith('-SNAPSHOT') ? artifactorySnapshotRepositoryUrl : artifactoryReleaseRepositoryUrl
credentials {
username = artifactoryUsername
password = artifactoryPassword
}
}
}
}