自定义文本报告

目前,所有报告都有一个静态渲染器,只能更改文本。

<project>
  ...
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>3.2.2</version>
        <configuration>
          <!-- By default -->
          <customBundle>${project.basedir}/src/site/custom/project-info-reports.properties</customBundle>
        </configuration>
      </plugin>
      ...
    </plugins>
  </reporting>
  ...
</project>

要更改报告中的文本,您应该从http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-project-info-reports-plugin/src/main导入默认的 Project Info 报告包/resources/并编辑它们。例如,如果要修改邮件列表介绍,则应编辑report.mailing-lists.intro属性。

默认捆绑包project-info-reports.properties的提取:

report.mailing-lists.intro = These are the mailing lists that have been established for this project. For each list, there is a subscribe, unsubscribe, and an archive link.

Apache Commons 项目的自定义包${project.basedir}/src/site/custom/project-info-reports.properties的提取:

report.mailing-lists.intro = These are the mailing lists that have been established for this project. For each list, there is a subscribe, unsubscribe, and an archive link.\
        <p>\
            Questions related to the usage of Commons components should be posted to the\
            <a href="http://mail-archives.apache.org/mod_mbox/commons-user/" class="externalLink">User List</a>.\
            <br>\
            The <a href="http://mail-archives.apache.org/mod_mbox/commons-dev/" class="externalLink">Developer List</a>\
            is for questions and discussion related to the development of Commons components.\
            <br>\
            Please do not cross-post; developers are also subscribed to the user list.\
            Read the archives first in case your question has already been answered.\
            If not, then subscribe to the appropriate list and post your question.\
        </p>\
        <p>
            <strong>Note:</strong> please don't send patches or attachments to any of the mailing lists.\
            Patches are best handled via the <i>Issue Tracking</i> system.\
            Otherwise, please upload the file to a public server and include the URL in the mail.\
        </p>\
        <p>\
            Please read the <a href="http://www.apache.org/foundation/public-archives.html" class="externalLink">Public Forum Archive Policy</a>\
            and <a href="http://www.apache.org/dev/contrib-email-tips.html" class="externalLink">Tips for email contributors</a>.\
            <br>\
            For further information on Apache mailing lists please read\
            <a href="http://www.apache.org/foundation/mailinglists.html" class="externalLink">General mailing list information</a>\
            in particular the section entitled\
            <a href="http://www.apache.org/foundation/mailinglists.html#subscribe" class="externalLink">Subscribing and Unsubscribing</a>\
        </p>

笔记:

  1. 您还可以在消息中使用 Maven 属性(即${project.artifactId})。
  2. 如果您的自定义包中未定义包属性,则将显示默认值。