2014-02-21 48 views
1

我創建一個Maven站點爲3級多模塊Maven項目,該項目的結構是這樣的:如何修復Maven Site中多模塊項目中的子模塊鏈接錯誤?

parent 
    child-a 
     child-b 

我正在mvn site site:stage

Maven站點模塊鏈接的作品爲兒童一但對於嵌套的模塊child-b而言被破壞。 (兒童-B的鏈接不工作,如果我第一次點擊的鏈接孩子-A。)

這裏見自己: 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> 

回答

8

我能夠通過向父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項目的主分支已經更新上<url>元素的目的,解決

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

更多信息可以在這裏找到: https://maven.apache.org/plugins/maven-site-plugin/faq.html#Use_of_url