11

我已按照指示将 Sonar 与 Maven 集成- 更改了 settings.xml 以在以下位置包含声纳存储库:

http://localhost:9000/deploy/maven

我已经验证我可以在以下位置看到 readme.txt 文件:

http://localhost:9000/deploy/maven/README.txt

但是在运行时,sonar:sonar我不断收到以下消息:

[INFO] [sonar:sonar]
[INFO] Sonar host: http: //localhost:9000
[INFO] Sonar version: 1.7
Downloading: http: //localhost:9000/deploy/maven/org/codehaus/sonar/runtime/sonar
-core-maven-plugin/20090803213910/sonar-core-maven-plugin-20090803213910.pom
Downloading: http: //<MY SERVER URL>:8081/nexus/content/groups/public/org/codehaus/
sonar/runtime/sonar-core-maven-plugin/20090803213910/sonar-core-maven-plugin-200
90803213910.pom
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Can not execute Sonar

Embedded error: Unable to build project for plugin 'org.codehaus.sonar.runtime:s
onar-core-maven-plugin': POM 'org.codehaus.sonar.runtime:sonar-core-maven-plugin
' not found in repository: Unable to download the artifact from any repository

  org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090803213910

从指定的远程存储库:

声纳(http://localhost:9000/deploy/maven),

联系(http://:8081/nexus/content/groups/public),

对于项目 org.codehaus.sonar.runtime:sonar-core-maven-plugin [INFO] ------------------ ------------------------------------------

知道我缺少什么吗?

4

5 回答 5

3

1.在您的本地主机上运行声纳所需的 maven 插件驻留在 @ http://localhost:9000/deploy/maven/ ............(它们与您的声纳安装捆绑在一起)

2. 要选择插件(与您的声纳安装捆绑),您需要在应用程序的根目录执行“mvn sonar:sonar”

3.你不需要依赖你公司的nexus存储库

4.当你不想依赖nexus存储库时,你需要在你的settings.xml的镜像声明中镜像'sonar' => *,!sonar 在你的镜像定义中包含这个!sonar

  1. 在您的一个活动配置文件中声明http://localhost:9000

  2. 启动您的声纳服务器

现在执行命令'mvn sonar:sonar',maven-sonar插件是从本地声纳安装中挑选出来的。

祝你好运,aravind.dev

于 2009-11-17T13:39:42.193 回答
2

很抱歉回复这个旧线程..只是认为这个链接可能指向解决方案。

基本上,您可以尝试修改 maven setting.xml(在 maven 所需的 .m2 文件夹内)中的标签,如下所示:

<mirrorOf>*,!sonar</mirrorOf>

它告诉 Maven 避免将您的正常存储库用于任何声纳下载任务

于 2011-10-24T13:02:56.343 回答
1

不知道问题是什么,但通过升级到版本 1.9.2(我试图让 1.7 工作,因为它当前在另一台服务器上运行)并删除项目 POM 中的 sonar-maven-plugin 定义,运行 mvn sonar:声纳能够成功执行。

于 2009-08-06T02:41:36.943 回答
0

就我而言,我可以通过升级到 maven 3 和 sonar 2.4 来解决这个问题。我还发现使用更新选项 (-U) 运行 maven 会有所帮助。

于 2010-12-16T19:37:35.400 回答
0

localhost is not a remote host; localhost is an alias for the machine you're on. so it's trying to download the stuff from a maven repository server running on your machine.

于 2009-08-05T01:04:51.167 回答