Hi,
I’m using Gradle 5.5 and the Kotlin DSL.
My real life example is more complex but I was able to isolate the issue in a very simple example at https://github.com/dcoraboeuf/gradle-constraints
Given a root module defined as:
subprojects {
apply(plugin = "java-library")
dependencies {
// Spring Boot managed dependencies
"implementation"(platform("org.springframework.boot:spring-boot-dependencies:1.5.18.RELEASE"))
// Constraints
constraints {
"implementation"("args4j:args4j:2.33")
}
}
}
and a submodule defined as:
val copyDependencies by tasks.registering(Copy::class) {
into("build/dependencies")
from(configurations.runtimeClasspath)
}
When I run ./gradlew :module:copyDependencies
, I would expect the args4j
dependency to NOT be copied because it is defined only as a constraint and not declared explicitly by my module.
However, it DOES get copied over:
> ls -l module/build/dependencies
total 304
-rw-r--r-- 1 damiencoraboeuf staff 152K Jul 8 14:39 args4j-2.33.jar
I wonder what I’m doing wrong. I want to simulate a local platform behaviour.
Best regards, and thanks for any help,
Damien