Maven 我的项目文档
本章节咱们次要学习如何创立 Maven 我的项目文档。
比方咱们在 C:/MVN 目录下,创立了 consumerBanking 我的项目,Maven 应用上面的命令来疾速创立 java 我的项目:
mvn archetype:generate -DgroupId=com.companyname.bank -DartifactId=consumerBanking -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
批改 pom.xml,增加以下配置(如果没有的话):
<project>
...
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.7</version>
</plugin>
</plugins>
</pluginManagement>
</build>
...
</project>
不然运行 mvn site 命令时呈现 java.lang.NoClassDefFoundError: org/apache/maven/doxia/siterenderer/DocumentContent 的问题,这是因为 maven-site-plugin 版本过低,降级到 3.3+ 即可。
关上 consumerBanking 文件夹并执行以下 mvn 命令。C:\MVN\consumerBanking> mvn site
Maven 开始生成文档:
[INFO] Scanning for projects...
[INFO] -------------------------------------------------------------------
[INFO] Building consumerBanking
[INFO]task-segment: [site]
[INFO] -------------------------------------------------------------------
[INFO] [site:site {execution: default-site}]
[INFO] artifact org.apache.maven.skins:maven-default-skin:
checking for updates from central
[INFO] Generating "About" report.
[INFO] Generating "Issue Tracking" report.
[INFO] Generating "Project Team" report.
[INFO] Generating "Dependencies" report.
[INFO] Generating "Continuous Integration" report.
[INFO] Generating "Source Repository" report.
[INFO] Generating "Project License" report.
[INFO] Generating "Mailing Lists" report.
[INFO] Generating "Plugin Management" report.
[INFO] Generating "Project Summary" report.
[INFO] -------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] -------------------------------------------------------------------
[INFO] Total time: 16 seconds
[INFO] Finished at: Wed Jul 11 18:11:18 IST 2012
[INFO] Final Memory: 23M/148M
[INFO] -------------------------------------------------------------------
关上 C:\MVN\consumerBanking\target\site 文件夹。点击 index.html 就能够看到文档了。
Maven 应用一个名为 Doxia 的文档解决引擎来创立文档,它能将多种格局的源码读取成一种通用的文档模型。要为你的我的项目撰写文档,你能够将内容写成上面几种罕用的,可被 Doxia 转化的格局。