4

我正在为一个结构如下的 3 级多模块 Maven 项目创建一个 Maven 站点:

parent 
    child-a
        child-b

我在跑步mvn site site:stage

Maven 站点模块链接适用于 child-a,但对于嵌套模块 child-b 无效。(如果我首先单击指向 child-a 的链接,则指向 child-b 的链接确实有效。)

在这里自己看看:http: //justinhrobbins.github.io/multi-module-site-report-test/site/0.0.1-SNAPSHOT/

我的父母 pom 中有以下内容:

<distributionManagement>
    <site>
        <id>site</id>
        <name>site</name>
        <url>scp://www.yourcompany.com/www/docs/project/</url>
    </site>
</distributionManagement>

为了使链接适用于此 Maven 站点报告中的所有项目模块,需要做什么?(我知道这<url>不是真的,目前我希望它在舞台上工作)

我向 Github 添加了一个简单的测试用例项目来演示该问题: https ://github.com/justinhrobbins/multi-module-site-report-test

编辑:我正在使用以下插件版本:

<maven.site.plugin.version>3.3</maven.site.plugin.version>   
<maven.project.info.reports.plugin.version>2.7</maven.project.info.reports.plugin.version>
4

1 回答 1

17

我可以通过向<url>父 pom 添加一个元素来解决这个问题。我不明白为什么那会解决它。

在添加<url>元素之前,我在运行后的日志中看到了这个mvn site site:stage

[WARNING] No project URL defined - decoration links will not be relativized!

添加元素并重新运行 Maven 命令后,日志现在显示如下:

[INFO] Relativizing decoration links with respect to project URL:

Maven 站点报告中的模块链接现在可以正常工作。

示例 github 项目的 master 分支已更新解决方案

https://github.com/justinhrobbins/multi-module-site-report-test

<url>可以在此处找到 有关该元素用途的更多信息: https ://maven.apache.org/plugins/maven-site-plugin/faq.html#Use_of_url

于 2014-02-23T18:47:27.950 回答