使用 Java 11 运行 SonarScanner 分析,使用 Java 8 运行目标代码 [英] Run SonarScanner analysis with Java 11, run target code with Java 8

查看:57
本文介绍了使用 Java 11 运行 SonarScanner 分析,使用 Java 8 运行目标代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如下图所示,SonarSource 终止了对运行 Java 11 之前版本的代码分析器的支持

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

我试图搜索关于如何运行 bitbucket 管道以使用 java 11 Analyzer 执行 SonarScanner 分析但目标代码使用 pre-java 11 版本(例如 java 8)的完整示例,但我找不到.按照那张图,应该是可以的.

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.

推荐答案

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

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

这篇关于使用 Java 11 运行 SonarScanner 分析,使用 Java 8 运行目标代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