sonar:sonar 无法在 jenkins maven 构建中工作

sonar:sonar not working in jenkins maven build

我有一个 jenkins 构建,应该如何调用声纳插件。但是每次我得到错误:

Downloaded: http://xxxx:8081/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar (165 KB at 20577.1 KB/sec)
[INFO] SonarQube version: 5.6.1
Downloading: http://talas:8081/nexus/content/groups/public/org/codehaus/sonar/sonar-maven3-plugin/5.6.1/sonar-maven3-plugin-5.6.1.pom

Downloading: https://repo.maven.apache.org/maven2/org/codehaus/sonar/sonar-maven3-plugin/5.6.1/sonar-maven3-plugin-5.6.1.pom

[WARNING] The POM for org.codehaus.sonar:sonar-maven3-plugin:jar:5.6.1 is missing, no dependency information available
Downloading: http://xxxx:8081/nexus/content/groups/public/org/codehaus/sonar/sonar-maven3-plugin/5.6.1/sonar-maven3-plugin-5.6.1.jar

Downloading: https://repo.maven.apache.org/maven2/org/codehaus/sonar/sonar-maven3-plugin/5.6.1/sonar-maven3-plugin-5.6.1.jar

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:53 min
[INFO] Finished at: 2016-09-13T12:42:59+02:00
[INFO] Final Memory: 58M/1705M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.2:sonar (default-cli) on project Core: Can not execute SonarQube analysis: Plugin org.codehaus.sonar:sonar-maven3-plugin:5.6.1 or one of its dependencies could not be resolved: Could not find artifact org.codehaus.sonar:sonar-maven3-plugin:jar:5.6.1 in server0001 (http://xxx:8081/nexus/content/groups/public/) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE

在我的 pom.xml 中,我使用依赖项:

<plugin>
    <groupId>org.codehaus.sonar</groupId>
    <artifactId>sonar-maven-plugin</artifactId>
    <version>5.1</version>
</plugin>

我不明白,为什么 maven 使用其他插件而不是作为依赖包含的插件。

Jenkins 作业调用以下目标:

clean
compile
sonar:sonar
-Dsonar.jdbc.url=jdbc:oracle:thin:@oracle11db:1521/orcl
-Dsonar.host.url=http://192.168.0.100:9000

我使用 Jenkins 版本 2.21。 SonarQube scanner 2.6.1 在全局配置中配置

我也试过打电话

 org.codehaus.mojo:sonar-maven-plugin:2.3:sonar 

直接。但它需要 java8 而我的项目是用 Java7

构建的

您是否尝试过使用 org.codehaus.mojo 的插件?

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>sonar-maven-plugin</artifactId>
    <version>2.3</version>
</plugin>

来源:

http://docs.sonarqube.org/display/HOME/Frequently+Asked+Questions