我正在为一个结构如下的 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/
我的 parent 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>
最佳答案
我可以通过添加 <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
关于maven - 如何修复多模块项目的 Maven 站点中损坏的子模块链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21923452/