首页 > 解决方案 > 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.

标签: javasonarqubejava-11bitbucket-pipelinessonarcloud

解决方案


我不确定是什么问题。公告通知您必须使用 Java 11+ 来执行扫描,但您仍然可以使用 Java <11 编译代码。您没有提供有关您的项目的任何信息,所以让我们以一个 Maven 项目为例。

这通常意味着您必须执行以下操作:

// 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

推荐阅读