My project contains several sub-projects, and I use a common platform to define version constraints for all of them so that I only have one place to maintain the versions (similar to a properties block with Maven), and so that I can move some of the nastier hacks out of the individual projects.
I run Gradle 6.5.1.
(UPDATE: The projects that fail are my three WAR projects, which use providedCompile to define their dependencies. According to a scan the conflict happens inside the providedRuntime configuration)
In one of my projects the build fails if I remove the version for one of the dependencies.
OK: implementation 'jmimemagic:jmimemagic:0.1.2'
Not OK: implementation 'jmimemagic:jmimemagic'
According to the “dependencies” task, the failure is related to xml-apis. I added some snippets below.
I’d like to resolve the dependencies based on my platform constraints, and I’d like to include nested/transitive dependencies in that. This doesn’t seem to work as anticipated.
How can I make sure that, in this example, the versions for jmimemagic and xml-apis are set as defined in the platform, without causing a failure? xml-apis-ext seems to be part of the problem.
Thank you!
The interesting lines of this platform:
dependencies { constraints {
runtime('xml-apis:xml-apis') { version {
strictly '[1.4.01,2.0.0['
reject '2.0.0'
reject '2.0.2'
because '1.4.01 is more recent than 2.x'
} }
api 'jmimemagic:jmimemagic:0.1.2'
}
Some snippets from the “dependencies” task:
OK:
| \--- xerces:xercesImpl -> 2.11.0
| \--- xml-apis:xml-apis:1.4.01
[…]
| | | | | +--- jmimemagic:jmimemagic:0.1.2
| | | | | | +--- oro:oro:2.0.8
| | | | | | +--- commons-logging:commons-logging:1.0.4 -> 1.2
| | | | | | +--- xerces:xercesImpl:2.7.1 -> 2.11.0 (*)
| | | | | | \--- xml-apis:xml-apis:2.0.2 -> 1.4.01
[…]
| | | | | +--- org.apache.xmlgraphics:batik-dom:1.11
| | | | | | +--- org.apache.xmlgraphics:batik-css:1.11 (*)
| | | | | | +--- org.apache.xmlgraphics:batik-ext:1.11
| | | | | | +--- org.apache.xmlgraphics:batik-util:1.11 (*)
| | | | | | +--- org.apache.xmlgraphics:batik-xml:1.11
| | | | | | | \--- org.apache.xmlgraphics:batik-util:1.11 (*)
| | | | | | +--- xml-apis:xml-apis:1.3.04 -> 1.4.01
| | | | | | \--- xml-apis:xml-apis-ext:1.3.04
Not OK:
| \--- xerces:xercesImpl -> 2.11.0
| \--- xml-apis:xml-apis:1.4.01 FAILED
[…]
| | | | | +--- jmimemagic:jmimemagic -> 0.1.2
| | | | | | +--- oro:oro:2.0.8
| | | | | | +--- commons-logging:commons-logging:1.0.4 -> 1.2
| | | | | | +--- xerces:xercesImpl:2.7.1 -> 2.11.0 (*)
| | | | | | \--- xml-apis:xml-apis:2.0.2 FAILED
[…]
| | | | | +--- org.apache.xmlgraphics:batik-dom:1.11
| | | | | | +--- org.apache.xmlgraphics:batik-css:1.11 (*)
| | | | | | +--- org.apache.xmlgraphics:batik-ext:1.11
| | | | | | +--- org.apache.xmlgraphics:batik-util:1.11 (*)
| | | | | | +--- org.apache.xmlgraphics:batik-xml:1.11
| | | | | | | \--- org.apache.xmlgraphics:batik-util:1.11 (*)
| | | | | | +--- xml-apis:xml-apis:1.3.04 FAILED
| | | | | | \--- xml-apis:xml-apis-ext:1.3.04