2015-02-08 107 views
0

我可以從配置文件'test'生成Jacoco報告並保存在站點文件夾內。但是當我執行包含網站生成描述的配置文件'documentacion'時,我會在網站中獲得所有報告鏈接,除了鏈接到Jacoco報告,但此報告仍然出現在網站文件夾內。Maven站點未鏈接到Jacoco報告

這是我的POM的一部分(我砍倒這不是重要的組成部分):

<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"> 
    <dependencies> 
     <!-- Tests --> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.12</version> 
      <scope>test</scope> 
     </dependency> 
     <!-- Dependencia para el informe de traducción --> 
     <dependency> 
      <groupId>com.googlecode.l10n-maven-plugin</groupId> 
      <artifactId>l10n-maven-plugin</artifactId> 
      <version>1.8</version> 
     </dependency> 
     .... 
    </dependencies> 
    <!-- Configuración común a todas las fases --> 
    <build> 
     <resources> 
      <resource> 
       <directory>src/main/java</directory> 
       <includes> 
        <include>**/*.fxml</include> 
       </includes>     
       <excludes> 
        <exclude>package-info.java</exclude> 
       </excludes> 
      </resource> 
      <resource> 
       <directory>src/main/resources</directory> 
       <filtering>true</filtering> 
       <includes> 
        <include>**/*.xml</include> 
        <include>**/*.css</include> 
        <include>**/*.png</include> 
        <include>**/*.fxml</include> 
        <include>**/*.ttf</include> 
        <include>*.properties</include> 
        <include>version.prop</include> 
       </includes> 
      </resource> 
     </resources> 
    </build> 
    <!-- Perfiles --> 
    <profiles> 
     ...... 
     <profile> 
      <id>documentacion</id>    
      <activation> 
       <jdk>[1.8,)</jdk> 
      </activation> 
      <build> 
       <defaultGoal>site:site</defaultGoal> 
       <plugins> 
        <!-- Site --> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-site-plugin</artifactId> 
         <version>3.4</version> 
        </plugin> 
        <plugin> 
         <groupId>org.jacoco</groupId> 
         <artifactId>jacoco-maven-plugin</artifactId> 
         <version>0.7.2.201409121644</version> 
        </plugin> 
       </plugins> 
      </build>    
      <reporting> 
       <excludeDefaults>true</excludeDefaults> 
       <outputDirectory>${project.build.directory}/site</outputDirectory> 
       <plugins> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-project-info-reports-plugin</artifactId> 
         <version>2.8</version> 
         <configuration> 
          <dependencyLocationsEnabled>false</dependencyLocationsEnabled> 
         </configuration> 
         <reportSets> 
          <reportSet> 
           <reports> 
            <report>summary</report> 
            <report>index</report> 
            <report>dependencies</report> 
            <report>project-team</report> 
            <report>license</report> 
            <report>scm</report> 
            <report>cim</report> 
            <report>mailing-list</report> 
            <report>issue-tracking</report> 
           </reports> 
          </reportSet> 
         </reportSets> 
        </plugin> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-pmd-plugin</artifactId> 
         <version>3.3</version> 
        </plugin> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-checkstyle-plugin</artifactId> 
         <version>2.13</version> 
         <configuration> 
          <configLocation>config/sun_checks.xml</configLocation> 
         </configuration> 
        </plugin> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-jxr-plugin</artifactId> 
         <version>2.5</version> 
        </plugin> 
        <plugin> 
         <groupId>org.codehaus.mojo</groupId> 
         <artifactId>findbugs-maven-plugin</artifactId> 
         <version>3.0.0</version> 
        </plugin> 
        <plugin> 
         <groupId>org.codehaus.mojo</groupId> 
         <artifactId>l10n-maven-plugin</artifactId> 
         <version>1.0-alpha-2</version> 
         <configuration> 
          <locales> 
           <locale>es</locale> 
          </locales> 
         </configuration> 
        </plugin>   
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-changes-plugin</artifactId> 
         <version>2.11</version> 
         <reportSets> 
          <reportSet> 
           <reports> 
            <report>changes-report</report> 
           </reports> 
          </reportSet> 
         </reportSets> 
        </plugin> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-javadoc-plugin</artifactId> 
         <version>2.10.1</version> 
         <configuration> 
          <useStandardDocletOptions>false</useStandardDocletOptions> 
          <additionalparam>-Xdoclint:none</additionalparam> 
         </configuration> 
        </plugin> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-surefire-report-plugin</artifactId> 
         <version>2.18.1</version> 
        </plugin> 
       </plugins> 
      </reporting> 
     </profile> 
     <profile> 
      <id>test</id>    
      <activation> 
       <jdk>[1.8,)</jdk> 
      </activation> 
      <build> 
       <defaultGoal>validate test</defaultGoal> 
       <plugins> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-surefire-plugin</artifactId> 
         <version>2.18.1</version> 
         <configuration> 
          <testFailureIgnore>true</testFailureIgnore>        
          <additionalClasspathElements> 
           <additionalClasspathElement>${java.home}/lib/jfxrt.jar</additionalClasspathElement> 
          </additionalClasspathElements> 
          <argLine>-Dfile.encoding=UTF-8</argLine> 
          <skipTests>${skip.unit.tests}</skipTests> 
         </configuration> 
        </plugin> 
        <plugin> 
         <groupId>org.jacoco</groupId> 
         <artifactId>jacoco-maven-plugin</artifactId> 
         <version>0.7.2.201409121644</version> 
         <executions> 
          <execution> 
           <id>pre-unit-test</id> 
           <goals> 
            <goal>prepare-agent</goal> 
           </goals> 
           <configuration> 
            <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile> 
            <propertyName>surefireArgLine</propertyName> 
           </configuration> 
          </execution> 
          <execution> 
           <id>post-unit-test</id> 
           <phase>test</phase> 
           <goals> 
            <goal>report</goal> 
           </goals> 
           <configuration> 
            <dataFile>${project.build.directory}/coverage-reports/jacoco.exec</dataFile> 
            <outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory> 
           </configuration> 
          </execution> 
         </executions> 
        </plugin> 
       </plugins> 
      </build>  
     </profile> 
    </profiles> 
