Hello guys,
Thank you for the explanations this was very helpful and now I understand my own issue better.
I didnt know Maven used this style to select dependencies having jumped onto the Gradle-train directly. I dont agree with making this change. It seems like a very dubious gain to break long used functionality for the sake of following the Maven convention.
This change has raised some issues for me, currently minor but who knows what the future brings.
Let me show you.
In my projects I put the test artifact in the testRuntime configuration because it happens that some tests have dependencies on other tests and it allows me to depend on them. I think I picked up the trick by looking at the Gradle build. Now lets use such a dependency in my project called "B" with uses the test-artifact from project "A".
```
dependencies {
compile project(":A")
testCompile project(path: ":A", configuration: 'testRuntime')
}
```
That works great with project dependencies. I use the maven plugin to publish the corresponding pom.xml.
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>deptest.B</groupId>
<artifactId>B</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>deptest.A</groupId>
<artifactId>A</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>deptest.A</groupId>
<artifactId>A</artifactId>
<version>1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
I reran the build a couple of times until I got the test scope last like I need for the example. This is not deterministic. Lets assume my project "A" has a dependency block like:
```
dependencies {
compile "junit:junit:4.10"
}
```
And now I specify a dependency to project "B" (first example project) in project "C":
```
dependencies {
compile 'deptest.B:B:1.0'
}
```
Project "C" resolved compile classpaths:
Gradle 1.8:
```
/home/s/.m2/repository/deptest/B/B/1.0/B-1.0.jar
/home/s/.m2/repository/deptest/A/A/1.0/A-1.0.jar
/home/s/.m2/repository/junit/junit/4.10/junit-4.10.jar
/home/s/.m2/repository/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar
```
Gradle 1.11:
```
/home/s/.m2/repository/deptest/B/B/1.0/B-1.0.jar
```
As you can see project "A" in its entirety is missing in the resolved dependencies in project "C". Any artifact published up until this point cannot be trusted to produce workable dependencies past Gradle 1.8.
The maven plugin is publishing dependencies with a 50-50 risk that the test scope is last if a dependency on testRuntime was specified as above. This makes the Maven support not so desirable for me at the moment with the maven plugin producing bad poms without manual intervention and the maven-publish plugin not a dependencies block at all. While I might be ok only using project dependencies other teams will want to depend directly on my artifacts.
Thank you,
Stefan