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

jvm.config is ignored for maven builds #704

Closed
codefish1 opened this issue Oct 24, 2022 · 0 comments · Fixed by #708
Closed

jvm.config is ignored for maven builds #704

codefish1 opened this issue Oct 24, 2022 · 0 comments · Fixed by #708
Labels
bug Something isn't working

Comments

@codefish1
Copy link

codefish1 commented Oct 24, 2022

Describe the bug
When using tools such as ErrorProne with JDK16+ you need to define various export flags for the JVM as documented in the error prone installation such as

--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED

These would be defined within .mvn/jvm.config so that the same settings apply to everyone who checking out the code and running it, making builds reproducible easier.

These however aren't been picked up by the plugin, resulting in

An exception has occurred in the compiler (17.0.3). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com/) after checking the Bug Database (http://bugs.java.com/) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you. 12:21:55 java.lang.IllegalAccessError: class com.google.errorprone.ErrorProneAnalyzer (in unnamed module @0x293b7a99) cannot access class com.sun.tools.javac.main.JavaCompiler (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.main to unnamed module @0x293b7a99

To Reproduce
A maven project which requires the modules to be exported (for example Using ErrorProne) combined with JDK16+.

Expected behavior
The plugin should detect the JVM config file and make use of it for defining the various options.

Work around
If you define all of the exports again in your Jenkins file, but this leads to duplication and people will forget to update both.

def rtMaven = Artifactory.newMavenBuild()
rtMaven.opts = "--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED"

Versions

  • Jenkins Artifactory plugin version: 3.13.0
  • Jenkins operating system: Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant