在Maven中生成Javadocs

Maven comes out with one of the cool features which does the generation of the javadocs for a project. As every developer knows that it is vital to have the code documentation of our project and this feature of maven helps to accomplish the same.

Maven具有一项很酷的功能,可以为项目生成javadocs。 每个开发人员都知道拥有我们项目的代码文档至关重要,而maven的这一功能有助于实现这一目标。

Maven uses the maven-javadoc plugin to generate the javadocs of a project. This plugin internally uses JDK\bin\javadoce.exe command to generate javadocs. When the project is deployed using mvn install command, it generates the javadocs for the project.

Maven使用maven-javadoc插件生成项目的javadocs。 该插件内部使用JDK \ bin \ javadoce.exe命令生成javadocs。 使用mvn install命令部署项目时,它将为项目生成javadocs。

Maven:配置Javadocs插件 (Maven: Configuring Javadocs Plugin)

The javadoc plugin can be configure for any project in pom.xml as shown below:

可以为pom.xml中的任何项目配置javadoc插件,如下所示:

<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-javadoc-plugin</artifactId>
			<executions>
				<execution>
					<id>attach-javadocs</id>
					<goals>
						<goal>jar</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

Maven:生成Javadocs (Maven: Generating Javadocs)

After adding the above mentioned plugin in your project's pom.xml, all you have to do is, open the command prompt, go to the project directory, For eg. D:\Java\workspace\JavaSamples and run the command maven install.

在项目的pom.xml中添加了上述插件之后,您所要做的就是打开命令提示符,转到项目目录,例如。 D:\ Java \ workspace \ JavaSamples并运行命令maven install

Generating Javadocs in Maven
Generating Javadocs in Maven

The generated javadocs can be found in the project's location : D:\Java\workspace\JavaSamples\target\apidocs.

可以在项目的位置找到生成的javadocs: D:\ Java \ workspace \ JavaSamples \ target \ apidocs

翻译自: https://www.studytonight.com/maven/generating-javadocs-in-maven

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值