POM missing dependencies when using MavenInstaller

240 views
Skip to first unread message

Simon Vig Therkildsen

unread,
May 5, 2014, 11:44:05 AM5/5/14
to adt...@googlegroups.com
Hello,

Since the maven install task is missing on android projects, I've been trying to implement that myself. I can get it to install to maven local with the following code, but the pom does not contain dependencies.

task install(type: Upload, dependsOn: assemble) {
  repositories.mavenInstaller {
    configuration = configurations.archives

    pom.groupId = GROUP
    pom.artifactId = POM_ARTIFACT_ID
    pom.version = VERSION_NAME

    pom.project {
      name POM_NAME
      packaging POM_PACKAGING
      description POM_DESCRIPTION
      url POM_URL

      scm {
        url POM_SCM_URL
        connection POM_SCM_CONNECTION
        developerConnection POM_SCM_DEV_CONNECTION
      }

      licenses {
        license {
          name POM_LICENCE_NAME
          url POM_LICENCE_URL
          distribution POM_LICENCE_DIST
        }
      }

      developers {
        developer {
          id POM_DEVELOPER_ID
          name POM_DEVELOPER_NAME
        }
      }
    }
  }
}

I've made a sample project that contains both an android project and a regular java project: https://github.com/SimonVT/android-gradle-maveninstaller
./gradlew install will install both projects to maven local, but only the java project pom will contain dependencies.
What am I missing to get it to correctly put dependencies in the pom?

Xavier Ducrohet

unread,
May 6, 2014, 9:14:53 PM5/6/14
to adt...@googlegroups.com
If you run the "dependencies" task on your project you'll see that the "archives" configuration probably doesn't declare any dependencies.

If you have a library project you'll see that "default" does. This is the dependencies for the default artifact so you can use that instead.

If you have variants and want to publish those (rather one of those) you'll need to use the associated configuration.
It will be named <flavor name><buildtype name>




--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!

Simon Vig Therkildsen

unread,
May 7, 2014, 2:04:26 AM5/7/14
to adt...@googlegroups.com
Here's the behavior I'm seeing.

If I don't define configuration:
A problem was found with the configuration of task ':project2:install'.
> No value has been specified for property 'artifacts'.

configuration = configurations.default:
Just the aar is installed to maven local, pom doesn't contain dependencies

configuration = configurations.artifacts:
aar, javadocs and sources are installed, pom doesn't contain dependencies

I really don't see how to make the pom contain dependencies.
Reply all
Reply to author
Forward
0 new messages