You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/07/12 15:33:54 UTC

[GitHub] [maven] kwin commented on a diff in pull request #765: Experiment: warn on ancient plugin

kwin commented on code in PR #765:
URL: https://github.com/apache/maven/pull/765#discussion_r919117759


##########
maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java:
##########
@@ -419,6 +421,32 @@ private void createPluginRealm( PluginDescriptor pluginDescriptor, MavenSession
 
         pluginDescriptor.setClassRealm( pluginRealm );
         pluginDescriptor.setArtifacts( pluginArtifacts );
+
+        try
+        {
+            GenericVersionScheme versionScheme = new GenericVersionScheme();
+            Version minimumVersion = versionScheme.parseVersion( "3.1.0" );
+            for ( Artifact artifact : pluginArtifacts )
+            {
+                if ( "org.apache.maven".equals( artifact.getGroupId() ) && "maven-plugin-api".equals(
+                        artifact.getArtifactId() ) )
+                {
+                    Version mavenPluginApiVersion = versionScheme.parseVersion( artifact.getVersion() );
+                    if ( minimumVersion.compareTo( mavenPluginApiVersion ) > 0 )
+                    {
+                        logger.warn( "" );
+                        logger.warn( "Plugin " + plugin.getId()
+                                + " is old, please update to plugin supporting Maven 3.1+" );

Review Comment:
   I think the message is targeted to the Maven user not the Plugin developer, so the advise to update the plugin to a newer version seems more reasonable to me.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org