I have a Kotlin project with these Gradle dependencies:
+--- com.jcraft:jsch.agentproxy.jsch:0.0.7
| +--- com.jcraft:jsch:0.1.49 -> 0.1.55
| \--- com.jcraft:jsch.agentproxy.core:0.0.9
+--- org.eclipse.jgit:org.eclipse.jgit:5.7.0.202003110725-r
| +--- com.jcraft:jsch:0.1.55
| +--- com.jcraft:jzlib:1.1.1
| +--- com.googlecode.javaewah:JavaEWAH:1.1.7
| +--- org.slf4j:slf4j-api:1.7.2 -> 1.7.25
| +--- org.bouncycastle:bcpg-jdk15on:1.64
| | \--- org.bouncycastle:bcprov-jdk15on:1.64
| +--- org.bouncycastle:bcprov-jdk15on:1.64
| \--- org.bouncycastle:bcpkix-jdk15on:1.64
| \--- org.bouncycastle:bcprov-jdk15on:1.64
As you can see, Gradle’s “most recent version wins” resolution strategy updates com.jcraft:jsch:0.1.49 -> 0.1.55
. However, the POM generated by the Maven Publish Plugin only contains the following dependency from the com.jcraft
group:
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy.jsch</artifactId>
<version>0.0.7</version>
<scope>runtime</scope>
</dependency>
Which means the consumer of the POM will use com.jcraft:jsch:0.1.49
instead of com.jcraft:jsch:0.1.55
, which causes problems. I was hoping to resolve this by Customizing dependencies versions and adding a versionMapping
like:
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
But that does not change anything in the generated POM. How can I make the POM also force the jsch
dependency to version 0.1.55
, preferably without me explicitly listing com.jcraft:jsch:0.1.55
in my build.gradle.kts
file (e.g. by doing as described at overriding transitive dependency versions)?