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

PitestTask should run PIT using Java pointed in toolchain set for project execution #301

Open
szpak opened this issue Sep 19, 2021 · 2 comments

Comments

@szpak
Copy link
Owner

szpak commented Sep 19, 2021

Based on my tries with using Java toolchain for testing the plugin itself, it seems that PIT in PitestTask is executed with the JVM which was used to start the Gradle process, not the one selected with the toolchain options.

JavaExec in Gradle 6.9.1 allows to set javaLauncher, so it should be possible to achieve:
https://docs.gradle.org/current/userguide/toolchains.html#sec:plugins

Update. The PoC confirmed that, however, there is some more work around to make it usable for CI and for external contributors.

@LarsEckart
Copy link

Just wanted to comment that I recently ran into this issue.
I've a project that uses gradle toolchain set to jdk 17, and this is also my default jdk on classpath.
When working on that project, others who had jdk11 on their classpath, they could run pitest but all they saw was a report with 0 coverage and in logs they could read Could not load kata.Application kata/Application has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0.

@szpak szpak modified the milestones: 1.9.0, 1.9.1 Aug 19, 2022
@szpak szpak modified the milestones: 1.9.11, 1.9.12, 1.9.13 Nov 25, 2022
@szpak szpak modified the milestones: 1.9.13, 1.15.1 Sep 28, 2023
@danishnawab
Copy link

For anyone running into this issue, you can configure the jvmPath to the default toolchain launcher.

pitest {
    ...
    jvmPath = javaToolchains.launcherFor { languageVersion = java.toolchain.languageVersion }.get().executablePath
    ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants