Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
765 views
in Technique[技术] by (71.8m points)

sonarqube - Run SonarScanner analysis with Java 11, run target code with Java 8

As the following image points out, SonarSource ended support to run code Analyzers with pre-11 Java versions

Sonar ending support for analysis with Java 8-9-10

I have tried to search for a full example about how to run a bitbucket pipeline to execute SonarScanner analysis using a java 11 Analyzer but having target code using pre-java 11 versions (e.g. java 8), but I wasn't able to found one. According to that image, it should be possible.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I'm not sure what is the problem. The announcements informs that you have to use Java 11+ to execute scans, but you can still compile your code with Java <11. You didn't provide any information about your project, so let's take a Maven as an example.

It generally means that you have to do something like this:

// set Java to 8
export JAVA_HOME=/path/to/jdk8/

// compile, test and build
mvn package

// set Java to 11
export JAVA_HOME=/path/to/jdk11/

// execute scanner
mvn sonar:sonar

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...