wil*_*son 5 java maven sonarqube
我的设置:
错误示例:
16:00:54 [INFO] [23:00:54.219] Sensor JavaSquidSensor
16:00:55 [INFO] [23:00:55.030] Java Main Files AST scan...
16:00:55 [INFO] [23:00:55.030] 1532 source files to be analyzed
16:00:58 [ERROR] [23:00:57.927] Class not found: javax.annotation.Nullable
16:00:58 [ERROR] [23:00:57.928] Class not found: javax.annotation.CheckReturnValue
16:00:58 [ERROR] [23:00:58.114] Class not found: javax.annotation.Nullable
Run Code Online (Sandbox Code Playgroud)
根据这个stackoverflow问题,javax.annotation应该是java 1.7及更高版本的一部分.此外,我已经尝试将它放在本地maven存储库中,但这没有帮助.
那么Sonar试图找到这个包裹在哪里?有什么帮助?!?
更新:
Kra*_*aal 12
根据http://docs.oracle.com/javase/7/docs/api/index.html?javax/annotation/package-summary.html,您期望的类不是JDK 7的一部分.
您正在寻找的课程是在此处发布的Google JSR-305实施的一部分https://code.google.com/p/jsr-305/source/browse/trunk/ri/src/main/java/javax /annotation/Nullable.java?r=24并移动到Findbugs:
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
根据https://jcp.org/en/jsr/detail?id=305,JSR-305已完成,但处于休眠状态,尚未添加到JDK版本中.
希望能帮助到你.
为避免将SonarQube特定依赖项添加到项目中,请定义如下配置文件:
<profile>
<id>sonarqube</id>
<dependencies>
<dependency>
<groupId>org.joda</groupId>
<artifactId>joda-convert</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
</profile>
Run Code Online (Sandbox Code Playgroud)
然后使用类似命令运行声纳分析
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar -Psonarqube,sonarqube-dev
Run Code Online (Sandbox Code Playgroud)
sonarqube-dev配置文件在我的〜/ .m2/settings.xml中定义,它只是指定我的开发环境SonarQube安装的位置
<profile>
<id>sonarqube-dev</id>
<properties>
<!-- no direct db connections in new sonar -->
<sonar.host.url>
http://localhost:9000/
</sonar.host.url>
</properties>
</profile>
Run Code Online (Sandbox Code Playgroud)
这一切取得了什么成果?
| 归档时间: |
|
| 查看次数: |
10329 次 |
| 最近记录: |