带有 javadocs 的 Maven 多模块项目站点
我想使用 Maven 为我的应用程序创建站点。这是一个多模块应用程序,父模块是简单的站点模块,第一个子模块是应用程序的核心,第二个是GUI(Swing)。
我现在使用 follow 作为父 pom.xml
<modules>
<module>core</module>
<module>kayako-desktop</module>
</modules>
<build>
<plugins>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>2.2</version>
<configuration>
<locales>en</locales>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<aggregate>true</aggregate>
</configuration>
</plugin>
<plugin>
<artifactId>maven-changes-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</reporting>
我的核心 pom:
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<phase>package</phase>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<links>
<link>http://download.oracle.com/javase/6/docs/api/</link>
</links>
</configuration>
</plugin>
</plugins>
</reporting>
(我从两者中删除了不相关的部分)
问题:我尝试了 mvn site:stage,但 javadoc 不是从核心模块收集的。我有什么错吗?
I would like use Maven for creating site for my application. This is a multi-module app, the parent module is simple site module, and first child is a core of app, the second is a GUI (Swing).
I now use follow for parent pom.xml
<modules>
<module>core</module>
<module>kayako-desktop</module>
</modules>
<build>
<plugins>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>2.2</version>
<configuration>
<locales>en</locales>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<aggregate>true</aggregate>
</configuration>
</plugin>
<plugin>
<artifactId>maven-changes-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</reporting>
My core's pom:
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<phase>package</phase>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<links>
<link>http://download.oracle.com/javase/6/docs/api/</link>
</links>
</configuration>
</plugin>
</plugins>
</reporting>
(I stripped out unrelated parts from both)
The problem: I tried mvn site:stage, but javadoc is not collected from core module. What do I wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在父 pom.xml 中 maven-site-plugin 配置的
部分中配置 javadoc 插件。这对我有用。
在父 pom 中:
在每个子 pom 中,您还可以为站点插件配置特定的报告,例如,surefire 测试报告或项目信息。但是,您不需要在那里放置任何 javadoc 插件配置(除非您还希望为子模块提供非聚合的 javadoc)。
然后,您应该能够从父目录执行
mvn site site:stage
。要查看聚合的 javadoc,请将浏览器指向该目录中的target/staging/index.html
,然后单击“Project Reports”,然后单击左侧索引中的“JavaDocs”。页。附加提示:
有时我想快速查看聚合的 javadoc,而不必执行整个
site site:stage
,这会执行更多操作并花费更长的时间。因此,我还将 maven-javadoc-plugin 的配置直接包含在父 pom.xml 的
部分中。这样,我就可以运行mvn javadoc:aggregate
并快速获取target/site/apidocs/index.html
中聚合的 javadocs。Configure the javadoc plugin in the
<reportPlugins>
section of the configuration for the maven-site-plugin, in the parent pom.Here's what worked for me.
In the parent pom:
In each of the child poms, you can also configure specific reports for the site plugin, for example, surefire test reports or project info. However, you shouldn't need to place any javadoc plugin configurations there (unless you also want non-aggregated javadocs for your child modules).
You should then be able to do
mvn site site:stage
from the parent directory. To view your aggregated javadocs, point your browser totarget/staging/index.html
in that directory, and click "Project Reports" and then "JavaDocs" in the index on the left-hand side of the page.Additional tip:
Sometimes I want to look quickly at the aggregated javadocs without having to do an entire
site site:stage
, which does more stuff and takes longer. So I also include a configuration for the maven-javadoc-plugin directly in the<plugin>
section of the parent pom. That way, I can runmvn javadoc:aggregate
and quickly get the aggregated javadocs intarget/site/apidocs/index.html
.