简体   繁体   English

使用Sonar配置Maven,jenkins

[英]Configuring Maven, jenkins with Sonar

I have installed Jenkins and Sonar, both work fine. 我已经安装了Jenkins和Sonar,两者都可以正常工作。 I am able to build a maven android project using Jenkins. 我能够使用Jenkins构建Maven android项目。 No i want to run Sonar on the android project. 不,我想在android项目上运行Sonar。 I have installed the Sonar plugin in Jenkins. 我已经在Jenkins中安装了Sonar插件。 Configured the sonar module in the configure system module and added a post build task for sonar to run 在配置系统模块中配置了声纳模块,并添加了构建后任务以使声纳运行

[ERROR] Plugin org.codehaus.mojo:sonar-maven-plugin:sonar or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:sonar-maven-plugin:jar:sonar: Could not find artifact org.codehaus.mojo:sonar-maven-plugin:pom:sonar in nbs-repo (http://10.10.2.89:8081/nexus/content/groups/public/) -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin org.codehaus.mojo:sonar-maven-plugin:sonar or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:sonar-maven-plugin:jar:sonar
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:129)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:142)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:261)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185)
    at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor(MojoDescriptorCreator.java:235)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:106)
    at 

My nexus installation works fine ? 我的nexus安装正常吗? What am i doing wrong. 我究竟做错了什么。 My maven pom.xml does not contain any sonar plugin. 我的maven pom.xml不包含任何声纳插件。 What am i doing wrong? 我究竟做错了什么?

Kind Regards 亲切的问候

  1. From the error message its clear that mvn is trying to download the sonar-maven-plugin from your local Nexus repository which does not seem to have it. 从错误消息中可以清楚地看出mvn正在尝试从您本地的Nexus储存库(似乎没有安装)下载sonar-maven-plugin

  2. Try mvn -U in the build in case you already have the plugin.This overrides the negative cache. 如果已经有了插件,请在构建中尝试mvn -U ,这将覆盖负缓存。 Another thing is <updatepolicy> in your settings.xml 另一件事是<updatepolicy>在你settings.xml

  3. If you don't have the plugin and neither does your Nexus connect to the internet, you have to manually download and upload in Nexus of course. 如果您没有该插件,并且Nexus也无法连接到互联网,那么您当然必须在Nexus中手动下载和上传。 Please remember to match the version of the plugin with the SONAR installation. 请记住,要将该插件的版本与SONAR安装进行匹配。 Also there would be a few (7-10) transitive dependencies with the plugin which you will need. 另外,您将需要使用该插件的几个(7-10)可传递依赖项。 I suggest using mvn -X or mvn -e to see a verbose output during your testing. 我建议在测试期间使用mvn -Xmvn -e查看详细输出。

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

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