How to override the dependency lib version in .hpi file produced by gradle-jpi-plugin

I am using gradle-jpi-plugin to produce hpi file for my plugin. I need to override some dependencies versions in the plugin hpi file. I added the following changes to build.gradle to override the lib versions, but none of them is working

configurations.all {
    resolutionStrategy {
        force 'org.codehaus.groovy:groovy-all:2.5.15'
    resolutionStrategy.eachDependency { details ->
        if ( == 'org.codehaus.groovy'
                && !'groovy-all') ) {
            details.useVersion "2.5.15"

gradlew dependencies --info is showing the updated version

+--- org.codehaus.groovy:groovy-all:2.4.12 -> 2.5.15 (*)

I think you cannot override the groovy version, because this library is provided by Jenkins core. You need to stick to those libraries if they are already loaded in the Jenkins runtime.

1 Like

if that is the case, is there a way to skip copying this lib into hpi file?