jbang icon indicating copy to clipboard operation
jbang copied to clipboard

renovatebot - upgrading gradle-wrapper-jar in src/main/resources/dist/gradle/gradle

Open wfouche opened this issue 3 months ago • 3 comments

We had to rename the gradle-wrapper.jar file to gradle-wrapper-jar when adding it to the resources gradle sub-folder, because .jar files cannot be kept in the resources tree.

And therefore the gradle-wrapper-jar file is not known to Renovatebot and it will not automatically be upgraded.

Google Gemini claims that this issue can be resolved by adding the following additional configuration to the renovate.json file:

{
  "gradle-wrapper": {
    "fileMatch": [
      "src/main/resources/dist/gradle/gradle/wrapper/gradle-wrapper-jar"
    ]
  }
}

However, I could find any confirmation of this suggestion in renovatebot docs.

wfouche avatar Sep 09 '25 11:09 wfouche

This configuration change should work (to be tested):

{
  "packageRules": [
    {
      "matchManagers": ["gradle-wrapper"],
      "postUpdateOptions": ["runScripts"],
      "postUpdateScripts": [
        "mv src/main/resources/dist/gradle/gradle/wrapper/gradle-wrapper-jar src/main/resources/dist/gradle/gradle/wrapper/gradle-wrapper.jar",
        "src/main/resources/dist/gradle/gradlew wrapper",
        "mv src/main/resources/dist/gradle/gradle/wrapper/gradle-wrapper.jar src/main/resources/dist/gradle/gradle/wrapper/gradle-wrapper-jar"
      ]
    }
  ]
}

wfouche avatar Sep 09 '25 11:09 wfouche

Alternatively, and less desirable, run gradlew wrapper to regenerate the Gradle wrapper JAR file as part of the "jbang export gradle ..." pipeline.

wfouche avatar Sep 09 '25 11:09 wfouche

because .jar files cannot be kept in the resources tree.

what prevents that atm?

This configuration change should work (to be tested):

I don't think it will work due to:

"Post-upgrade tasks are blocked by default for security reasons, so the admin of Renovate needs to choose whether to allow specific commands or any commands to be run"

i can't imagine those are available on github hosted renovate.

maxandersen avatar Sep 11 '25 22:09 maxandersen