Search code examples
gradlegrailsapache-commons

Change version of dependency defined by Graiils


We are currently running Grails 3.3.10. We are running into an issue with the included version of the Apache commons-validator. Grails 3.3.10 seems to use version 1.5.1 of the commons-validator.

Ideally we would like to update only the commons-validator and not Grails, I can see that the most current version is 1.7.

Is it possible to override the version included by Grails?

It seems like if I include it in my build.gradle with compile 'commons-validator:commons-validator:1.7' it will be downloaded by Gradle but will just live alongside the 1.5.1 version. When I run my app locally it will still use the 1.5.1 version (verified with breakpoints in IntelliJ).

Thanks for the assistance.


Solution

  • See the project at https://github.com/jeffbrown/tyrelhdependency

    https://github.com/jeffbrown/tyrelhdependency/blob/fb2912ebbac7ef6db2ee9446709248d8c70f50e6/build.gradle#L76

    compile 'commons-validator:commons-validator:1.7'
    

    If you run the dependency report gradlew dependencyReport and then inspect build/reports/project/dependencies.txt you will see that commons-validator has been updated to 1.7.

    If you build the .war file with gradlew assemble and inspect build/libs/tyrelhdependency-0.1.war you should see that only 1 version of the library is there.