Skip to content

Spotbugs can use Java 8 or Java 11

Cameron Swords requested to merge optional-java-11 into master

What does this MR do?

The version of Java that Spotbugs will use can be set using an environment variable SAST_JAVA_VERSION. Valid values are either 8, or 11.

SDKMAN! is used to install both versions of Java, as well as set the system wide default Java. It is necessary to set the Java system wide so that Spotbugs and its dependencies (e.g. Maven) use the same specified Java version. Note that the JAVA_PATH variable overrides SAST_JAVA_VERSION, meaning that Spotbugs will run with the Java at the specified path. However, dependencies such as Maven will not use JAVA_PATH and will instead use the system default.

A bash script is used to setup the system wide Java on run of the docker image. The analyzer will be called once Java has been setup. This means that the entry point to this image is no longer the analyzer, but instead is the run script. I have bumped the major version of the image due to this change.

When no SAST_JAVA_VERSION environment is used, the system defaults to Java 8.

This closes EE issue 9998.

This is an extension of the work @haynes has done on a separate MR.

What are the relevant issue numbers?

Does this MR meet the acceptance criteria?

Edited by Cameron Swords

Merge request reports

Loading