Setting pom properties in mavenDeployer removes all dependencies from the POM

I use this to publish my project:

uploadArchives {
    repositories {
        mavenDeployer {
            beforeDeployment {
                MavenDeployment deployment -> signing.signPom(deployment)

            repository(url: m2ReleaseRepo ?: mavenLocal().url) {
                authentication(userName: m2Username, password: m2Password)
            snapshotRepository(url: m2SnapshotRepo ?: mavenLocal().url) {
                authentication(userName: m2Username, password: m2Password)

            // TODO(bug) note adding pom.project { ... } or setting pom properties (e.g. = ...)
            // TODO(bug) causes JAR poms to lose their dependency info
            pom.project {
			    name '...'
			    description '...'
			    url '...'
			    developers {
			        developer {
			            name '...'
			            email '...'
			            organizationUrl '...'

The POM produced does not have a <dependencies> section. However, when the pom.project { ... } configuration is removed, it does. It seems like the pom.project { ... } messes up the output.

I can’t reproduce your issue with Gradle 2.4 - neither with a final nor a SNAPSHOT version.

A comment about your code: There’s no point in using mavenLocal().url in your repository assignments. You can “upload” to your Maven Local repository with the task install and then Gradle knows where to put it.

  • What version of Gradle are you using?
  • You are executing gradle uploadArchives. Is that correct?
  • Can you please provide a full example on GitHub (including a Wrapper) that reproduces the issue?

@bmuschko I am using apply plugin: 'maven' and the task ‘uploadArchives’ to do the deploy. I don’t see a task install in my build. That’s the new publishing plugin, right? I think I’m not using that because it was my understanding it did not support AAR yet.

Anyway, uploadArchives to the local m2 repo works great, it’s building the POM that’s giving me headaches :slight_smile:

One thing I noticed is that, when the artifacts { ... } block contained a JAR and an AAR, the POM did not have the correct packaging tag and the approaches to set it manually did not work.

Here is a chunk of build code to set up the artifacts for some Android AARs:

   android.libraryVariants.all { variant ->

        task("archive${}Sources", type: Jar) {
            description "Generates sources for $"
            classifier = 'sources'
            from variant.javaCompile.source + project(':common-java').sourceSets.main.allSource

        task("generate${}Javadoc", type: Javadoc) {
            description "Generates Javadoc for $"
            source = variant.javaCompile.source + project(':common-java').sourceSets.main.allSource
            ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
            classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
            exclude '**/'
            exclude '**/'
            configure(options) {
                stylesheetFile = new File(projectDir, '../javadoc/stylesheet.css')
                windowTitle = "Nextop for Android JavaDoc ($project.version)"
                docTitle = "Nextop for Android JavaDoc ($project.version)"

        task("archive${}Javadoc", type: Jar, dependsOn: "generate${}Javadoc") {
            classifier = 'javadoc'
            from tasks["generate${}Javadoc"].destinationDir

        artifacts {
            // important: do not add a JAR here.
            // Maven publishing does not insert the correct packaging tag into the POM when there is JAR
            // (the packaging needs to be aar)
            // there is not way to manually set it because of this bug: see
            archives tasks["archive${}Sources"]
            archives tasks["archive${}Javadoc"]