Question

I am creating a Maven Site for a 3-level multi-module maven project which is structured like this:

parent 
    child-a
        child-b

I am running mvn site site:stage

The Maven site module link works for child-a but is broken for the nested module child-b. (The link to child-b does work if I first click the link to child-a.)

See for yourself here: http://justinhrobbins.github.io/multi-module-site-report-test/site/0.0.1-SNAPSHOT/

I have the following in my parent pom:

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

What needs to be done in order for the links to work for all the project modules in this Maven site report? (i know the <url> is not real, for the moment i want it to work in stage)

I added a simple test case project to Github that demonstrates the issue: https://github.com/justinhrobbins/multi-module-site-report-test

EDIT: I am using the following plugin versions:

<maven.site.plugin.version>3.3</maven.site.plugin.version>   
<maven.project.info.reports.plugin.version>2.7</maven.project.info.reports.plugin.version>
Was it helpful?

Solution

I was able to fix this issue by adding a <url> element to the parent pom. I don't understand why that would fix it though.

Prior to adding the <url> element I saw this in the log after running mvn site site:stage

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

After adding the element and rerunning the Maven command, the log now shows this:

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

The module links in the Maven site report are now working.

The master branch of the sample github project has been updated with the solution

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

More info on the purpose of the <url> element can be found here: https://maven.apache.org/plugins/maven-site-plugin/faq.html#Use_of_url

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top