I'm currently working with maven-site-plugin using Maven 3.
The plugin is generating all the report as expected but due to my project layout (shown below), the main site shown does not show the reports. Can anyone advise how we can have the content shared or add links to show how links can be put in site.xml to show the content. Thanks
The site\site.xml file looks like this.
<project name="MyProject">
<body>`enter code here`
<links>
<item name="My Site" href="http://hp.com" />
</links>
<menu name="Projects" inherit="top">
<item name="Description and Usage" href="index.html"/>
<item name="Goals" href="plugin-info.html"/>
<item name="Usage" href="usage.html"/>
<item name="FAQ" href="faq.html"/>
</menu>
<menu ref="reports"/>
</body>
</project>
Running the site is not a problem, the site appears but none of the links are working and the reports are not visible. I assume this is because my project setup is not standard. I have the following setup
PARENT_PROJECT
-pom.xml (this is where maven-site-plugin is defined and used)
-src
site
site.xml
-target (all reports are here inc a index.html)
---x EAR Project
pom.xml
target (all reports are here inc a index.html)
---x WEBAPP Project
pom.xml
target (all reports are here inc a index.html)
---x JAR Project
pom.xml
target (all reports are here inc a index.html)
For some unknown reason, when I run site:run and enter "localhost:8080", the index.html from the EAR\target\index.html is appearing and not the PARENT_PROJECT\target\index.html file?
Note that mvn:site is run from the PARENT_PROJECT
Cha开发者_StackOverflow中文版nged the POM to include
<site>
<id>nexus</id>
<name>site</name>
<url>http://localhost:8080</url>
</site>
As its a multi project, running site:stage now as suggested here http://maven.apache.org/plugins/maven-site-plugin/faq.html but noticed that I cannot run the project as maven states that "What "mvn site" will do for you, in a multi-project build, is to run "mvn site" for the parent and all its modules individually. The links between parent and child will not work here. They will however work when you deploy the site."
You should consider using the site:stage goal of the maven-site-plugin, as well. From that link:
[site:stage] can be used to test that links between module sites in a multi module build works.
I am not sure if this issue is related to the issue project-reports.html vs index.html when generated link is wrong, you cannot access child modules. Check out the generated files (index or project-reports) and access that file by fixing the URL.
Encountered the same issues today and I resolved it by updating my maven to 3.0.4. Was using Maven 3.0.3 and the links were broken in that version.
I am not sure if this is your specific issue, but I experienced that Maven site does not update the index.html if the site descriptor has changed.
So it leaves index.html untouched, unless you specify mvn clean
.
So try
mvn clean site:site site:deploy
精彩评论