Maven的pom.xml文件结构之Build配置reporting

来源:互联网 发布:c语言 运算符 编辑:程序博客网 时间:2024/05/16 17:47

在Maven的pom.xml文件中,Build相关配置包含两个部分,一个是<build>,另一个是<reporting>,前文中我们已经介绍了<build>,这里我们介绍<reporting>。

<reporting>中的配置作用于Maven的site阶段,用于生成报表。<reporting>中也可以配置插件<plugins>,并通过一个<plugin>的<reportSet>为该插件配置参数。注意,对于同时出现在<build>和<reporting>中的插件,<reporting>中对该插件的配置也能够在构建过程中生效,即该插件的配置是<build>和<reporting>中的配置的合并。示例如下:

  <reporting>    <excludeDefaults></excludeDefaults>    <outputDirectory>${basedir}/target/site</outputDirectory>    <plugins>      <plugin>        <artifactId>maven-project-info-reports-plugin</artifactId>        <version>2.0.1</version>        <reportSets>          <reportSet>            <id>sunlink</id>            <reports>              <report>javadoc</report>            </reports>            <inherited>true</inherited>            <configuration>              <links>                <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>              </links>            </configuration>          </reportSet>        </reportSets>      </plugin>    </plugins>  </reporting>

说明:

  • execludeDefaults,执行maven site时,是否生成报表,默认false
  • outputDirectory,报表的生成目录,默认为${basedir}/target/site
  • pulgin,报表中特别用到的插件
    • artifactId
    • version
    • reportSets,对于该插件的某个goal的执行参数
      • id
      • reports
      • inherited
      • configuration

1 0
原创粉丝点击