2017-03-09 148 views
1

我已經配置我的pom文件用於生成pmd報告使用在我的POM文件中的插件。爲什麼maven pmd插件生成pmd.html

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-pmd-plugin</artifactId> 
    <version>3.0.1</version> 
    <executions> 
     <execution> 
      <id>pmd</id> 
      <phase>compile</phase> 
      <goals> 
       <goal>check</goal> 
      </goals> 
      <configuration> 
       <format>xml</format> 
      </configuration> 
     </execution> 
    </executions> 
</plugin> 

在這裏,我能夠在我的項目的目標文件夾中創建報告pmd.xml使用:

mvn clean compile" command 

但其打造「網站」文件夾,也根據該目標文件夾和pmd.html文件還對網站內部創建夾。

why.How to configue so that site folder does not get create。

回答

0

你應該看看那裏如何使用這個插件刪除報告:https://maven.apache.org/plugins/maven-pmd-plugin/examples/removeReport.html

目標/網站是,如果你確認PMD,因爲創建:檢查goal documentation,它說:

在執行本身之前調用此插件目標pmd的執行。

然後檢查PMD:pmd的goal documentation,你看到的輸出目錄:

爲最終的HTML報告輸出目錄。請注意,只有在直接從命令行運行目標或在默認生命週期期間運行目標時,纔會評估此參數。如果目標作爲網站生成的一部分間接運行,則將使用在Maven Site Plugin中配置的輸出目錄。 用戶屬性是:project.reporting.outputDirectory。

而且${project.reporting.outputDirectory}是defeault 目標/網站

編輯:而且不能生成HTML項目,據我所知,但你可以改變目錄中的HTML報告例如:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-pmd-plugin</artifactId> 
    <version>3.0.1</version> 
    <executions> 
    <execution> 
     <id>pmd</id> 
     <phase>compile</phase> 
     <goals> 
      <goal>check</goal> 
     </goals> 
     <configuration> 
     <outputDirectory>${project.build.directory}/myHtmlPmdDirectory</outputDirectory> 
      <format>xml</format> 
     </configuration> 
    </execution> 
    </executions> 
<plugin> 
+0

我不想生成站點文件夾。我只需要pmd xml文件。 –

+0

查看我的編輯修改你的POM,以避免在網站文件夾中有HTML報告 – Adonis

+0

感謝您的回覆,我使用了您的插件配置但仍然在myHtmlPmdDirectory和pmd.xml文件的myHtmlPmdDirectory和pmd.xml下創建pmd.html文件。所以我編輯了這樣的 $ {project.build.directory}/ xml 現在pmd.html和pmd.xml都被創建爲更加新的項目目標文件夾。實際上我只想要pmd.xml而不是pmd.html。 –

相關問題