Maven 项目 + maven-site-plugin 不工作
我目前正在使用 Maven 3 使用 maven-site-plugin。
该插件正在按预期生成所有报告,但由于我的项目布局(如下所示),显示的主站点未显示报告。任何人都可以建议我们如何共享内容或添加链接以显示如何将链接放入 site.xml 中以显示内容。谢谢
site\site.xml 文件看起来像这样。
<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>
运行该网站不是问题,该网站会显示,但所有链接都不起作用,并且报告不可见。我认为这是因为我的项目设置不标准。我有以下设置
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)
由于某些未知原因,当我运行 site:run 并输入“localhost:8080”时,出现 EAR\target\index.html 中的 index.html,而不是 PARENT_PROJECT\target\index.html 文件?
请注意,mvn:site 是从 PARENT_PROJECT 运行的
更改了 POM 以包含
<site>
<id>nexus</id>
<name>site</name>
<url>http://localhost:8080</url>
</site>
作为一个多项目,现在按照此处的建议运行 site:stage http://maven.apache.org/plugins/maven-site-plugin/faq.html 但注意到我无法运行该项目,因为 maven 指出“在多项目构建中,“mvn site”将为您做的就是分别为父级及其所有模块运行“mvn site”。父级和子级之间的链接在这里不起作用。但是,它们在以下情况下起作用:您部署该站点。”
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
Changed 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."
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您应该考虑使用 site:stage 的目标maven-site-plugin 也是如此。从该链接:
You should consider using the site:stage goal of the maven-site-plugin, as well. From that link:
我不确定这个问题是否与问题相关 project-reports.html vs index.html 当生成的链接错误时,无法访问子模块。查看生成的文件(索引或项目报告)并通过修复 URL 访问该文件。
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.
今天遇到了同样的问题,我通过将我的 Maven 更新到 3.0.4 来解决它。使用的是 Maven 3.0.3,该版本中的链接已损坏。
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.
我不确定这是否是您的具体问题,但我发现如果站点描述符已更改,Maven 站点不会更新 index.html。
因此,除非您指定
mvn clean
,否则它不会影响index.html。所以尝试一下
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