SonarQube无法索引/找到JAVA文件。

huangapple 未分类评论45阅读模式
英文:

SonarQube does not indexes/find JAVA files

问题

目前我们正在使用 Sonar On-Premise 安装版(7.9.3.X)。

我们通过 Maven 目标 "mvn sonar:sonar" 将 Sonar 分析发送到我们的 Sonar 服务器。我们在 .m2/settings.xml 中配置了服务器 URL 和身份验证。

如果我触发该目标,它不会选择 Java 的质量配置文件。

[INFO] 加载质量配置文件
[INFO] 加载质量配置文件(完成)| 时间=62毫秒
[INFO] 加载活动规则
[INFO] 加载活动规则(完成)| 时间=1159毫秒
[INFO] 正在索引文件...
[INFO] 项目配置:
[INFO] 已索引 1 个文件
[INFO] 由于源代码管理忽略设置,忽略了 0 个文件
[INFO] XML 的质量配置文件: Sonar way

我尝试设置:

<sonar.java.binaries>target/classes</sonar.java.binaries>

用于测试 "Findbugs" 方式

<sonar.sources>src/main/</sonar.sources>

用于测试 "Sonar Way"

以及不推荐使用的设置

<sonar.language>java</sonar.language>

但是配置不会扫描 Java 文件。

我设置的当前 Sonar 属性是:

<sonar.host.url>https://sonar:9000</sonar.host.url>
<sonar.login>secrettoken</sonar.login>
<sonar.projectName>myproject</sonar.projectName>
<sonar.sources>.</sonar.sources>

在其他项目中,扫描 Java 文件是成功的。
在项目的有效 POM 中("mvn help:effective-pom"),我找不到任何排除项或语言 "预选"。

我漏掉了什么?还有其他人遇到过这个问题吗?

感谢您的帮助!

英文:

Currently we are using an Sonar On-Premise installation. (7.9.3.X)

We send our Sonar Analysis via the maven goal "mvn sonar:sonar" to our Sonar Server. We have the Server URL and the authentication configured in our .m2/settings.xml.

If I am triggering the goal it does not select the Quality Profiles for Java.

[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=62ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=1159ms
[INFO] Indexing files...
[INFO] Project configuration:
[INFO] 1 file indexed
[INFO] 0 files ignored because of scm ignore settings
[INFO] Quality profile for xml: Sonar way

I tried to set:

&lt;sonar.java.binaries&gt;target/classes&lt;/sonar.java.binaries&gt;

For testing the "Findbugs" Way

&lt;sonar.sources&gt;src/main/&lt;/sonar.sources&gt;

for testing the "Sonar Way"

and the deprecated Setting

&lt;sonar.language&gt;java&lt;/sonar.language&gt;

but the configuration does not Scan for Java Files.

The current sonar properties I set are:

&lt;sonar.host.url&gt;https://sonar:9000&lt;/sonar.host.url&gt;
&lt;sonar.login&gt;secrettoken&lt;/sonar.login&gt;
&lt;sonar.projectName&gt;myproject&lt;/sonar.projectName&gt;
&lt;sonar.sources&gt;.&lt;/sonar.sources&gt;

In other Projects Scanning for Java files succeed.
In my effective Pom of the Project ("mvn help:effective-pom") I cannot found any exclusions nor a language "preselection".

What am I missing? Anyone else faced this Problem?

Thanks for your help!

答案1

得分: 0

尝试使用以下内容:

&lt;sonar.sources&gt;UTF-8&lt;/sonar.sources&gt;
&lt;sonar.sources&gt;.&lt;/sonar.sources&gt;
英文:

Try with this

&lt;sonar.sources&gt;UTF-8&lt;/sonar.sources&gt;
&lt;sonar.sources&gt;.&lt;/sonar.sources&gt;

huangapple
  • 本文由 发表于 2020年7月27日 14:36:13
  • 转载请务必保留本文链接:https://java.coder-hub.com/63109862.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定