</project> 

所以,我怎樣才能得到網站鏈接到Jacoco報告?

回答

0

最後,我可以修復我的POM,這樣我就可以從maven站點獲得Jacoco和Surefire報告的鏈接。

<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> 
    ... 
    <dependencies> 
     <!-- Tests --> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.12</version> 
      <scope>test</scope> 
     </dependency> 
     ... 
    </dependencies> 
    <profiles> 
     <profile> 
      <id>desarrollo</id> 
      <activation> 
       <jdk>[1.8,)</jdk> 
      </activation> 
      <build> 
       <defaultGoal>clean package</defaultGoal> 
       <plugins>  
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-jar-plugin</artifactId> 
         <version>2.5</version> 
         <configuration> 
          <archive> 
           <manifest> 
            <addClasspath>true</addClasspath> 
            <mainClass>com.***.App</mainClass> 
           </manifest> 
          </archive> 
         </configuration> 
        </plugin> 
       </plugins> 
      </build> 
     </profile> 
     <profile> 
      <id>documentacion</id>    
      <activation> 
       <jdk>[1.8,)</jdk> 
      </activation> 
      <build> 
       <defaultGoal>site:site</defaultGoal> 
       <plugins> 
        <!-- Site --> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-site-plugin</artifactId> 
         <version>3.4</version> 
        </plugin> 
        <plugin> 
         <groupId>org.jacoco</groupId> 
         <artifactId>jacoco-maven-plugin</artifactId> 
         <version>0.7.2.201409121644</version> 
        </plugin> 
       </plugins> 
      </build>    
      <reporting> 
       <excludeDefaults>true</excludeDefaults> 
       <outputDirectory>${project.build.directory}/site</outputDirectory> 
       <plugins> 
        <!-- Plugin para generar el site con los reports --> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-project-info-reports-plugin</artifactId> 
         <version>2.8</version> 
         <configuration> 
          <dependencyLocationsEnabled>false</dependencyLocationsEnabled> 
         </configuration> 
         <reportSets> 
          <reportSet> 
           <reports> 
            <report>summary</report> 
            <report>index</report> 
            <report>dependencies</report> 
            <report>project-team</report> 
            <report>license</report> 
            <report>scm</report> 
            <report>cim</report> 
            <report>mailing-list</report> 
            <report>issue-tracking</report> 
           </reports> 
          </reportSet> 
         </reportSets> 
        </plugin> 
        <!-- Reporte tests --> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-surefire-report-plugin</artifactId> 
         <version>2.18.1</version> 
        </plugin> 
        <plugin> 
         <groupId>org.jacoco</groupId> 
         <artifactId>jacoco-maven-plugin</artifactId> 
         <version>0.7.2.201409121644</version> 
        </plugin> 
       <!-- More report plugins place here (PMD, checkstyle...) -->      
       </plugins> 
      </reporting> 
     </profile> 
     <profile> 
      <id>test</id>    
      <activation> 
       <jdk>[1.8,)</jdk> 
      </activation> 
      <build> 
       <defaultGoal>validate test</defaultGoal> 
       <plugins>      
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-surefire-plugin</artifactId> 
         <version>2.18.1</version> 
         <configuration> 
          <outputDirectory>${project.build.directory}/site</outputDirectory> 
          <reportsDirectories> 
           <reportsDirectories>${project.build.directory}/site/surefire-reports</reportsDirectories> 
          </reportsDirectories> 
          <testFailureIgnore>true</testFailureIgnore>        
          <additionalClasspathElements> 
           <additionalClasspathElement>${java.home}/lib/jfxrt.jar</additionalClasspathElement> 
          </additionalClasspathElements> 
          <argLine>${argLine} -Dfile.encoding=UTF-8</argLine> 
         </configuration>   
         <executions> 
          <execution> 
           <id>default-test</id> 
           <phase>test</phase> 
           <goals> 
            <goal>test</goal> 
           </goals> 
          </execution> 
         </executions> 
        </plugin> 
        <!-- Test report --> 
        <plugin> 
         <groupId>org.jacoco</groupId> 
         <artifactId>jacoco-maven-plugin</artifactId> 
         <version>0.7.2.201409121644</version> 
         <executions> 
          <execution> 
           <id>default-prepare-agent</id> 
           <goals> 
            <goal>prepare-agent</goal> 
           </goals> 
          </execution> 
          <execution> 
           <id>default-report</id> 
           <phase>prepare-package</phase> 
           <goals> 
            <goal>report</goal> 
           </goals> 
          </execution> 
          <execution> 
           <id>default-check</id> 
           <goals> 
            <goal>check</goal> 
           </goals> 
          </execution> 
         </executions> 
        </plugin> 
       </plugins> 
      </build>  
     </profile> 
    </profiles> 
</project>