Maven artifact upload doesn't honor configuration.extendsFrom

Hi everyone,

I have stripped down a build to the the core of what causes the issue. Here’s the problem:

I have the following gradle build file:

apply plugin: 'base'
apply plugin: 'maven'
  group = 'com.acme'
  configurations {
    api { transitive = false }
    archives {
        extendsFrom api
        transitive = true
  repositories {
  task createFile() {
 ext.destFile = file("${project.buildDir}/output.txt")
 doFirst {
  file(destFile).text = 'Some output file...'
  task artifactZip(type: Zip, dependsOn: createFile) {
  artifacts {
    archives artifactZip
  dependencies {
    api 'commons-lang:commons-lang:2.6'
  conf2ScopeMappings.addMapping(1, configurations.archives, 'compile')
  uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: new File(project.buildDir, 'repo').toURI().toURL())
  task showMe << {
    configurations.archives.each {
        println(">>> configurations.archives contains $it")

This is not a java project but deals with dependencies. I have one set of dependencies but want two configurations: the first (‘api’) should be non-transitive while the second (‘archives’) should be. Since I don’t want to specify the dependencies twice, I just let ‘archives’ extend from ‘api’.

Now, if you execute “gradle showMe”, you’ll see that it looks like it works:

D:\tmp\gradlebug-test>gradle showMe > :showMe > >>> configurations.archives contains C:\Users\mike.gradle\caches\artifacts-8\filestore\commons-lang\commons-lang.6\jar\ce1edb914c94ebc388f086c6827e8bdeec71ac2\commons-lang-2.6.jar

However, if you deploy using uploadArchives, the resulting pom doesn’t include the commons-lang dependency:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="" xmlns=""

Is this a gradle bug, or am I doing something completely wrong?

Best regards, Mike

As far as I can tell, inherited configurations are not considered by conf2ScopeMappings. Have you tried to add another mapping for ‘api’?

This looks a lot like GRADLE-1042 - see for a workaround.

Yes, indeed, adding another conf2ScopeMapping for the “parent” configuration solved my problem (actually, I thought I tried that, ah well…).

I voted for GRADLE-1042.

Thanks Peter and Levi.

Regards, Mike