From f5bd9201404ee917c6b39ede7268e7c293eb735b Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Mon, 21 Mar 2005 04:00:46 +0000 Subject: [PATCH] make the detection cleaner to make it easier to clean up later git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163628 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/plugin/DefaultPluginManager.java | 16 ++++++++++++++-- .../org/apache/maven/plugin/AbstractPlugin.java | 10 +--------- .../java/org/apache/maven/plugin/Plugin.java | 3 --- .../apache/maven/plugin/clean/CleanPlugin.java | 4 ---- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java index f263b0046d..ebbb120880 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java @@ -381,7 +381,19 @@ public class DefaultPluginManager plugin.setLog( session.getLog() ); - if ( plugin.supportsNewMojoParadigm() ) + // TODO: remove + boolean newMojoTechnique = false; + try + { + plugin.getClass().getDeclaredMethod( "execute", new Class[0] ); + newMojoTechnique = true; + } + catch ( NoSuchMethodException e ) + { + // intentionally ignored + } + + if ( newMojoTechnique ) { populateParameters( plugin, mojoDescriptor, session ); } @@ -398,7 +410,7 @@ public class DefaultPluginManager dispatcher.dispatchStart( event, goalName ); try { - if ( plugin.supportsNewMojoParadigm() ) + if ( newMojoTechnique ) { plugin.execute(); } diff --git a/maven-plugin/src/main/java/org/apache/maven/plugin/AbstractPlugin.java b/maven-plugin/src/main/java/org/apache/maven/plugin/AbstractPlugin.java index 6b053e6be9..ddcb35937c 100644 --- a/maven-plugin/src/main/java/org/apache/maven/plugin/AbstractPlugin.java +++ b/maven-plugin/src/main/java/org/apache/maven/plugin/AbstractPlugin.java @@ -83,14 +83,6 @@ public abstract class AbstractPlugin public void execute() throws PluginExecutionException { - if ( supportsNewMojoParadigm() ) - { - throw new PluginExecutionException( "You must override execute() if you implement the new paradigm" ); - } - } - - public boolean supportsNewMojoParadigm() - { - return false; + throw new PluginExecutionException( "You must override execute() if you implement the new paradigm" ); } } diff --git a/maven-plugin/src/main/java/org/apache/maven/plugin/Plugin.java b/maven-plugin/src/main/java/org/apache/maven/plugin/Plugin.java index 056beaccb9..28cd389299 100644 --- a/maven-plugin/src/main/java/org/apache/maven/plugin/Plugin.java +++ b/maven-plugin/src/main/java/org/apache/maven/plugin/Plugin.java @@ -35,7 +35,4 @@ public interface Plugin // TODO: not sure about this here, and may want a getLog on here as well/instead void setLog( Log log ); - - /** @deprecated */ - boolean supportsNewMojoParadigm(); } diff --git a/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanPlugin.java b/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanPlugin.java index 02575c015a..458c6e0e05 100644 --- a/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanPlugin.java +++ b/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanPlugin.java @@ -42,10 +42,6 @@ public class CleanPlugin // TODO: not in the descriptor previously // private boolean failOnError; - public boolean supportsNewMojoParadigm() - { - return true; - } public void execute() throws PluginExecutionException