diff --git a/maven-core/src/main/aspect/org/apache/maven/compat/plugin/Maven20xCompatAspect.aj b/maven-core/src/main/aspect/org/apache/maven/compat/Maven20xCompatAspect.aj similarity index 91% rename from maven-core/src/main/aspect/org/apache/maven/compat/plugin/Maven20xCompatAspect.aj rename to maven-core/src/main/aspect/org/apache/maven/compat/Maven20xCompatAspect.aj index 6d961bbd85..7d2cbfd48a 100644 --- a/maven-core/src/main/aspect/org/apache/maven/compat/plugin/Maven20xCompatAspect.aj +++ b/maven-core/src/main/aspect/org/apache/maven/compat/Maven20xCompatAspect.aj @@ -1,6 +1,10 @@ -package org.apache.maven.compat.plugin; +package org.apache.maven.compat; +import org.apache.maven.lifecycle.binding.DefaultLifecycleBindingManager; +import org.apache.maven.lifecycle.binding.LifecycleBindingManager; +import org.codehaus.plexus.PlexusContainer; import org.apache.maven.DefaultMaven; +import org.apache.maven.lifecycle.DefaultLifecycleExecutor; import org.apache.maven.lifecycle.MojoBindingUtils; import org.apache.maven.lifecycle.LifecycleUtils; import org.apache.maven.lifecycle.NoSuchPhaseException; @@ -34,10 +38,12 @@ import org.apache.maven.settings.DefaultMavenSettingsBuilder; import org.apache.maven.settings.Settings; import org.codehaus.plexus.classworlds.realm.ClassRealm; import org.codehaus.plexus.classworlds.realm.NoSuchRealmException; +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.codehaus.plexus.util.xml.Xpp3Dom; import org.codehaus.plexus.logging.Logger; +import java.util.List; import java.io.IOException; import java.util.Iterator; import java.util.Collection; @@ -355,4 +361,30 @@ public privileged aspect Maven20xCompatAspect return result; } + // This is to support the maven-enforcer-plugin. + private List DefaultLifecycleExecutor.lifecycles; + + private pointcut lifecycleExecutorExecute( DefaultLifecycleExecutor executor ): + execution( * DefaultLifecycleExecutor.execute( .. ) ) + && this( executor ); + + before( DefaultLifecycleExecutor executor ): lifecycleExecutorExecute( executor ) + { + PlexusContainer container = executor.container; + DefaultLifecycleBindingManager bindingMgr; + try + { + bindingMgr = (DefaultLifecycleBindingManager) container.lookup( LifecycleBindingManager.ROLE, "default" ); + } + catch ( ComponentLookupException e ) + { + IllegalStateException err = new IllegalStateException( "Cannot lookup default role-hint for: " + LifecycleBindingManager.ROLE ); + err.initCause( e ); + + throw err; + } + + executor.lifecycles = bindingMgr.lifecycles; + } + } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultLifecycleBindingManager.java b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultLifecycleBindingManager.java index ee0617edad..1337a05dea 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultLifecycleBindingManager.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultLifecycleBindingManager.java @@ -63,7 +63,7 @@ public class DefaultLifecycleBindingManager private Logger logger; // configured. Moved out of DefaultLifecycleExecutor... - private List legacyLifecycles; + private List lifecycles; // configured. Moved out of DefaultLifecycleExecutor... private List defaultReports; @@ -128,7 +128,7 @@ public class DefaultLifecycleBindingManager */ public LifecycleBindings getDefaultBindings( final MavenProject project ) throws LifecycleSpecificationException { - LifecycleBindings bindings = legacyLifecycleMappingParser.parseDefaultMappings( legacyLifecycles ); + LifecycleBindings bindings = legacyLifecycleMappingParser.parseDefaultMappings( lifecycles ); BindingUtils.injectProjectConfiguration( bindings, project ); @@ -325,7 +325,7 @@ public class DefaultLifecycleBindingManager if ( lifecycleOverlay == null ) { - throw new LifecycleLoaderException( "LegacyLifecycle '" + lifecycleId + "' not found in plugin" ); + throw new LifecycleLoaderException( "Lifecycle '" + lifecycleId + "' not found in plugin" ); } LifecycleBindings bindings = new LifecycleBindings(); diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LegacyLifecycleMappingParser.java b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LegacyLifecycleMappingParser.java index 2837abbf35..e35cb809b8 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LegacyLifecycleMappingParser.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LegacyLifecycleMappingParser.java @@ -39,7 +39,7 @@ public class LegacyLifecycleMappingParser for ( Iterator it = lifecycles.iterator(); it.hasNext(); ) { - LegacyLifecycle lifecycle = (LegacyLifecycle) it.next(); + Lifecycle lifecycle = (Lifecycle) it.next(); if ( "clean".equals( lifecycle.getId() ) ) { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LegacyLifecycle.java b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/Lifecycle.java similarity index 84% rename from maven-core/src/main/java/org/apache/maven/lifecycle/binding/LegacyLifecycle.java rename to maven-core/src/main/java/org/apache/maven/lifecycle/binding/Lifecycle.java index 6c0b7dec6b..b82e5c95b8 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LegacyLifecycle.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/Lifecycle.java @@ -24,9 +24,9 @@ import java.util.List; import java.util.Map; /** - * Class LegacyLifecycle. + * Class Lifecycle. */ -public class LegacyLifecycle +public class Lifecycle { /** * Field id @@ -58,21 +58,21 @@ public class LegacyLifecycle */ public String getId() { - return this.id; - } //-- String getId() + return id; + } //-- String getId() /** * Method getPhases */ public List getPhases() { - if ( this.phases == null ) + if ( phases == null ) { - this.phases = new ArrayList(); + phases = new ArrayList(); } - return this.phases; - } //-- java.util.List getPhases() + return phases; + } //-- java.util.List getPhases() /** * Method setId @@ -82,7 +82,7 @@ public class LegacyLifecycle public void setId( String id ) { this.id = id; - } //-- void setId(String) + } //-- void setId(String) /** * Method setPhases @@ -92,7 +92,7 @@ public class LegacyLifecycle public void setPhases( List phases ) { this.phases = phases; - } //-- void setPhases(java.util.List) + } //-- void setPhases(java.util.List) public Map getDefaultPhases() { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java index b048cde8fb..0ac078c198 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java @@ -25,7 +25,7 @@ import java.util.List; import java.util.Map; /** - * LegacyLifecycle mapping for a POM. + * Lifecycle mapping for a POM. * * @author Brett Porter * @version $Id$ diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/Lifecycle.java b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/Lifecycle.java index 0529d3cfb9..3e9923e0af 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/Lifecycle.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/Lifecycle.java @@ -24,7 +24,7 @@ import java.util.List; import java.util.Map; /** - * Class LegacyLifecycle. + * Class Lifecycle. */ public class Lifecycle { 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 e26c53f9c5..a79f620bc3 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 @@ -1262,7 +1262,7 @@ public class DefaultPluginManager } // ---------------------------------------------------------------------- - // LegacyLifecycle + // Lifecycle // ---------------------------------------------------------------------- public void contextualize( Context context ) diff --git a/maven-core/src/main/resources/META-INF/plexus/components.xml b/maven-core/src/main/resources/META-INF/plexus/components.xml index 9da3f89d2d..b5f8bfed49 100644 --- a/maven-core/src/main/resources/META-INF/plexus/components.xml +++ b/maven-core/src/main/resources/META-INF/plexus/components.xml @@ -725,8 +725,8 @@ under the License. - - + + default @@ -755,8 +755,8 @@ under the License. deploy - - + + clean pre-clean @@ -766,8 +766,8 @@ under the License. org.apache.maven.plugins:maven-clean-plugin:clean - - + + site pre-site @@ -779,8 +779,8 @@ under the License. org.apache.maven.plugins:maven-site-plugin:site org.apache.maven.plugins:maven-site-plugin:deploy - - + + org.apache.maven.plugins:maven-project-info-reports-plugin diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java b/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java index 5460254a03..f9dfd27ab9 100644 --- a/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java +++ b/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java @@ -483,7 +483,7 @@ public class MavenEmbedder // Execution of phases/goals // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- - // LegacyLifecycle information + // Lifecycle information // ---------------------------------------------------------------------- public List getLifecyclePhases() @@ -517,7 +517,7 @@ public class MavenEmbedder } // ---------------------------------------------------------------------- - // LegacyLifecycle + // Lifecycle // ---------------------------------------------------------------------- private MavenExecutionRequest request; @@ -629,7 +629,7 @@ public class MavenEmbedder } // ---------------------------------------------------------------------- - // LegacyLifecycle + // Lifecycle // ---------------------------------------------------------------------- private void handleExtensions( List extensions ) diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java b/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java index 408e058645..65d797a5a3 100644 --- a/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java +++ b/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java @@ -640,7 +640,7 @@ public class DefaultMavenExecutionRequestPopulator } // ---------------------------------------------------------------------------- - // LegacyLifecycle + // Lifecycle // ---------------------------------------------------------------------------- public void contextualize( Context context ) diff --git a/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java b/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java index f388821992..5a6459449e 100644 --- a/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java +++ b/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java @@ -266,7 +266,7 @@ public class MavenEmbedderTest } // ---------------------------------------------------------------------- - // LegacyLifecycle phases + // Lifecycle phases // ---------------------------------------------------------------------- public void testRetrievingLifecyclePhases()