Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Current situation
- plugin:helpmojo extends AbstractGeneratorMojo
- plugin:helpmojo is bound to generate-sources phase
see https://maven.apache.org/plugin-tools/maven-plugin-plugin/helpmojo-mojo.html
We have 2 steps for generate a HelpMojo for a plugin:
1. first step in plugin:helpmojo goal
- helpmojo builds plugin.xml descriptor by discovering mojos in project (hoping to find javadoc annotations as it was done in the past), when we use @Mojo annotations for goals descriptions no mojo are discovered because source generation happens before compilation
- try to discover package for HelpMojo: because descriptor is empty - empty package is used for generating source for HelpMojo
2. next step in plugin:descriptor goal, bound to process-classes phase https://maven.apache.org/plugin-tools/maven-plugin-plugin/descriptor-mojo.html
- once again build plugin descriptors by discovering mojos in project, but this time
- now we can have mojo so we can calculate package name
- empty package name of HelpMojo is rewritten in generated source code
- using ASM, package in class of HelpMojo is changed
- source code and compiled class are moved to correct directory
Simplification proposition
- use groupId.artifactId as java package of HelpMojo directly in plugin:helpmojo when generating source code
- cleanup/simplify code (remove the plugin:descriptor package discovery and move)
Attachments
Issue Links
- relates to
-
MPLUGIN-227 HelpMojo javadoc generated in "unnamed package"
- Closed
-
MPLUGIN-189 add java 5 annotations support to mark Mojo sources
- Closed
-
MPLUGIN-417 report and descriptor goal need to evaluate Javadoc comments differently
- Closed
- links to