我有一个定制的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: target/site directory

我希望在那里看到一个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站点插件似乎并没有使用这些信息.

我是否缺少一些命令或配置来为我的目标生成文档?我还能提供与这个问题相关的其他信息吗?

耽误您时间,实在对不起!

推荐答案

提到的文档是过时的-应该更新(感谢您的意见).

Reporting was removed from maven-plugin-plugin in version 3.9.0 - MPLUGIN-467
now is dedicated reporting plugin - maven-plugin-report-plugin.

因此,请使用:

<reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-report-plugin</artifactId>
        <version>3.9.0</version>
      </plugin>
    </plugins>
  </reporting>

参考资料:

Java相关问答推荐

@GetMapping和@GetExchange有什么区别?

Analyst Idea构建错误:NoClassDefFound错误:javax/html/bind/JAVAX Bwitch [SOLVED]

虚拟线程似乎在外部服务调用时阻止运营商线程

如何审查Java dtos中的自定义注释字段?

inteliJ中是否有一个功能可以自动在块注释中的/*后面添加一个空格?''

Java中后期绑定的替代概念

ApachePOI:不带换行的新行

无法处理批处理侦听器中的反序列化异常

如何解释Java中for-each循环中对Iterable的强制转换方法引用?

如何从日志(log)行中删除包名称?

在学习Spring时,通过构造函数参数0表达了不满意的依赖关系

使用Class.this.field=Value初始化构造函数中的最后一个字段会产生错误,而使用this.field=Value则不会

Java页面筛选器问题

如果第一位数字和最后一位数字相差超过一位,您将如何获得随机数?

在实例化中指定泛型类型与不指定泛型类型之间的区别

在单例类上获取Java锁,了解原因

如何在特定关键字后提取与模式匹配的多个值?

";home/runner/work/中没有文件...匹配到[**/pom.xml];Maven项目的构建过程中出现错误

ReturnedRect在升级后反转

使用原子整数的共享计数器并发增量