Hello,
In the context of building the oldClasspath to give to japicmp-gradle-plugin, I am desesperately trying to build a configuration containing the previous version of my subproject.
Let’s suppose a multiproject with a pA subproject. In the rootProject build.gradle I have
subproject(':pA') {
group = "com.xxx"
name = "abc"
version = '17'
configurations {
old
}
repositories {
..
}
dependencies {
old "${group}:${name}:16"
}
With this, the module definition is systematically replaced with my project…
$ ./gradlew :pA:dependencies --configuration old
Executing local gradle wrapper
> Task :pA:dependencies
------------------------------------------------------------
Project :pA
------------------------------------------------------------
old
\--- com.toto:pA:1.0 -> project :pA (*)
(*) - dependencies omitted (listed previously)
I found googling, that a detachedConfiguration could be used, but in that case:
subproject(':pA') {
group = "com.xxx"
name = "abc"
version = '17'
def conf = configurations.detachedConfiguration(
dependencies.create("${group}:${name}:16")
)
tasks.register('printConf').configure {
doLast {
println files(conf).asPath
}
}
}
Then I have some error about ‘default’ configuration that I do not understand.
$ gradle :pA:printConf
Executing local gradle wrapper
> Task :pA:printConf FAILED
FAILURE: Build failed with an exception.
* Where:
Build file 'xxx/gradle_test/build.gradle' line: 62
* What went wrong:
Execution failed for task ':pA:printConf'.
> Could not resolve all files for configuration ':pA:detachedConfiguration1'.
> Could not resolve com.toto:pA:1.0.
Required by:
project :pA
> Project :pA declares a dependency from configuration 'detachedConfiguration1' to configuration 'default' which is not declared in the descriptor for project :pA.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Is there a way to achieve building a configuration referencing another version of the current project?