2011-06-01 95 views
2

我已经开始使用声纳maven插件(以及声纳i一般)。 Sonar安装在另一台服务器上,可以在网址http://host:8080/sonar中成功访问。在pom.xml的配置如下:Sonar maven插件无法下载JDBC驱动程序

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>sonar-maven-plugin</artifactId> 
    <version>1.0-beta-2</version> 
    <configuration> 
    <sonar.host.url>http://host:8080/sonar</sonar.host.url> 
    </configuration> 
</plugin> 

编辑 我已经切换与sonarHostUrl的sonar.host.url为好,都无济于事。

(我仍然使用1.0-β作为2.0需要行家3我们已经没有切换到尚未)

声纳web应用也与右属性进行配置:

sonar.web.host: host 
sonar.web.port: 8080 
sonar.web.context: /sonar 

当我运行声纳maven插件(mvn sonar:sinar)时,这里是输出。看起来,即使我正确配置了位置,声纳仍然会查找默认的http://localhost:9000/安装。

[INFO] Scanning for projects... 
Downloading: http://host/nexus/content/groups/public/org/codehaus/mojo/sonar-maven-plugin/1.0-beta-2/sonar-maven-plugin-1.0-beta-2.pom 
6K downloaded (sonar-maven-plugin-1.0-beta-2.pom) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/mojo/sonar-maven-plugin/1.0-beta-2/sonar-maven-plugin-1.0-beta-2.jar 
13K downloaded (sonar-maven-plugin-1.0-beta-2.jar) 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Maven Webapp 
[INFO] task-segment: [sonar:sonar] (aggregator-style) 
[INFO] ------------------------------------------------------------------------ 
[INFO] [sonar:sonar {execution: default-cli}] 
[INFO] Sonar host: http://host:8080/sonar 
[INFO] Sonar version: 2.8 
[INFO] Execute: org.codehaus.sonar:sonar-maven-plugin:2.8:sonar 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-maven-plugin/2.8/sonar-maven-plugin-2.8.pom 
1K downloaded (sonar-maven-plugin-2.8.pom) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar/2.8/sonar-2.8.pom 
33K downloaded (sonar-2.8.pom) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-maven-plugin/2.8/sonar-maven-plugin-2.8.jar 
7K downloaded (sonar-maven-plugin-2.8.jar) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-batch/2.8/sonar-batch-2.8.pom 
2K downloaded (sonar-batch-2.8.pom) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-core/2.8/sonar-core-2.8.pom 
3K downloaded (sonar-core-2.8.pom) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-plugin-api/2.8/sonar-plugin-api-2.8.pom 
6K downloaded (sonar-plugin-api-2.8.pom) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-check-api/2.8/sonar-check-api-2.8.pom 
736b downloaded (sonar-check-api-2.8.pom) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-colorizer/2.8/sonar-colorizer-2.8.pom 
1K downloaded (sonar-colorizer-2.8.pom) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-channel/2.8/sonar-channel-2.8.pom 
1K downloaded (sonar-channel-2.8.pom) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-duplications/2.8/sonar-duplications-2.8.pom 
1K downloaded (sonar-duplications-2.8.pom) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-graph/2.8/sonar-graph-2.8.pom 
1K downloaded (sonar-graph-2.8.pom) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-squid/2.8/sonar-squid-2.8.pom 
2K downloaded (sonar-squid-2.8.pom) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-deprecated/2.8/sonar-deprecated-2.8.pom 
1K downloaded (sonar-deprecated-2.8.pom) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-java-api/2.8/sonar-java-api-2.8.pom 
953b downloaded (sonar-java-api-2.8.pom) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-batch/2.8/sonar-batch-2.8.jar 
126K downloaded (sonar-batch-2.8.jar) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-core/2.8/sonar-core-2.8.jar 
69K downloaded (sonar-core-2.8.jar) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-plugin-api/2.8/sonar-plugin-api-2.8.jar 
372K downloaded (sonar-plugin-api-2.8.jar) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-check-api/2.8/sonar-check-api-2.8.jar 
8K downloaded (sonar-check-api-2.8.jar) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-colorizer/2.8/sonar-colorizer-2.8.jar 
32K downloaded (sonar-colorizer-2.8.jar) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-channel/2.8/sonar-channel-2.8.jar 
15K downloaded (sonar-channel-2.8.jar) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-duplications/2.8/sonar-duplications-2.8.jar 
70K downloaded (sonar-duplications-2.8.jar) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-graph/2.8/sonar-graph-2.8.jar 
27K downloaded (sonar-graph-2.8.jar) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-squid/2.8/sonar-squid-2.8.jar 
60K downloaded (sonar-squid-2.8.jar) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-deprecated/2.8/sonar-deprecated-2.8.jar 
59K downloaded (sonar-deprecated-2.8.jar) 
Downloading: http://host/nexus/content/groups/public/org/codehaus/sonar/sonar-java-api/2.8/sonar-java-api-2.8.jar 
8K downloaded (sonar-java-api-2.8.jar) 
[INFO] [sonar:sonar {execution: default-sonar}] 
[INFO] ------------------------------------------------------------------------ 
[ERROR] BUILD ERROR 
[INFO] ------------------------------------------------------------------------ 
[INFO] Can not execute Sonar 

Embedded error: Fail to download the file: http://localhost:9000/deploy/jdbc-driver.jar (no proxy) 
Connection refused: connect 
[INFO] ------------------------------------------------------------------------ 
[INFO] For more information, run Maven with the -e switch 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 33 seconds 
[INFO] Finished at: Wed Jun 01 10:53:33 IDT 2011 
[INFO] Final Memory: 13M/33M 
[INFO] ------------------------------------------------------------------------ 

任何想法如何解决这个问题?

回答

4

那么,我的配置是错误的。你不应该有插件定义内的任何<configuration>,但与声纳性能,而一个<properties>块:

<properties> 
    <sonar.host.url>http://host:8080/sonar</sonar.host.url> 
    <sonar.jdbc.url>jdbc:mysql://host:3306/sonar</sonar.jdbc.url> 
    <sonar.jdbc.username>sonardb</sonar.jdbc.username> 
    <sonar.jdbc.password>sonardbpassword</sonar.jdbc.password> 
    <sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver> 
</properties> 

感谢弗雷迪槌为pointing it out

+0

我想,如果你使用sonarHostURL您可以使用配置部分,但我认为性能更好反正。 – 2011-06-05 20:26:53

+0

试过了。答案是基于声纳用户邮件列表的回应 – 2011-06-06 06:16:05

1

加入Maven的settings.xml中的下一个代码:

<profile> 
     <id>sonar</id> 
     <activation> 
      <activeByDefault>true</activeByDefault> 
     </activation> 
     <properties> 
      <!-- EXAMPLE FOR MYSQL --> 
       <sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar</sonar.jdbc.url> 
       <sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver> 
      <sonar.jdbc.username>root</sonar.jdbc.username> 
      <sonar.jdbc.password>1234</sonar.jdbc.password> 

      <!-- optional URL to server. Default value is http://localhost:9000 --> 
      <sonar.host.url> 
       http://localhost:9000 
      </sonar.host.url> 
     </properties> 
    </profile> 
相关问题