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

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

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


##########
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 consider nexus-staging-maven-plugin legacy, simply put, people should 
avoid using it... all the benefits it (may) add, is that you don't have to log 
into Nx UI and press "close" button. Simply put, not worth if you contrast that 
to legacy burden it brings and have.





> 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