运行Maven site时无法生成plugin-info.html文件的问题求助
自定义Maven插件无法生成plugin-info.html问题
我开发了一个包含多个Goals/Mojos的自定义Maven插件,按照《Maven插件文档指南》要求,结合maven-plugin-plugin与maven-site-plugin生成包含Goals信息的plugin-info.html文件,但运行mvn clean site或mvn site:site后,仅生成target/site目录及其他文件,没有plugin-info.html,也未展示任何Goals/Mojos相关信息。
已完成的配置
1. reporting段配置maven-plugin-plugin
<reporting> <plugins> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-plugin-plugin</artifactId> <version>3.9.0</version> </plugin> </plugins> </reporting>
2. 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>
3. Mojo代码示例(配置确认正确)
/** * 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 { }
4. 已验证的中间产物
运行mvn process-classes时,能正确生成包含Goals信息的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>
疑问
plugin-help.xml已正确生成,但maven-site-plugin未据此生成plugin-info.html,请问是否遗漏了命令或配置?还需提供哪些相关信息?
内容的提问来源于stack exchange,提问作者Mike Solomon
相关产品推荐
相关产品推荐

