Maven 简明教程

Maven - Project Documents

本教程将教您如何一次性创建应用程序文档。因此,让我们开始,转到 C:/MVN 目录,您已使用前面的章节中给出的示例创建了您的 Java consumerBanking 应用程序。打开 consumerBanking 文件夹并执行以下 mvn 命令。

如下所示,更新 C:\MVN\consumerBanking 文件夹中的 pom.xml。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.companyname.bank</groupId>
   <artifactId>consumerBanking</artifactId>
   <packaging>jar</packaging>
   <version>1.0-SNAPSHOT</version>
   <name>consumerBanking</name>
   <url>http://maven.apache.org</url>
   <properties>
      <maven.compiler.source>11</maven.compiler.source>
      <maven.compiler.target>11</maven.compiler.target>
   </properties>
   <build>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.7</version>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>2.9</version>
         </plugin>
      </plugins>
   </build>
   <dependencies>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>3.8.1</version>
         <scope>test</scope>
      </dependency>
   </dependencies>
</project>
C:\MVN\consumerBanking>mvn site

Maven 将开始构建该项目。

[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.companyname.bank:consumerBanking >----------------
[INFO] Building consumerBanking 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-site-plugin:3.7:site (default-site) @ consumerBanking ---
[WARNING] Input file encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Relativizing decoration links with respect to localized project URL: http://maven.apache.org
[INFO] Rendering site with org.apache.maven.skins:maven-default-skin:jar:1.2 skin.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.850 s
[INFO] Finished at: 2021-12-13T17:49:56+05:30
[INFO] ------------------------------------------------------------------------

您的项目文档现已就绪。Maven 已在目标目录中创建了一个网站。

site project structure

打开 C:\MVN\consumerBanking\target\site 文件夹。点击 index.html 可查看文档。

consumer web page

Maven 使用一个名为 Doxia 的文档处理引擎创建文档,该引擎可将多个源格式导入到公共文档模型中。要为您的项目编写文档,您可以在 Doxia 解析的以下几种常用格式中撰写您的内容。

Format Name

Description

Reference

XDoc

Maven 1.x 文档格式

https://jakarta.apache.org/site

FML

Used for FAQ documents

https://maven.apache.org