0

我正在使用带有 Checkstyle 2.13 插件的 Maven 3.2.3。我有一个多模块项目,并且在父 pom 中有这个配置……</p>

    <reporting>
            <plugins>
                    <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-checkstyle-plugin</artifactId>
                            <version>2.13</version>
                            <reportSets>
                                    <reportSet>
                                            <reports>
                                                    <report>checkstyle</report>
                                            </reports>
                                    </reportSet>
                            </reportSets>
                    </plugin>
                    <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-jxr-plugin</artifactId>
                            <version>2.3</version>
                    </plugin>
            </plugins>
    </reporting>

当我运行“mvn site”时,构建成功,没有错误或警告。在 target/site/index.html 生成报告文件,但是当我在浏览器中访问该页面时,我看不到检查样式报告。更糟糕的是,当我单击“项目模块”部分下的每个模块的链接时,我得到 404。每个链接都将指向 target/site/module-N/index.html,但是不会生成这样的文件。

编辑:根据评论中的建议,我添加了这个

    <distributionManagement>
            ...
            <site>
                    <id>sourceforge-snapshot-site</id>
                    <name>Snapshot Site</name>
                    <url>scp://shell.sourceforge.net/home/project-web/checkstyle/htdocs/snapshot</url>
            </site>
    </distributionManagement>

这只是一个满足建议的虚拟条目,但即使将其放入,site:stage 也无法纠正损坏的链接。

4

2 回答 2

1

Maven 站点插件有一个常见问题解答条目“为什么当我运行“mvn 站点”时父模块和子模块之间的链接不起作用?它说

在多项目构建中,“mvn 站点”将为您做的就是为父级及其所有模块单独运行“mvn 站点”。父子之间的链接在这里不起作用。但是,当您部署站点时,它们将起作用。如果您想对此进行测试,在部署之前,您可以按照使用文档中的说明运行site:stage目标 。

所以听起来你看到的行为是预期的。

于 2015-01-14T21:39:36.283 回答
0

添加这个

                    <distributionManagement>
                            <site>
                                    <id>localhost</id>
                                    <url>file:///${project.build.directory}/reports</url>
                            </site>
                    </distributionManagement>

然后运行“mvn site:site site:deploy”允许我生成一个包含所有链接的本地报告。打败你马文!

于 2015-01-22T22:23:23.553 回答