Skip to content

Don't set java home per-configuration#552

Merged
olafurpg merged 1 commit intomainfrom
set-java-home-correctly
Apr 19, 2023
Merged

Don't set java home per-configuration#552
olafurpg merged 1 commit intomainfrom
set-java-home-correctly

Conversation

@keynmol
Copy link
Contributor

@keynmol keynmol commented Apr 19, 2023

I've been seeing lots of issues with plugin/compile not working - even on a clean machine.
It'd work once, and then next invocation crashes:

[info] compiling 21 Java sources to /Users/antonsviridov/projects/sourcegraph/scip-java/semanticdb-javac/target/classes ...
[warn] Unexpected javac output: Unrecognized option: --add-exports
[warn] Error: Could not create the Java Virtual Machine.
[warn] Error: A fatal exception has occurred. Program will exit..
[warn] javac exited with exit code 1
[debug] Rolling back changes to class files.
[debug] Removing generated classes:
[debug] Restoring class files:
[debug] Removing the temporary directory used for backing up class files: /Users/antonsviridov/projects/sourcegraph/scip-java/semanticdb-javac/target/classes.bak
[error] (plugin / Compile / compileIncremental) javac returned non-zero exit code
[error] Total time: 0 s, completed 19 Apr 2023, 10:06:41

sbt:root> plugin/Compile/javaHome
[info] Some(/Users/antonsviridov/Library/Caches/Coursier/arc/https/cdn.azul.com/zulu/bin/zulu8.68.0.21-ca-jdk8.0.362-macosx_aarch64.tar.gz/zulu8.68.0.21-ca-jdk8.0.362-macosx_aarch64)

If one takes a look at the debug output, it's clear that for some reason javacOptions have changed between runs:
image

Randomly thrashing about I ended up removing the javaHome from per-configuration settings, to the global one.

Immediately I was successful in running plugin/compile multiple times without issue, along with rerunning tests without having to constantly clear the cache.

I cannot explain it, nor am I sure that this is the fix, but it's a pretty strong signal on my machine that this change fixes one of the issues I was having.

Test plan

CI shouldn't be affected by this change, manual testing confirms some improvements.

@keynmol keynmol marked this pull request as ready for review April 19, 2023 10:08
@keynmol keynmol requested a review from olafurpg April 19, 2023 10:23
@olafurpg olafurpg merged commit 4718bce into main Apr 19, 2023
@keynmol keynmol deleted the set-java-home-correctly branch April 19, 2023 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants