简体   繁体   English

声纳:声纳在 jenkins maven build 中不起作用

[英]sonar:sonar not working in jenkins maven build

I have a jenkins build, how should call the sonar plugin.我有一个 jenkins 构建,应该如何调用声纳插件。 But every time i get the error:但每次我收到错误时:

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

in my pom.xml i use the dependency:在我的 pom.xml 我使用依赖项:

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

I do not understand, why maven uses an other plugin than this which is included as dependency.我不明白,为什么 maven 使用其他插件而不是作为依赖项包含在内。

The Jenkins Job calls the following Targets: Jenkins 作业调用以下目标:

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

I use Jenkins Version 2.21.我使用 Jenkins 版本 2.21。 SonarQube scanner 2.6.1 is configured in global configuration SonarQube 扫描仪 2.6.1 在全局配置中配置

I also tried to call我也试着打电话

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

directly.直接地。 but it needs java8 and my Project was build with Java7但它需要 java8 而我的项目是用 Java7 构建的

have you tried using the plugin from org.codehaus.mojo?您是否尝试过使用 org.codehaus.mojo 中的插件?

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

Source:来源:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM