Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle: Support installation of JDK version requested by Gradle Daemon JVM Discovery #30165

Open
rarkins opened this issue Jul 13, 2024 Discussed in #30164 · 0 comments
Open
Labels
manager:gradle Gradle package manager manager:gradle-wrapper priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)

Comments

@rarkins
Copy link
Collaborator

rarkins commented Jul 13, 2024

Discussed in #30164

Originally posted by davidburstrom July 13, 2024

What would you like help with?

Other

How are you running Renovate?

Mend Renovate hosted app on github.com

If you're self-hosting Renovate, tell us which platform (GitHub, GitLab, etc) and which version of Renovate.

No response

Please tell us more about your question or problem

The JDK that gets installed in order to run Gradle is resolved by Renovate based on the Gradle version in use (source). There is a new Gradle feature, Daemon JVM discovery, that dictates which (installed) JDK the daemon should be launched with.

By inspecting the gradle/gradle-daemon-jvm.properties file (if present), Renovate can resolve which JDK version it should install.

The reason I discovered this was because the job to update the Gradle wrapper (davidburstrom/contester#111) failed to run ./gradlew :wrapper, and while investigating the job logs, I found that it installed JDK 17 whereas Gradle requested JDK 21.

JDK selection is necessary to support cases where any applied Gradle plugins require a more modern JDK than Gradle itself requires.

Logs (if relevant)

Logs
DEBUG: Using containerbase dynamic installs (branch="renovate/gradle-8.x")
DEBUG: Resolved stable matching version (branch="renovate/gradle-8.x")
{
  "toolName": "java"
  "constraint": "^17.0.0"
  "resolvedVersion": "17.0.11+9"
}

DEBUG: Executing command (branch="renovate/gradle-8.x")
{
  "command": "install-tool java 17.0.11+9"
}

DEBUG: exec completed (branch="renovate/gradle-8.x")
{
  "durationMs": 8002
  "stdout": "[10:50:18.078] INFO (62): Installing tool java@17.0.11+9...\nopenjdk version \"17.0.11\" 2024-04-16\nOpenJDK Runtime Environment Temurin-17.0.11+9 (build 17.0.11+9)\nOpenJDK 64-Bit Server VM Temurin-17.0.11+9 (build 17.0.11+9, mixed mode, sharing)\n[10:50:25.190] INFO (62): Installed tool java in 7.1s.\n"
  "stderr": ""
}

DEBUG: Executing command (branch="renovate/gradle-8.x")
{
  "command": "./gradlew :wrapper --gradle-distribution-url https://services.gradle.org/distributions/gradle-8.9-bin.zip --gradle-distribution-sha256-sum d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab"
}

DEBUG: rawExec err (branch="renovate/gradle-8.x")
{
  "err": {
    "cmd": "/bin/sh -c ./gradlew :wrapper --gradle-distribution-url https://services.gradle.org/distributions/gradle-8.9-bin.zip --gradle-distribution-sha256-sum d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab",
    "stderr": "\nFAILURE: Build failed with an exception.\n\n* What went wrong:\nCannot find a Java installation on your machine (Linux 5.15.0-1058-aws amd64) matching the Daemon JVM defined requirements: Compatible with Java 21 (from gradle/gradle-daemon-jvm.properties).\n\n* Try:\n> Run with --stacktrace option to get the stack trace.\n> Run with --info or --debug option to get more log output.\n> Run with --scan to get full insights.\n> Get more help at https://help.gradle.org.\n",```

</details>
</div>
@rarkins rarkins added type:feature Feature (new functionality) priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others manager:gradle Gradle package manager manager:gradle-wrapper labels Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
manager:gradle Gradle package manager manager:gradle-wrapper priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)
Projects
None yet
Development

No branches or pull requests

1 participant