[ 
https://issues.apache.org/jira/browse/MPLUGIN-504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17852526#comment-17852526
 ] 

Tamas Cservenak edited comment on MPLUGIN-504 at 6/5/24 6:23 PM:
-----------------------------------------------------------------

Right, so the story short: Maven Core plugins (those maintained by Apache Maven 
project) have {{artifactId}} in form of {{{}maven-$prefix-plugin{}}}. Here, the 
heuristics from the {{maven-plugin-plugin}} (that ironically have prefix 
{{{}plugin{}}}) "lifts" the {{$prefix}} part and makes it goalPrefix.

Convention for "non core plugins" (for example 
[mojohaus|https://github.com/mojohaus/] plugins, but every other as well) is in 
turn use the {{$prefix-maven-plugin}} form for artifactId, and similarly, the 
heuristics from the maven-plugin-plugin "lifts" the prefix part and makes it 
goalPrefix.

Problem is when this "heuristics" (that is quite simplistic) fails, and no 
goalPrefix gets found. In that case use config as:
{noformat}
 <plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-plugin-plugin</artifactId>
  <version>3.13.1</version>
  <configuration>
    <goalPrefix>myprefix</goalPrefix>
  </configuration>
</plugin>{noformat}
The rationale behind requiring plugin prefix was change explained in MNG-7618 
(allows copy-pasting/reusing Maven log output), as anyway majority of plugins 
(that followed artifactId naming convention) had prefix already. Moreover, 
prefix is used in G level metadata for plugin discovery as well (explained in 
[https://maven.apache.org/settings.html#plugin-groups]) that without prefix 
present is not possible.


was (Author: cstamas):
Right, so the story short: Maven Core plugins (those maintained by Apache Maven 
project) have {{artifactId}} in form of {{{}maven-$prefix-plugin{}}}. Here, the 
heuristics from the {{maven-plugin-plugin}} (that ironically have prefix 
{{{}plugin{}}}) "lifts" the {{$prefix}} part and makes it goalPrefix.

Convention for "non core plugins" (for example 
[mojohaus|https://github.com/mojohaus/] plugins, but every other as well) is in 
turn use the {{$prefix-maven-plugin}} form, and similarly, the heuristics from 
the maven-plugin-plugin "lifts" the prefix part and makes it goalPrefix.

Problem is when this "heuristics" (that is quite simplistic) fails, and no 
goalPrefix gets found. In that case use config as:
{noformat}
 <plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-plugin-plugin</artifactId>
  <version>3.13.1</version>
  <configuration>
    <goalPrefix>myprefix</goalPrefix>
  </configuration>
</plugin>{noformat}
The rationale behind requiring plugin prefix was change explained in MNG-7618 
(allows copy-pasting/reusing Maven log output), as anyway majority of plugins 
(that followed artifactId naming convention) had prefix already. Moreover, 
prefix is used in G level metadata for plugin discovery as well (explained in 
[https://maven.apache.org/settings.html#plugin-groups]) that without prefix 
present is not possible.

> [regression] Goal prefix is required now
> ----------------------------------------
>
>                 Key: MPLUGIN-504
>                 URL: https://issues.apache.org/jira/browse/MPLUGIN-504
>             Project: Maven Plugin Tools
>          Issue Type: Bug
>            Reporter: Christoph Läubrich
>            Priority: Major
>
> With https://issues.apache.org/jira/browse/MPLUGIN-450 there was a regression 
> introduced that leads to previous working builds fail if the have not 
> configured a goalprefix, the error message is:
> >  You need to specify a goalPrefix as it can not be correctly computed
> This has several issues:
> # It does not explain why one "needs" a goalPrefix, nor what it is useful for 
> or why it can not be correctly computed.
> # It is effectively a breaking change in a minor version increment
> # The inital JIRA mentions that
> a) in general, goal prefix is *+optional+*, but "good to have", and usually 
> is present.
> b) we may want to have some option to turn off this feature
> # Now it is required and there is no option to turn it off
> Also the message is not true, the plugin has successfully computed a prefix 
> before without any issues:
> * If the artifact ends with -maven-plugin as in my-cool-maven-plugin the 
> my-cool was chosen
> * If the artifact ends with -plugin as in my-cool-plugin the my-cool was 
> chosen
> * otherwise the full artifact if was chosen as a prefix as in my-cool the 
> my-cool was chosen
> From a users point of view I don't see any problem or "disambiguates" with 
> this approach that justifies a breaking change here, anyone who is concerned 
> about not using this default can and already could choose a prefix and seem 
> to been fine with it for a long time.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to