我有一个定制的Maven插件,其中有几个Goals/Mojos,我想为其生成文档.根据Maven guide to plugin documentation人的说法,我应该结合使用Maven插件和Maven站点插件来生成一个plugin-info.html
文件,其中包含关于我目标的信息.
不幸的是,我似乎无法生成此文件.我can生成一个站点,它只是不包含关于我的目标/Mojos的信息.
As the guide suggested中,我更新了我的pom.xml
文件,在报告部分中包含了Maven插件:
<reporting>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.9.0</version>
</plugin>
</plugins>
</reporting>
在我的<build>/<plugins>
栏里,我还有这个插件和站点插件:
<build>
...
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.12.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.9.0</version>
<executions>
<execution>
<id>generate-helpmojo</id>
<goals>
<goal>helpmojo</goal>
</goals>
</execution>
</executions>
</plugin>
<plugins>
</build>
When I run mvn clean site
or mvn site:site
, a target/site
directory is generated with various files in it:
我希望在那里看到一个plugin-info.html
的文件,其中包括关于我的目标的信息,比如他们的名字和描述.不幸的是,我在任何地方都没看到那份文件.
我非常确定我已经正确地设定了我的目标/目标.以下是其中之一的一个例子:
/**
* Run the configured recipes and apply the changes locally.
* <p>
* This variant of rewrite:run will fork the maven life cycle and can be run as a "stand-alone" goal. It will
* execute the maven build up to the process-test-classes phase.
*/
@Mojo(name = "run", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true,
defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES)
@Execute(phase = LifecyclePhase.PROCESS_TEST_CLASSES)
public class RewriteRunMojo extends AbstractRewriteRunMojo {
}
当我运行mvn process-classes
时,我正确地得到了一个target/classes/META-INF/maven/.../plugin-help.xml
文件,其中包含有关我的目标的信息:
...
<mojo>
<goal>run</goal>
<description>Run the configured recipes and apply the changes locally.
This variant of rewrite:run will fork the maven life cycle and can be run as a stand-alone goal. It will execute the maven build up to the process-test-classes phase.
</description>
...
</mojo>
然而,Maven站点插件似乎并没有使用这些信息.
我是否缺少一些命令或配置来为我的目标生成文档?我还能提供与这个问题相关的其他信息吗?
耽误您时间,实在对不起!