Only one project artifact is added to the classpath when using multiple project dependencies on same project with different configurations

Hi,

I am using gradle 1.11 and I have a multi-project build with 2 sub projects A and B.

Project A is using the java plugin and produces two artifacts: 1. The A.jar file produced by the default jar task of the java plugin 2. The other one is ATest.jar which contains test classes and which I have associated to a “testJar” configuration as follows

configurations {
   testJar
}
  task jarTest (type: Jar) {
     ....
}
  artifacts {
    testJar
jarTest
}

In the other java subproject B I am trying to add both A.jar and ATest.jar for compiling B classes:

dependencies {
    // Adding A.jar
    compile
 project(path: ':A', configuration: 'archives')
      // Adding ATest.jar
    compile
 project(path: ':A', configuration: 'testJar')
}

But the compilation fails because the ATest.jar does not get included into the classpath. If I run gradle with the ‘-d’ option I can see that the ATest.jar is actually missing from the classpath.

I noted that when I use only one project dependencies on A (either ‘archives’ or ‘testJar’) then the appropriate jar (eiher A.jar or ATest.jar_ gets included to the classpath. But If I use both configurations then only one gets included.

Any idea about what I am doing wrong ?

Shouldn’t the test Jar be a ‘testCompile’ dependency?

Yes, you’re right and it is actually. But the problems remains the same.