不确定这是否相关,但是您的命令正在运行该站点两次, mvn site 将生成该站点,并且 site:stage 也将运行该站点,也许这会引起问题,但老实说我不明白为什么。
查看JXR 文档,它只提到了 site:site 目标,我不明白为什么它不能为 site:stage 目标正确运行,因为它扩展了它。如果您运行site目标,然后将输出复制到另一个目录,运行site:stage目标并比较输出,它可能会对问题有所了解。
更新:我自己尝试过,外部参照被包含并很好地聚合在 c:\test\stage 中,并正确管理了交叉引用。我已经包含了我使用的配置。
在我的父 pom 中,我定义了这样的站点配置:
<build>
<plugins>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>stage</goal>
</goals>
</execution>
</executions>
<configuration>
<stagingDirectory>c:\test\stage</stagingDirectory>
</configuration>
</plugin>
</plugins>
</build>
distributionManagement 部分配置了站点信息(因为我在上面设置了 stagingDirectory 并不真正需要,但没有它目标将无法运行)。
<distributionManagement>
<site>
<id>mojo.website</id>
<name>Mojo Website</name>
<url>scp://test/</url>
</site>
</distributionManagement>
我在父 pom 中的 JXR 配置如下:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<reportSets>
<reportSet>
<id>src-xref</id>
<reports>
<report>jxr</report>
</reports>
</reportSet>
<reportSet>
<id>test-xref</id>
<reports>
<report>test-jxr</report>
</reports>
</reportSet>
</reportSets>
<configuration>
<aggregate>true</aggregate>
</configuration>
</plugin>
命令行运行是mvn clean site:stage
编辑:根据评论,有一个语义略有不同的codehaus jxr 插件。请务必使用 org.apache.maven.plugins 版本而不是 org.codehaus.mojo 版本。