如何在多模块项目的Maven站点中修复损坏的子模块链接?

时间:2014-02-21 01:34:45

标签: maven maven-site-plugin

我正在为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>

1 个答案:

答案 0 :(得分:11)

我能够通过向父pom添加<url>元素来解决此问题。 我不明白为什么会解决它。

在添加<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项目的主分支已使用解决方案

进行了更新

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

有关<url>元素用途的更多信息,请访问: https://maven.apache.org/plugins/maven-site-plugin/faq.html#Use_of_url

相关问题