I have sensibly the same issue as the user in this question, however the issue this time is in a transitive dependency, henceforth I cannot use the suggested answer that only works on direct dependencies. Note that compliance-common is a gradle project published as ivy with gradle metadata, all other dependencies are pure ivy.
* What went wrong:
Execution failed for task ':war'.
> Could not resolve all files for configuration ':runtimeClasspath'.
> Could not resolve com.vmd:vmd-spring:latest.release.
Required by:
project : > com.vmd:compliance-common:20221017233522
> No matching configuration of com.vmd:vmd-spring:300317 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
- Configuration 'compile':
- Other compatible attributes:
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its usage (required a runtime)
- Configuration 'eclipse':
- Other compatible attributes:
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its usage (required a runtime)
- Configuration 'runtime':
- Other compatible attributes:
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its usage (required a runtime)
- Configuration 'sources':
- Other compatible attributes:
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its usage (required a runtime)
- Configuration 'test':
- Other compatible attributes:
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its usage (required a runtime)
Consumer project build.gradle:
dependencies {
implementation(group: 'com.vmd', name: 'compliance-common', version: "latest.integration")
testImplementation(testFixtures(group: 'com.vmd', name: 'compliance-common', version: "latest.integration"))
// And 20 other dependencies...
Compliance-common’s build.gradle:
dependencies {
implementation(group: 'com.vmd', name: 'vmd-spring', version: "latest.release", configuration: "compile") {
targetConfiguration = "compile"
}
// And 7 other dependencies...
I have found however that by excluding vmd-spring
on both the compliance-common imports and then directly importing it like so works:
implementation(group: 'com.vmd', name: 'vmd-spring', version: 'latest.release', configuration: 'compile')
testImplementation(group: 'com.vmd', name: 'vmd-spring', version: 'latest.release', configuration: 'compile')
implementation(group: 'com.vmd', name: 'compliance-common', version: "latest.integration") {
exclude group: 'com.vmd', module: 'vmd-spring'
}
testImplementation(testFixtures(group: 'com.vmd', name: 'compliance-common', version: "latest.integration")) {
exclude group: 'com.vmd', module: 'vmd-spring'
}
However, is there a cleaner version of this I can make? vmd-spring
is not the only dependency in it that causes the above issue (but the other ones have been globally excluded as I don’t need them). Given all that, excluding one by one the transitive dependencies seems very brittle.