cbeust / kobalt

A Kotlin-based build system for the JVM.
Apache License 2.0
433 stars 60 forks source link

Transient dependencies issues with collect() #395

Closed ethauvin closed 7 years ago

ethauvin commented 7 years ago

Assuming:

    dependencies {
        compile("org.apache.velocity:velocity:1.7")
    }

which resolves to:

╟ commons-collections:commons-collections:jar:3.2.1
╟ commons-lang:commons-lang:jar:2.4
╙ oro:oro:jar:2.0.8 (optional)

collect(compileDependencies) will return velocity, commons-collections and commons-lang as expected.

Change to:

    dependencies {
        compile("org.apache.velocity:velocity:jar:1.7")
    }

collect(compileDependencies) will still return all three dependencies, not just velocity. I think that's a caching issue.

Additionally, I'm using an annotator, which requires both apt(annotatorJar) and compile(annotatorJar), like most do.

The problem is when I'm using collect(compileDependencies), I'm getting the annotator jar and it's dependencies, but I don't really need them to be deployed to the install target.

Gradle addresses that issue by providing a compileOnly 'annotatorJar' directive. Meaning that when collecting the compile dependencies, no annotator dependencies will be included.

cbeust commented 7 years ago

Working as expected. I resolved this dependency with Maven Resolver's own example and it produced the same result:

org.apache.velocity:velocity:jar:1.7 resolved to /Users/cedricbeust/java/maven-resolver/target/local-repo/org/apache/velocity/velocity/1.7/velocity-1.7.jar
commons-collections:commons-collections:jar:3.2.1 resolved to /Users/cedricbeust/java/maven-resolver/target/local-repo/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar
commons-lang:commons-lang:jar:2.4 resolved to /Users/cedricbeust/java/maven-resolver/target/local-repo/commons-lang/commons-lang/2.4/commons-lang-2.4.jar
oro:oro:jar:2.0.8 resolved to /Users/cedricbeust/java/maven-resolver/target/local-repo/oro/oro/2.0.8/oro-2.0.8.jar