03 12月 2010

Maven3 and Site Plugin

Maven3 的 maven-site-plugin已將關於reporting的邏輯移除,所以如果用原先給maven2用的pom.xml,雖然可以執行,但除了用Doxia的report可以跑出結果來,其餘的report都不會產生。

要跑出先前的report就必需修改下pom.xml,Maven的report主要有分兩類,一是Project Information、另一則是Project Report,Information就是專案成員名單、使用的library、Issue Tracking等相關資訊,而Report則是其他外掛的Changelog、Unit test Surefire、CodeCoverage Emma等report,maven2的是將其分為兩部份控制,information是內建的,只要敲個mvn site就一定有,其他的report就必需在<reporting />中掛上plugin,而maven3的設定則希望全部在maven-site-plugin中加以控制,這是兩者比較大的分別。

直接看看maven3的設定項目吧,請記得下列所有report的<version />皆可以不指定

<project>
 <build>
  <plugins>
   <plugin>
    <groupid>org.apache.maven.plugins</groupid>
    <artifactid>maven-site-plugin</artifactid>
    <version>3.0-beta-3</version>
    <configuration>
     <reportplugins>
      <!-- maven-project-info-reports-plugin即是指供project information的plugin -->
      <plugin>
       <groupid>org.apache.maven.plugins</groupid>
       <artifactid>maven-project-info-reports-plugin</artifactid>
       <!-- 可不指定version -->
       <version>2.2</version>
       <!-- dependencyDetailsEnabled 及 dependencyLocationsEnabled 設為false
       時會讓 dependencies report 少產生部份資訊-->
       <configuration>
        <dependencydetailsenabled>true</dependencydetailsenabled>
        <dependencylocationsenabled>true</dependencylocationsenabled>
       </configuration>
       <!-- 基本的information report都在下面了,若有不需要看的就mark掉就好 -->
       <reports>
        <report>cim</report>
        <report>dependencies</report>
        <report>index</report>
        <report>issue-tracking</report>
        <report>license</report>
        <report>mailing-list</report>
        <report>plugin-management</report>
        <report>plugins</report>
        <report>project-team</report>
        <report>scm</report>
        <report>summary</report>
       </reports>
      </plugin>
      
      <!-- 以下為其他外掛的report plugin 設定處,version可以拿掉 -->
      <plugin>
       <groupid>org.apache.maven.plugins</groupid>
       <artifactid>maven-surefire-report-plugin</artifactid>
       <version>2.6</version>
      </plugin>
      <plugin>
       <groupid>org.apache.maven.plugins</groupid>
       <artifactid>maven-changelog-plugin</artifactid>
       <version>2.2</version>
      </plugin>
     </reportplugins>
    </configuration>
   </plugin>
  </plugins>
 </build>
</project>
</project>


2 則留言:

匿名 提到...

I like it when folks get together and share views.
Great site, continue the good work!

my web blog - Pennsylvania childcare provider

匿名 提到...

Hello! Quick question that's entirely off topic. Do you know how to make
your site mobile friendly? My website looks weird when browsing from my iphone 4.
I'm trying to find a template or plugin that might be able to fix this issue.
If you have any suggestions, please share. Appreciate it!


my web site ... Free Diet Plans