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

ASF GitHub Bot commented on MPLUGIN-519:
----------------------------------------

michael-o commented on code in PR #280:
URL: 
https://github.com/apache/maven-plugin-tools/pull/280#discussion_r1586351295


##########
maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java:
##########
@@ -69,25 +69,33 @@ public class AddPluginArtifactMetadataMojo extends 
AbstractMojo {
     @Parameter(defaultValue = "false", property = "maven.plugin.skip")
     private boolean skip;
 
+    @Component
+    private RuntimeInformation runtimeInformation;
+
+    private final VersionScheme versionScheme = new GenericVersionScheme();
+
     /** {@inheritDoc} */
     @Override
     public void execute() throws MojoExecutionException {
         if (skip) {
             getLog().warn("Execution skipped");
             return;
         }
-        Artifact projectArtifact = project.getArtifact();
-
-        Versioning versioning = new Versioning();
-        versioning.setLatest(projectArtifact.getVersion());
-        versioning.updateTimestamp();
-        ArtifactRepositoryMetadata metadata = new 
ArtifactRepositoryMetadata(projectArtifact, versioning);
-        projectArtifact.addMetadata(metadata);
-
-        GroupRepositoryMetadata groupMetadata = new 
GroupRepositoryMetadata(project.getGroupId());
-        groupMetadata.addPluginMapping(getGoalPrefix(), 
project.getArtifactId(), project.getName());
+        // nothing if Maven is 3.9+
+        try {
+            if (versionScheme
+                            .parseVersion("3.9.0")
+                            
.compareTo(versionScheme.parseVersion(runtimeInformation.getMavenVersion()))
+                    < 1) {
+                getLog().info("This Mojo is not used in Maven version 3.9.0 
and above");
+                return;
+            }
+        } catch (InvalidVersionSpecificationException e) {
+            // not happening with generic
+            throw new MojoExecutionException(e);
+        }
 
-        projectArtifact.addMetadata(groupMetadata);
+        LegacySupport.execute(project, getGoalPrefix());

Review Comment:
   I fully agree with @cstamas and ignore it.





> Update to Parent POM 42, prerequisite 3.6.3
> -------------------------------------------
>
>                 Key: MPLUGIN-519
>                 URL: https://issues.apache.org/jira/browse/MPLUGIN-519
>             Project: Maven Plugin Tools
>          Issue Type: Dependency upgrade
>            Reporter: Tamas Cservenak
>            Assignee: Tamas Cservenak
>            Priority: Major
>             Fix For: 3.12.1
>
>




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

Reply via email to