diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java b/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java index a3c549c9d8..9ad7981347 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java @@ -293,5 +293,14 @@ public class MavenSession { return request.getProjectBuildingConfiguration(); } - + + public List getPluginGroups() + { + return request.getPluginGroups(); + } + + public boolean isOffline() + { + return request.isOffline(); + } } \ No newline at end of file diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java index 49a1d9683e..a98361df44 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java @@ -19,6 +19,12 @@ package org.apache.maven.lifecycle; * under the License. */ +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Stack; + import org.apache.maven.AggregatedBuildFailureException; import org.apache.maven.BuildFailureException; import org.apache.maven.NoGoalsSpecifiedException; @@ -48,23 +54,13 @@ import org.apache.maven.plugin.loader.PluginLoader; import org.apache.maven.plugin.loader.PluginLoaderException; import org.apache.maven.project.MavenProject; import org.apache.maven.project.artifact.InvalidDependencyVersionException; -import org.codehaus.plexus.PlexusConstants; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.classworlds.realm.ClassRealm; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.context.Context; -import org.codehaus.plexus.context.ContextException; import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; import org.codehaus.plexus.util.xml.Xpp3Dom; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Stack; - /** * Responsible for orchestrating the process of building the ordered list of * steps required to achieve the specified set of tasks passed into Maven, then @@ -110,9 +106,7 @@ public class DefaultLifecycleExecutor /** * {@inheritDoc} */ - public void execute( final MavenSession session, - final ReactorManager reactorManager, - final EventDispatcher dispatcher ) + public void execute( MavenSession session, ReactorManager reactorManager, EventDispatcher dispatcher ) throws BuildFailureException, LifecycleExecutionException { // TODO: This is dangerous, particularly when it's just a collection of loose-leaf projects being built @@ -219,27 +213,15 @@ public class DefaultLifecycleExecutor { if ( !reactorManager.isBlackListed( project ) ) { -// line(); -// -// getLogger().info( "Building " + project.getName() ); -// -// getLogger().info( " " + segment ); -// -// line(); - String target = project.getName() + "\nId: " + project.getId() + "\n" + segment; getLogger().debug( "Constructing build plan for " + target ); - // !! This is ripe for refactoring to an aspect. - // Event monitoring. String event = MavenEvents.PROJECT_EXECUTION; long buildStartTime = System.currentTimeMillis(); - dispatcher.dispatchStart( - event, - target ); + dispatcher.dispatchStart( event, target ); ClassRealm oldLookupRealm = setProjectLookupRealm( session, project ); 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 fd56798a8c..c3ca9b8c22 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 @@ -168,7 +168,7 @@ public class DefaultPluginManager { // TODO: since this is only used in the lifecycle executor, maybe it should be moved there? There is no other // use for the mapping manager in here - return pluginMappingManager.getByPrefix( prefix, session.getSettings().getPluginGroups(), + return pluginMappingManager.getByPrefix( prefix, session.getPluginGroups(), project.getRemoteArtifactRepositories(), session.getLocalRepository() ); } @@ -505,7 +505,7 @@ public class DefaultPluginManager + ". It requires a project with an existing pom.xml, but the build is not using one." ); } - if ( mojoDescriptor.isOnlineRequired() && session.getSettings().isOffline() ) + if ( mojoDescriptor.isOnlineRequired() && session.isOffline() ) { // TODO: Should we error out, or simply warn and skip?? throw new PluginExecutionException( mojoExecution, project, diff --git a/maven-core/src/main/java/org/apache/maven/plugin/loader/DefaultPluginPrefixLoader.java b/maven-core/src/main/java/org/apache/maven/plugin/loader/DefaultPluginPrefixLoader.java index 5694f9fdb1..e8f316d53d 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/loader/DefaultPluginPrefixLoader.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/loader/DefaultPluginPrefixLoader.java @@ -7,7 +7,7 @@ import org.apache.maven.plugin.PluginManagerSupport; import org.apache.maven.plugin.PluginMappingManager; import org.apache.maven.plugin.descriptor.PluginDescriptor; import org.apache.maven.project.MavenProject; -import org.apache.maven.settings.Settings; +//import org.apache.maven.settings.Settings; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.LogEnabled; @@ -160,10 +160,8 @@ public class DefaultPluginPrefixLoader MavenSession session ) throws PluginLoaderException { - Settings settings = session.getSettings(); - Plugin plugin = pluginMappingManager.getByPrefix( prefix, - settings.getPluginGroups(), + session.getPluginGroups(), project.getRemoteArtifactRepositories(), session.getLocalRepository() ); diff --git a/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java b/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java index 412132f102..4407731b33 100644 --- a/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java +++ b/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java @@ -344,18 +344,13 @@ public class PluginParameterExpressionEvaluatorTest throws CycleDetectedException, DuplicateProjectException { MavenExecutionRequest request = new DefaultMavenExecutionRequest() - .setSettings( new Settings() ) .setProperties( new Properties() ) .setStartTime( new Date() ) .setGoals( Collections.EMPTY_LIST ) .setBaseDirectory( new File( "" ) ) .setLocalRepository( repo ); -// return new MavenSession( container, request, new DefaultEventDispatcher(), -// new ReactorManager( Collections.EMPTY_LIST, ReactorManager.FAIL_FAST ), Collections.EMPTY_MAP ); - - return new MavenSession( container, request, new DefaultEventDispatcher(), - new ReactorManager( Collections.EMPTY_LIST, ReactorManager.FAIL_FAST ) ); + return new MavenSession( container, request, new DefaultEventDispatcher(), new ReactorManager( Collections.EMPTY_LIST, ReactorManager.FAIL_FAST ) ); } public void testLocalRepositoryExtraction() diff --git a/maven-embedder/src/test/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulatorTest.java b/maven-embedder/src/test/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulatorTest.java index 2ab32f5d5f..461fdc2103 100644 --- a/maven-embedder/src/test/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulatorTest.java +++ b/maven-embedder/src/test/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulatorTest.java @@ -5,13 +5,11 @@ import org.apache.maven.embedder.DefaultConfiguration; import org.apache.maven.embedder.MavenEmbedderException; import org.apache.maven.execution.DefaultMavenExecutionRequest; import org.apache.maven.execution.MavenExecutionRequest; -import org.apache.maven.settings.Settings; import org.codehaus.plexus.PlexusTestCase; public class DefaultMavenExecutionRequestPopulatorTest extends PlexusTestCase { - private MavenExecutionRequestPopulator populator; private WagonManager wagonManager; @@ -28,10 +26,7 @@ public class DefaultMavenExecutionRequestPopulatorTest public void testWagonManagerOfflineFlagIsPopulatedFromSettings() throws MavenEmbedderException { - Settings settings = new Settings(); - settings.setOffline( true ); - - MavenExecutionRequest req = new DefaultMavenExecutionRequest().setSettings( settings ); + MavenExecutionRequest req = new DefaultMavenExecutionRequest().setOffline( true ); assertTrue( wagonManager.isOnline() );