Search code examples
gradlegsonbuild.gradlegradle-plugin

Gradle downloading wrong gson version


In order to resolve vulnerability inside our docker container. We want to upgrade the project to Gradle 7.4.2. Also, we are specifying the version like below. After trying constraints and exclude also. When we do a build and copy jars inside docker container. We are still seeing gson-2.8.6.jar present inside /lib/plugins folder. Can someone help why the dependency is not getting updated? I have already tried printing the dependencyInsight and there are not any jars which require lower version of gson

dependencies {
  implementation 'com.google.code.gson:gson:2.9.0'
}

Solution

  • In case you mean the /lib/plugins folder in the folder of your Gradle installation (e.g. gradle-7.4.2/lib/plugins), then that seems to be the version Gradle itself is using, and it is unrelated to your application. It looks like Gradle 7.5 will use a newer Gson version (see Gradle pull request).