You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2022/07/11 15:13:45 UTC

[maven] branch warn-on-ancient-plugin created (now fc9b5d3d3)

This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a change to branch warn-on-ancient-plugin
in repository https://gitbox.apache.org/repos/asf/maven.git


      at fc9b5d3d3 Experiment: warn on ancient plugin

This branch includes the following new commits:

     new fc9b5d3d3 Experiment: warn on ancient plugin

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven] 01/01: Experiment: warn on ancient plugin

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a commit to branch warn-on-ancient-plugin
in repository https://gitbox.apache.org/repos/asf/maven.git

commit fc9b5d3d3beff98076bc2171ac2582c285490cd3
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Mon Jul 11 17:13:24 2022 +0200

    Experiment: warn on ancient plugin
---
 .../plugin/internal/DefaultMavenPluginManager.java | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
index a69c88eac..4df15553b 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
@@ -87,6 +87,8 @@ import org.eclipse.aether.graph.DependencyNode;
 import org.eclipse.aether.repository.RemoteRepository;
 import org.eclipse.aether.util.filter.AndDependencyFilter;
 import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator;
+import org.eclipse.aether.util.version.GenericVersionScheme;
+import org.eclipse.aether.version.Version;
 
 import java.io.BufferedInputStream;
 import java.io.ByteArrayOutputStream;
@@ -419,6 +421,28 @@ public class DefaultMavenPluginManager
 
         pluginDescriptor.setClassRealm( pluginRealm );
         pluginDescriptor.setArtifacts( pluginArtifacts );
+
+        try
+        {
+            GenericVersionScheme versionScheme = new GenericVersionScheme();
+            Version version = versionScheme.parseVersion( "3.1.0" );
+            for ( Artifact artifact : pluginArtifacts )
+            {
+                if ( "org.apache.maven".equals( artifact.getGroupId() ) && "maven-plugin-api".equals(
+                        artifact.getArtifactId() ) )
+                {
+                    logger.warn( "" );
+                    logger.warn( "Plugin " + plugin.getId()
+                            + " is old, please update to plugin supporting Maven 3.1+" );
+                    logger.warn( "" );
+                }
+            }
+        }
+        catch ( org.eclipse.aether.version.InvalidVersionSpecificationException e )
+        {
+            // nope
+            logger.warn( "never thrown", e );
+        }
     }
 
     private void discoverPluginComponents( final ClassRealm pluginRealm, Plugin plugin,