[ https://issues.apache.org/jira/browse/MPLUGIN-408?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17566980#comment-17566980 ]
Herve Boutemy edited comment on MPLUGIN-408 at 7/14/22 8:39 PM: ---------------------------------------------------------------- IMHO, what could be removed is the javadoc annotations discovery, that in the past could find the java package early: nowadays, it's a known fact that java package name won't be found found when generating source, then keeping old code that tries to inject java package name early is just adding complexity for nothing and properly document that Helpmojo is first generated and built in default java package, then moved to effective plugin java package was (Author: hboutemy): IMHO, what could be removed is the javadoc annotations discovery, that in the past could find the java package early: nowadays, it's a known fact that java package name won't be found found when generating source, then keeping old code that tries to inject java package name early is just adding complexity for nothing > simplification in helpmojo build > -------------------------------- > > Key: MPLUGIN-408 > URL: https://issues.apache.org/jira/browse/MPLUGIN-408 > Project: Maven Plugin Tools > Issue Type: Wish > Reporter: Slawomir Jaranowski > Priority: Major > > h2. 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 rewrited in generated source code > - using ASM package in class of {{HelpMojo}} is changed > - source code and compiled class are moved to correct directory > h2. 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) -- This message was sent by Atlassian Jira (v8.20.10#820010)