javadoc-plugin

2022-06-05

java

掉头一去是风吹黑发,回首再来已雪满白头。——余光中

我们可以使用maven-javadoc-plugin生成javadoc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!-- Javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

但如果我们有自定义标签或者新版标签,我们需要配置一个additionalOptions-Xdoclint:none

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!-- Javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<additionalOptions>-Xdoclint:none</additionalOptions>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

否则会因为MavenReportException: Error while generating Javadoc而中断生成