-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
JavaCompile and Test tasks silently ignore explicit executable if it does not exist #21758
Labels
Milestone
Comments
ljacomet
added a commit
that referenced
this issue
Sep 14, 2022
When configuring the executable on JavaCompile or Test, if it points to a non-existing file, Gradle now fails with an error. Fixes #21758
This was referenced Sep 14, 2022
bot-gradle
added a commit
that referenced
this issue
Sep 15, 2022
When configuring the executable on JavaCompile or Test, if it points to a non-existing file, Gradle now fails with an error. Fixes #21758 Co-authored-by: Louis Jacomet <louis@gradle.com>
xaviarias
added a commit
that referenced
this issue
Oct 11, 2022
Extracted duplicate behaviour into a factory method containing additional validations for consistency, i.e. the executable exists and is not a directory. Fixes: #22023 See also: #21758 Add tests for missing validation cases The following tests have been added both for `JavaCompile` and `Test` tasks: - Custom Java home does not exist - Custom Java home is not a directory - Custom Java home is not a valid JVM - Custom executable is not from a valid JVM For the last two tests, `JavaToolchainQueryService` has been updated to throw an exception when the JVM specific toolchain is not valid.
bot-gradle
added a commit
that referenced
this issue
Nov 11, 2022
…tion Extracted duplicate behaviour into a factory method containing additional validations for consistency, i.e. the executable exists and is not a directory. Fixes: #22023 See also: #21758 Co-authored-by: @jbartok **NOTE:** This PR will remain a draft until #22108 is merged in and then needs to be adapted to those changes. Co-authored-by: Xavier Arias Seguí <xavier.arias.segui@gradle.com>
This was referenced Jan 5, 2023
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When resolving which toolchain to use for the java compiler in the
JavaCompile
task or for the launcher in theTest
task, there is a priority that is given to an executable path explicitly set via fork options. However, if a user makes a mistake by providing a wrong path, then the provided value is silently ignored and the current toolchain is used to execute the work.At the very least, the user should be warned about this. However, being strict about this may be better, as this can be overlooked when tasks are running on CI and for some reason it was required to use an explicit path, rather than resolving a toolchain.
gradle/subprojects/language-java/src/main/java/org/gradle/api/tasks/compile/JavaCompile.java
Lines 254 to 262 in c1e31d6
The text was updated successfully, but these errors were encountered: