2015-05-04 67 views
1

我正在嘗試對我的代碼庫運行聲吶代碼質量並獲得以下異常。我已成功安裝Sonar服務器,並且http://gsi-547576:9900返回給我的主頁沒有任何問題。我沒有將Sonar連接到任何外部數據庫,並且目前使用默認的內存數據庫。運行聲吶配置文件時出錯

命令使用運行聲納:

mvn clean install -Psonar sonar:sonar 

錯誤日誌:

[INFO] SonarQube version: 5.0 
INFO: Default locale: "en_US", source code encoding: "UTF-8" 
INFO: Work directory: C:\nital\my-pet-projects\istore\istore-mvc2\istore-mvc2-domain\target\sonar 
INFO: SonarQube Server 5.0 
[INFO] [11:21:11.716] Load global referentials... 
[INFO] [11:21:11.916] Load global referentials done: 200 ms 
[INFO] [11:21:11.916] User cache: C:\Users\chandeln\.sonar\cache 
[INFO] [11:21:11.926] Install plugins 
[INFO] [11:21:11.966] Install JDBC driver 
[INFO] [11:21:11.976] Create JDBC datasource for jdbc:h2:tcp://localhost/sonar 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 7.576 s 
[INFO] Finished at: 2015-05-04T11:21:14-04:00 
[INFO] Final Memory: 23M/224M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project istore-mvc2-domain: Fail to connect to database: Cannot create PoolableConnectionFactory (Co 
nnection is broken: "java.net.ConnectException: Connection refused: connect: localhost" [90067-176]) -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 

的settings.xml

<profile> 
     <id>sonar</id> 
     <properties> 
      <sonar.host.url>http://gsi-547576:9900/</sonar.host.url> 
     </properties> 
    </profile> 

的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 

    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.istore</groupId> 
    <artifactId>istore-mvc2-domain</artifactId> 
    <version>1.2-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <maven.compiler.source>1.7</maven.compiler.source> 
     <maven.compiler.target>1.7</maven.compiler.target> 
    </properties> 

    <scm> 
     <connection>scm:svn:https://gsi-547576/svn/istore/istore-mvc2-domain/trunk</connection> 
     <developerConnection>scm:svn:https://gsi-547576/svn/istore/istore-mvc2-domain/trunk</developerConnection> 
     <url>https://gsi-547576/svn/istore/istore-mvc2-domain/trunk</url> 
    </scm> 

    <build> 
     <finalName>${project.artifactId}</finalName> 
     <plugins> 
      <!-- Releasing a project --> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-release-plugin</artifactId> 
       <version>2.5.1</version> 
       <configuration> 
        <tagBase>https://gsi-547576/svn/istore/istore-mvc2-domain/tags</tagBase> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

    <!-- For deploying the artifacts to Nexus -->  
    <distributionManagement> 
     <snapshotRepository> 
      <id>my-nexus-server</id> 
      <name>Internal Snapshots</name> 
      <url>http://gsi-547576:8081/nexus/content/repositories/snapshots</url> 
     </snapshotRepository> 
     <repository> 
      <id>my-nexus-server</id> 
      <name>Internal Releases</name> 
      <url>http://gsi-547576:8081/nexus/content/repositories/releases</url> 
     </repository> 
    </distributionManagement> 

</project> 

回答

0

修改平方米的settings.xml後它的工作:)我的更新settings.xml文件

平方米/ settings.xml中

<profiles> 
     <profile> 
     <id>sonar</id> 
     <activation> 
      <activeByDefault>false</activeByDefault> 
     </activation> 
     <properties> 
      <sonar.host.url>http://gsi-547576:9900</sonar.host.url> 
      <sonar.jdbc.url>jdbc:h2:tcp://gsi-547576:9092/sonar</sonar.jdbc.url> 
      <sonar.jdbc.driver>org.apache.derby.jdbc.ClientDriver</sonar.jdbc.driver> 
      <sonar.jdbc.username>sonar</sonar.jdbc.username> 
      <sonar.jdbc.password>sonar</sonar.jdbc.password> 
     </properties> 
    </profile> 
</profiles>