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

Report JVM information for Gradle daemon #29101

Open
big-guy opened this issue May 10, 2024 · 1 comment
Open

Report JVM information for Gradle daemon #29101

big-guy opened this issue May 10, 2024 · 1 comment
Assignees
Labels
a:feature A new functionality in:daemon in:reporting-tasks help dependencyInsight dependencies
Milestone

Comments

@big-guy
Copy link
Member

big-guy commented May 10, 2024

Expected Behavior

It should be easy to understand which version of Java may be used to run a build.

Current Behavior (optional)

No response

Context

gradle -v reports the current JVM used. This is often the same one used by the daemon, but this can be influenced by two different things:

  • org.gradle.java.home can specify a completely different Java home to be used by the daemon
  • Daemon JVM criteria

Additionally, once the build is started, there is no easy way to see the actual JVM used to run the build. This is useful for diagnosing problems caused by running a build with the wrong (or unexpected) version of Java.

Some suggestions:

  • Make gradle -v report the value of org.gradle.java.home or the JVM criteria when set.
  • Make gradle buildEnvironment or similar task report information about the build's actual JVM
@big-guy big-guy added in:daemon a:feature A new functionality in:reporting-tasks help dependencyInsight dependencies labels May 10, 2024
@big-guy big-guy added this to the 8.9 RC1 milestone May 10, 2024
@octylFractal octylFractal self-assigned this May 17, 2024
@tcfurrer
Copy link

tcfurrer commented Jun 6, 2024

In case this helps anyone else waiting for this feature, or just stuck on older Gradle releases...
I've had this in my build.gradle for a long time: (this prints the information for every gradle task)

def level = gradle.startParameter.logLevel as String
if (level != 'QUIET') {
    def gradleVersion = project.getGradle().getGradleVersion()
    def gradleGroovyVersion = GroovySystem.getVersion()
    def gradleJavaVersion = Runtime.version().feature() + '.' + Runtime.version().interim() + '.' + Runtime.version().update()

    printf '%9s %-7s %s\n', 'Gradle', gradleVersion, "(running on JDK $gradleJavaVersion with Groovy ${gradleGroovyVersion})"
}

This would be a little different for showing the Kotlin version, since there is no drop-in replacement there for GroovySystem. But I think it should work similarly for the gradle and gradle java versions there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality in:daemon in:reporting-tasks help dependencyInsight dependencies
Projects
None yet
Development

No branches or pull requests

3 participants