2017-08-17 12 views
1

SonarQube v 5.6.6と最新のJaCoCoを使用したマルチモジュールMavenプロジェクトがあります。以下のようSonarQube + JaCoCo + TeamCity間違ったモジュール名

構成は次のとおりです。

<properties> 
    <sonar-maven-plugin.version>3.3.0.603</sonar-maven-plugin.version> 
    <jacoco-maven-plugin.version>0.7.9</jacoco-maven-plugin.version> 
    <sonar-jacoco-listeners.version>4.10.0.10260</sonar-jacoco-listeners.version> 
    <maven-surefire-plugin.version>2.20</maven-surefire-plugin.version> 
    <sonar.java.binaries>${basedir}</sonar.java.binaries> 
    <!--sonar properties--> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <sonar.projectName>GR</sonar.projectName> 
    <!-- Use the following property to force single language analysis, omit it to perform Multilanguage analysis --> 
    <sonar.language>java</sonar.language> 

    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin> 

    <jacoco.outputDir>${project.build.directory}</jacoco.outputDir> 
    <!-- Jacoco output file for UTs --> 
    <jacoco.out.ut.file>jacoco-ut.exec</jacoco.out.ut.file> 
    <!-- Tells Sonar where the Jacoco coverage result file is located for Unit Tests --> 
    <sonar.jacoco.reportPath>${jacoco.outputDir}/${jacoco.out.ut.file}</sonar.jacoco.reportPath> 
    <!--sonar properties--> 

</properties> 

<profiles> 
    <profile> 
     <id>sonar</id> 
     <build> 
      <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-surefire-plugin</artifactId> 
        <version>${maven-surefire-plugin.version}</version> 
        <configuration> 
         <argLine>${jacoco.agent.ut.arg}</argLine> 
         <properties> 
          <property> 
           <name>listener</name> 
          <value>org.sonar.java.jacoco.JUnitListener</value> 
          </property> 
         </properties> 
         <testFailureIgnore>true</testFailureIgnore> 
        </configuration> 
       </plugin> 
       <plugin> 
        <groupId>org.jacoco</groupId> 
        <artifactId>jacoco-maven-plugin</artifactId> 
        <version>${jacoco-maven-plugin.version}</version> 
        <executions> 
         <execution> 
          <id>prepare-ut-agent</id> 
          <phase>process-test-classes</phase> 
          <goals> 
           <goal>prepare-agent</goal> 
          </goals> 
          <configuration> 
           <destFile>${sonar.jacoco.reportPath}</destFile> 
           <propertyName>jacoco.agent.ut.arg</propertyName> 
           <append>true</append> 
          </configuration> 
         </execution> 
        </executions> 
       </plugin> 
      </plugins> 
     </build> 
     <dependencies> 
      <dependency> 
       <groupId>org.sonarsource.java</groupId> 
       <artifactId>sonar-jacoco-listeners</artifactId> 
       <version>${sonar-jacoco-listeners.version}</version> 
       <scope>test</scope> 
      </dependency> 
     </dependencies> 
     <activation> 
      <activeByDefault>true</activeByDefault> 
     </activation> 
    </profile> 
</profiles> 

プロジェクトはチームシティーで構築され、結果は対策にカバレッジ結果をSonarQube渡された場合、問題がある - >カバレッジ対策 - >ツリーのようにしています画像、例えばすべてのモジュール名は同じです:プロジェクト名+分岐名。しかし、私は彼らにモジュール名を持たせたい。

設定に問題がありますか? ありがとう!

さらに、公式githubの最も単純な構成を使用すると、コードカバレッジ分析はまったくありません。

Sonar Tree view

答えて

1

私は、これはコードカバレッジとは何の関係もありませんし、あなたは、単に親pom.xmlでプロパティsonar.projectNameを設定することで、同じ名前を持つようにSonarQube内のすべてのモジュールを強制していると信じています。だから、それを削除するか、それが異なるモジュールの異なる名前を指定していることを確認してください。

+0

そうです、それは聞こえるほど簡単です。親 'pom.xml'から' sonar.projectName'を削除したところ、正しく表示されます。わかりません、実装する方法_異なるモジュールの異なる名前を指定する_ tho。 – Enigo

関連する問題