diff --git a/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java b/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java index 4064ac670f..a3df0215f1 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java @@ -45,7 +45,6 @@ public class DefaultArtifactFilterManager implements ArtifactFilterManager artifacts.add( "jsch" ); artifacts.add( "maven-artifact" ); artifacts.add( "maven-artifact-manager" ); - artifacts.add( "maven-build-context" ); artifacts.add( "maven-core" ); artifacts.add( "maven-error-diagnoser" ); artifacts.add( "maven-lifecycle" ); @@ -59,7 +58,7 @@ public class DefaultArtifactFilterManager implements ArtifactFilterManager artifacts.add( "maven-reporting-api" ); artifacts.add( "maven-repository-metadata" ); artifacts.add( "maven-settings" ); - //adding shared/maven-toolchain project here, even though not part of the default + //adding shared/maven-toolchain project here, even though not part of the default //distro yet. artifacts.add( "maven-toolchain" ); artifacts.add( "plexus-component-api" ); diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java index 1a2b53c85b..8363df44c1 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -33,7 +33,7 @@ import org.apache.maven.extension.ExtensionScanningException; import org.apache.maven.lifecycle.LifecycleExecutionException; import org.apache.maven.lifecycle.LifecycleExecutor; import org.apache.maven.lifecycle.TaskValidationResult; -import org.apache.maven.monitor.event.DefaultEventDispatcher; +import org.apache.maven.monitor.event.DeprecationEventDispatcher; import org.apache.maven.monitor.event.EventDispatcher; import org.apache.maven.monitor.event.MavenEvents; import org.apache.maven.profiles.ProfileManager; @@ -168,9 +168,9 @@ public class DefaultMaven return result; } - EventDispatcher dispatcher = new DefaultEventDispatcher( request.getEventMonitors() ); + EventDispatcher dispatcher = new DeprecationEventDispatcher( MavenEvents.DEPRECATIONS, request.getEventMonitors() ); - String event = MavenEvents.REACTOR_EXECUTION; + String event = MavenEvents.MAVEN_EXECUTION; dispatcher.dispatchStart( event, @@ -197,7 +197,9 @@ public class DefaultMaven if ( !tvr.isTaskValid() ) { - result.addException( tvr.generateInvalidTaskException() ); + Exception e = tvr.generateInvalidTaskException(); + result.addException( e ); + dispatcher.dispatchError( event, request.getBaseDirectory(), e ); return result; } @@ -228,11 +230,15 @@ public class DefaultMaven catch ( LifecycleExecutionException e ) { result.addException( e ); + dispatcher.dispatchError( event, request.getBaseDirectory(), e ); + return result; } catch ( BuildFailureException e ) { result.addException( e ); + dispatcher.dispatchError( event, request.getBaseDirectory(), e ); + return result; } @@ -242,6 +248,8 @@ public class DefaultMaven result.setBuildPlans( session.getBuildPlans() ); + dispatcher.dispatchEnd( event, request.getBaseDirectory() ); + return result; } diff --git a/maven-core/src/main/java/org/apache/maven/errors/CoreReporterManager.java b/maven-core/src/main/java/org/apache/maven/errors/CoreReporterManager.java index db06980888..85da13c9af 100644 --- a/maven-core/src/main/java/org/apache/maven/errors/CoreReporterManager.java +++ b/maven-core/src/main/java/org/apache/maven/errors/CoreReporterManager.java @@ -5,6 +5,7 @@ import org.apache.maven.project.error.ProjectReporterManager; public final class CoreReporterManager { + // FIXME: This is not threadsafe!! private static CoreErrorReporter reporter; private CoreReporterManager() 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 5033befc37..2810f60bd3 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 @@ -177,104 +177,7 @@ public class DefaultLifecycleExecutor if ( segment.aggregate() ) { - if ( !reactorManager.isBlackListed( rootProject ) ) - { - line(); - - getLogger().info( "Building " + rootProject.getName() ); - - getLogger().info( " " + segment ); - - line(); - - String target = rootProject.getId() + " ( " + 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 ); - - ClassRealm oldLookupRealm = setProjectLookupRealm( session, rootProject ); - - try - { - session.setCurrentProject( rootProject ); - - // NEW: Build up the execution plan, including configuration. - List mojoBindings = getLifecycleBindings( - segment.getTasks(), - rootProject, - session, - target ); - - // NEW: Then, iterate over each binding in that plan, and execute the associated mojo. - // only call once, with the top-level project (assumed to be provided as a parameter)... - for ( Iterator mojoIterator = mojoBindings.iterator(); mojoIterator.hasNext(); ) - { - MojoBinding binding = (MojoBinding) mojoIterator.next(); - - try - { - executeGoalAndHandleFailures( - binding, - session, - dispatcher, - event, - reactorManager, - buildStartTime, - target, - true ); - } - catch ( MojoFailureException e ) - { - AggregatedBuildFailureException error = new AggregatedBuildFailureException( - session.getExecutionRootDirectory(), - binding, - e ); - - dispatcher.dispatchError( event, target, error ); - - if ( handleExecutionFailure( reactorManager, rootProject, error, binding, buildStartTime ) ) - { - throw error; - } - } - } - } - finally - { - session.setCurrentProject( null ); - restoreLookupRealm( oldLookupRealm ); - } - - - reactorManager.registerBuildSuccess( - rootProject, - System.currentTimeMillis() - buildStartTime ); - - dispatcher.dispatchEnd( - event, - target ); - } - else - { - line(); - - getLogger().info( "SKIPPING " + rootProject.getName() ); - - getLogger().info( " " + segment ); - - getLogger().info( "This project has been banned from further executions due to previous failures." ); - - line(); - } + executeTaskSegmentsForProject( segment, rootProject, reactorManager, dispatcher, session ); } else { @@ -285,103 +188,154 @@ public class DefaultLifecycleExecutor { MavenProject currentProject = (MavenProject) projectIterator.next(); - if ( !reactorManager.isBlackListed( currentProject ) ) - { - line(); - - getLogger().info( "Building " + currentProject.getName() ); - - getLogger().info( " " + segment ); - - line(); - - String target = currentProject.getId() + " ( " + segment + " )"; - - // !! This is ripe for refactoring to an aspect. - // Event monitoring. - String event = MavenEvents.PROJECT_EXECUTION; - - long buildStartTime = System.currentTimeMillis(); - - dispatcher.dispatchStart( - event, - target ); - - ClassRealm oldLookupRealm = setProjectLookupRealm( session, currentProject ); - - try - { - session.setCurrentProject( currentProject ); - - List mojoBindings = getLifecycleBindings( - segment.getTasks(), - currentProject, - session, - target ); - - for ( Iterator mojoIterator = mojoBindings.iterator(); mojoIterator.hasNext(); ) - { - MojoBinding binding = (MojoBinding) mojoIterator.next(); - - getLogger().debug( - "Mojo: " + binding.getGoal() + " has config:\n" - + binding.getConfiguration() ); - - try - { - executeGoalAndHandleFailures( binding, session, dispatcher, - event, reactorManager, - buildStartTime, target, - false); - } - catch ( MojoFailureException e ) - { - ProjectBuildFailureException error = new ProjectBuildFailureException( - currentProject.getId(), - binding, - e ); - - dispatcher.dispatchError( event, target, error ); - - if ( handleExecutionFailure( reactorManager, currentProject, error, binding, buildStartTime ) ) - { - throw error; - } - } - } - } - finally - { - session.setCurrentProject( null ); - restoreLookupRealm( oldLookupRealm ); - } - - reactorManager.registerBuildSuccess( - currentProject, - System.currentTimeMillis() - buildStartTime ); - - dispatcher.dispatchEnd( - event, - target ); - } - else - { - line(); - - getLogger().info( "SKIPPING " + currentProject.getName() ); - - getLogger().info( " " + segment ); - - getLogger().info( - "This project has been banned from further executions due to previous failures." ); - - line(); - } + executeTaskSegmentsForProject( segment, currentProject, reactorManager, dispatcher, session ); } } } } + private void executeTaskSegmentsForProject( TaskSegment segment, + MavenProject project, + ReactorManager reactorManager, + EventDispatcher dispatcher, + MavenSession session ) + throws LifecycleExecutionException, BuildFailureException + { + 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 ); + + ClassRealm oldLookupRealm = setProjectLookupRealm( session, project ); + + try + { + session.setCurrentProject( project ); + + // NEW: Build up the execution plan, including configuration. + List mojoBindings = getLifecycleBindings( + segment.getTasks(), + project, + session, + target ); + + String currentPhase = null; + + // NEW: Then, iterate over each binding in that plan, and execute the associated mojo. + // only call once, with the top-level project (assumed to be provided as a parameter)... + for ( Iterator mojoIterator = mojoBindings.iterator(); mojoIterator.hasNext(); ) + { + MojoBinding binding = (MojoBinding) mojoIterator.next(); + + String phase = binding.getPhase() == null ? null : binding.getPhase().getName(); + + if ( ( currentPhase != null ) && !currentPhase.equals( phase ) ) + { + dispatcher.dispatchEnd( MavenEvents.PHASE_EXECUTION, currentPhase ); + currentPhase = null; + } + + if ( ( currentPhase == null ) && ( phase != null ) ) + { + currentPhase = phase; + dispatcher.dispatchStart( MavenEvents.PHASE_EXECUTION, currentPhase ); + } + + try + { + executeGoalAndHandleFailures( + binding, + session, + dispatcher, + event, + reactorManager, + buildStartTime, + target, + segment.aggregate() ); + } + catch ( MojoFailureException e ) + { + if ( segment.aggregate() ) + { + AggregatedBuildFailureException error = new AggregatedBuildFailureException( + session.getExecutionRootDirectory(), + binding, + e ); + + dispatcher.dispatchError( event, target, error ); + + if ( handleExecutionFailure( reactorManager, project, error, binding, buildStartTime ) ) + { + throw error; + } + } + else + { + ProjectBuildFailureException error = new ProjectBuildFailureException( + project.getId(), + binding, + e ); + + dispatcher.dispatchError( event, target, error ); + + if ( handleExecutionFailure( reactorManager, project, error, binding, buildStartTime ) ) + { + throw error; + } + } + } + } + + dispatcher.dispatchEnd( MavenEvents.PHASE_EXECUTION, currentPhase ); + } + finally + { + session.setCurrentProject( null ); + restoreLookupRealm( oldLookupRealm ); + } + + + reactorManager.registerBuildSuccess( + project, + System.currentTimeMillis() - buildStartTime ); + + dispatcher.dispatchEnd( + event, + target ); + } + else + { + line(); + + getLogger().info( "SKIPPING " + project.getName() ); + + getLogger().info( " " + segment ); + + getLogger().info( "This project has been banned from further executions due to previous failures." ); + + line(); + } + } + /** * Since each project can have its own {@link ClassRealm} instance that inherits * from the core Maven realm, and contains the specific build-extension @@ -939,7 +893,7 @@ public class DefaultLifecycleExecutor { StringBuffer message = new StringBuffer(); - message.append( " task-segment: [" ); + message.append( "task-segment: [" ); for ( Iterator it = tasks.iterator(); it.hasNext(); ) { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlan.java b/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlan.java index 70f934a67f..b4e4ef4edd 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlan.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlan.java @@ -192,6 +192,8 @@ public class BuildPlan public List renderExecutionPlan( final Stack executionStack ) throws NoSuchPhaseException { + LifecycleUtils.setupTrackingInfo( bindings ); + List plan = new ArrayList(); for ( Iterator it = tasks.iterator(); it.hasNext(); ) diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlanUtils.java b/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlanUtils.java index b09cf8c250..0f868e126b 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlanUtils.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlanUtils.java @@ -127,7 +127,18 @@ public final class BuildPlanUtils StringBuffer listing = new StringBuffer(); listing.append( MojoBindingUtils.toString( binding ) ); - listing.append( " [executionId: " ).append( binding.getExecutionId() ).append( "]" ); + listing.append( " [executionId: " ).append( binding.getExecutionId() ).append( ", phase: " ); + + if ( ( binding.getPhase() != null ) && ( binding.getPhase().getName() != null ) ) + { + listing.append( binding.getPhase().getName() ); + } + else + { + listing.append( "None specified" ); + } + + listing.append( "]" ); if ( extendedInfo ) { diff --git a/maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventMonitor.java b/maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventMonitor.java index 4dc05f03e0..63fc870516 100644 --- a/maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventMonitor.java +++ b/maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventMonitor.java @@ -28,20 +28,66 @@ public class DefaultEventMonitor extends AbstractSelectiveEventMonitor { - private static final String[] START_EVENTS = {MavenEvents.MOJO_EXECUTION}; + private static final String[] START_EVENTS = { + MavenEvents.PROJECT_EXECUTION, + MavenEvents.PHASE_EXECUTION, + MavenEvents.MOJO_EXECUTION + }; + + private static final String[] END_EVENTS = { + MavenEvents.PHASE_EXECUTION + }; private final Logger logger; public DefaultEventMonitor( Logger logger ) { - super( START_EVENTS, MavenEvents.NO_EVENTS, MavenEvents.NO_EVENTS ); + super( START_EVENTS, END_EVENTS, MavenEvents.NO_EVENTS ); this.logger = logger; } protected void doStartEvent( String event, String target, long time ) { - logger.info( "[" + target + "]" ); + if ( MavenEvents.MOJO_EXECUTION.equals( event ) ) + { + logger.info( "[" + target + "]" ); + } + else if ( MavenEvents.PHASE_EXECUTION.equals( event ) ) + { + logger.debug( line() ); + logger.debug( "Entering lifecycle phase: " + target ); + logger.debug( line() ); + } + else if ( MavenEvents.PROJECT_EXECUTION.equals( event ) ) + { + logger.info( line() ); + String[] targetParts = target.split( "\n" ); + logger.info( "Building " + targetParts[0] ); + if ( targetParts.length > 0 ) + { + logger.info( "" ); + for ( int i = 1; i < targetParts.length; i++ ) + { + logger.info( targetParts[i] ); + } + } + logger.info( line() ); + } + } + + protected void doEndEvent( String event, + String target, + long timestamp ) + { + logger.debug( line() ); + logger.debug( "Completed lifecycle phase: " + target ); + logger.debug( line() ); + } + + private String line() + { + return "------------------------------------------------------------------------"; } } \ No newline at end of file diff --git a/maven-core/src/main/java/org/apache/maven/monitor/event/DeprecationEventDispatcher.java b/maven-core/src/main/java/org/apache/maven/monitor/event/DeprecationEventDispatcher.java new file mode 100644 index 0000000000..1c55fa7543 --- /dev/null +++ b/maven-core/src/main/java/org/apache/maven/monitor/event/DeprecationEventDispatcher.java @@ -0,0 +1,54 @@ +package org.apache.maven.monitor.event; + +import java.util.List; +import java.util.Map; + +public class DeprecationEventDispatcher + extends DefaultEventDispatcher +{ + + private final Map deprecatedEventsByReplacement; + + public DeprecationEventDispatcher( Map deprecatedEventsByReplacement ) + { + this.deprecatedEventsByReplacement = deprecatedEventsByReplacement; + } + + public DeprecationEventDispatcher( Map deprecatedEventsByReplacement, List eventMonitors ) + { + super( eventMonitors ); + this.deprecatedEventsByReplacement = deprecatedEventsByReplacement; + } + + public void dispatchEnd( String event, + String target ) + { + super.dispatchEnd( event, target ); + if ( deprecatedEventsByReplacement.containsKey( event ) ) + { + super.dispatchEnd( (String) deprecatedEventsByReplacement.get( event ), target ); + } + } + + public void dispatchError( String event, + String target, + Throwable cause ) + { + super.dispatchError( event, target, cause ); + if ( deprecatedEventsByReplacement.containsKey( event ) ) + { + super.dispatchError( (String) deprecatedEventsByReplacement.get( event ), target, cause ); + } + } + + public void dispatchStart( String event, + String target ) + { + super.dispatchStart( event, target ); + if ( deprecatedEventsByReplacement.containsKey( event ) ) + { + super.dispatchStart( (String) deprecatedEventsByReplacement.get( event ), target ); + } + } + +} diff --git a/maven-core/src/main/java/org/apache/maven/monitor/event/MavenEvents.java b/maven-core/src/main/java/org/apache/maven/monitor/event/MavenEvents.java index c31c2ee1f1..2bbd9dc922 100644 --- a/maven-core/src/main/java/org/apache/maven/monitor/event/MavenEvents.java +++ b/maven-core/src/main/java/org/apache/maven/monitor/event/MavenEvents.java @@ -1,5 +1,8 @@ package org.apache.maven.monitor.event; +import java.util.HashMap; +import java.util.Map; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -28,17 +31,37 @@ public final class MavenEvents public static final String PHASE_EXECUTION = "phase-execute"; public static final String MOJO_EXECUTION = "mojo-execute"; public static final String PROJECT_EXECUTION = "project-execute"; + + /** @deprecated Use {@link MavenEvents#MAVEN_EXECUTION} instead. */ public static final String REACTOR_EXECUTION = "reactor-execute"; - + public static final String MAVEN_EXECUTION = "maven-execute"; + + public static final String EMBEDDER_LIFECYCLE = "embedder-lifecycle"; + public static final String EMBEDDER_METHOD = "embedder-method"; + + public static final Map DEPRECATIONS; + + static + { + Map dep = new HashMap(); + + dep.put( MAVEN_EXECUTION, REACTOR_EXECUTION ); + + DEPRECATIONS = dep; + } + public static final String[] ALL_EVENTS = { PHASE_EXECUTION, MOJO_EXECUTION, PROJECT_EXECUTION, - REACTOR_EXECUTION + REACTOR_EXECUTION, + MAVEN_EXECUTION, + EMBEDDER_LIFECYCLE, + EMBEDDER_METHOD }; - + public static final String[] NO_EVENTS = {}; - + private MavenEvents() { } diff --git a/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java b/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java index 689371aea6..de8ee0ff51 100644 --- a/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java +++ b/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java @@ -12,8 +12,10 @@ import org.codehaus.plexus.util.xml.Xpp3Dom; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; public class LifecycleUtils { @@ -22,6 +24,33 @@ public class LifecycleUtils { } + public static void setupTrackingInfo( final LifecycleBindings bindings ) + { + for ( Iterator bindingIt = bindings.getBindingList().iterator(); bindingIt.hasNext(); ) + { + LifecycleBinding binding = (LifecycleBinding) bindingIt.next(); + + if ( binding == null ) + { + continue; + } + + LinkedHashMap phaseMap = binding.getOrderedPhaseMapping(); + for ( Iterator phaseIt = phaseMap.entrySet().iterator(); phaseIt.hasNext(); ) + { + Map.Entry entry = (Entry) phaseIt.next(); + Phase phase = (Phase) entry.getValue(); + + String phaseName = (String) entry.getKey(); + + if ( phase != null ) + { + phase.setLifecycleInfo( phaseName, binding ); + } + } + } + } + public static void setOrigin( final LifecycleBindings bindings, final String origin ) { for ( Iterator bindingIt = bindings.getBindingList().iterator(); bindingIt.hasNext(); ) diff --git a/maven-lifecycle/src/main/mdo/maven-lifecycle.mdo b/maven-lifecycle/src/main/mdo/maven-lifecycle.mdo index 0a398212d2..debae7c02b 100644 --- a/maven-lifecycle/src/main/mdo/maven-lifecycle.mdo +++ b/maven-lifecycle/src/main/mdo/maven-lifecycle.mdo @@ -116,6 +116,11 @@ throw new UnsupportedOperationException( "Unsupported in base-class." ); } + public java.util.LinkedHashMap getOrderedPhaseMapping() + { + throw new UnsupportedOperationException( "Unsupported in base-class." ); + } + public java.util.List getPhasesInOrder() { throw new UnsupportedOperationException( "Unsupported in base-class." ); @@ -168,26 +173,24 @@ return "clean"; } + public java.util.LinkedHashMap getOrderedPhaseMapping() + { + java.util.LinkedHashMap phases = new java.util.LinkedHashMap(); + phases.put( "pre-clean", getPreClean() ); + phases.put( "clean", getClean() ); + phases.put( "post-clean", getPostClean() ); + + return phases; + } + public java.util.List getPhasesInOrder() { - java.util.List phases = new java.util.ArrayList(); - - phases.add( getPreClean() ); - phases.add( getClean() ); - phases.add( getPostClean() ); - - return java.util.Collections.unmodifiableList( phases ); + return new java.util.ArrayList( getOrderedPhaseMapping().values() ); } public java.util.List getPhaseNamesInOrder() { - java.util.List phases = new java.util.ArrayList(); - - phases.add( "pre-clean" ); - phases.add( "clean" ); - phases.add( "post-clean" ); - - return java.util.Collections.unmodifiableList( phases ); + return new java.util.ArrayList( getOrderedPhaseMapping().keySet() ); } ]]> @@ -392,66 +395,44 @@ return "build"; } + public java.util.LinkedHashMap getOrderedPhaseMapping() + { + java.util.LinkedHashMap phases = new java.util.LinkedHashMap(); + phases.put( "validate", getValidate() ); + phases.put( "initialize", getInitialize() ); + phases.put( "generate-sources", getGenerateSources() ); + phases.put( "process-sources", getProcessSources() ); + phases.put( "generate-resources", getGenerateResources() ); + phases.put( "process-resources", getProcessResources() ); + phases.put( "compile", getCompile() ); + phases.put( "process-classes", getProcessClasses() ); + phases.put( "generate-test-sources", getGenerateTestSources() ); + phases.put( "process-test-sources", getProcessTestSources() ); + phases.put( "generate-test-resources", getGenerateTestResources() ); + phases.put( "process-test-resources", getProcessTestResources() ); + phases.put( "test-compile", getTestCompile() ); + phases.put( "process-test-classes", getProcessTestClasses() ); + phases.put( "test", getTest() ); + phases.put( "prepare-package", getPreparePackage() ); + phases.put( "package", getCreatePackage() ); + phases.put( "pre-integration-test", getPreIntegrationTest() ); + phases.put( "integration-test", getIntegrationTest() ); + phases.put( "post-integration-test", getPostIntegrationTest() ); + phases.put( "verify", getVerify() ); + phases.put( "install", getInstall() ); + phases.put( "deploy", getDeploy() ); + + return phases; + } + public java.util.List getPhasesInOrder() { - java.util.List phases = new java.util.ArrayList(); - - phases.add( getValidate() ); - phases.add( getInitialize() ); - phases.add( getGenerateSources() ); - phases.add( getProcessSources() ); - phases.add( getGenerateResources() ); - phases.add( getProcessResources() ); - phases.add( getCompile() ); - phases.add( getProcessClasses() ); - phases.add( getGenerateTestSources() ); - phases.add( getProcessTestSources() ); - phases.add( getGenerateTestResources() ); - phases.add( getProcessTestResources() ); - phases.add( getTestCompile() ); - phases.add( getProcessTestClasses() ); - phases.add( getTest() ); - phases.add( getPreparePackage() ); - phases.add( getCreatePackage() ); - phases.add( getPreIntegrationTest() ); - phases.add( getIntegrationTest() ); - phases.add( getPostIntegrationTest() ); - phases.add( getVerify() ); - phases.add( getInstall() ); - phases.add( getDeploy() ); - - return java.util.Collections.unmodifiableList( phases ); + return new java.util.ArrayList( getOrderedPhaseMapping().values() ); } public java.util.List getPhaseNamesInOrder() { - java.util.List phases = new java.util.ArrayList(); - - phases.add( "validate" ); - phases.add( "initialize" ); - phases.add( "generate-sources" ); - phases.add( "process-sources" ); - phases.add( "generate-resources" ); - phases.add( "process-resources" ); - phases.add( "compile" ); - phases.add( "process-classes" ); - phases.add( "generate-test-sources" ); - phases.add( "process-test-sources" ); - phases.add( "generate-test-resources" ); - phases.add( "process-test-resources" ); - phases.add( "test-compile" ); - phases.add( "process-test-classes" ); - phases.add( "test" ); - phases.add( "prepare-package" ); - phases.add( "package" ); - phases.add( "pre-integration-test" ); - phases.add( "integration-test" ); - phases.add( "post-integration-test" ); - phases.add( "verify" ); - phases.add( "install" ); - phases.add( "deploy" ); - - return java.util.Collections.unmodifiableList( phases ); + return new java.util.ArrayList( getOrderedPhaseMapping().keySet() ); } ]]> @@ -503,29 +484,26 @@ { return "site"; } - + + public java.util.LinkedHashMap getOrderedPhaseMapping() + { + java.util.LinkedHashMap map = new java.util.LinkedHashMap(); + map.put( "pre-site", getPreSite() ); + map.put( "site", getSite() ); + map.put( "post-site", getPostSite() ); + map.put( "site-deploy", getSiteDeploy() ); + + return map; + } + public java.util.List getPhasesInOrder() { - java.util.List phases = new java.util.ArrayList(); - - phases.add( getPreSite() ); - phases.add( getSite() ); - phases.add( getPostSite() ); - phases.add( getSiteDeploy() ); - - return java.util.Collections.unmodifiableList( phases ); + return new java.util.ArrayList( getOrderedPhaseMapping().values() ); } public java.util.List getPhaseNamesInOrder() { - java.util.List phases = new java.util.ArrayList(); - - phases.add( "pre-site" ); - phases.add( "site" ); - phases.add( "post-site" ); - phases.add( "site-deploy" ); - - return java.util.Collections.unmodifiableList( phases ); + return new java.util.ArrayList( getOrderedPhaseMapping().keySet() ); } ]]> @@ -546,6 +524,50 @@ + + + 1.0.0 + + + MojoBinding @@ -674,6 +696,26 @@ { this.lateBound = lateBound; } + + private Phase phase; + + /** + * Get the Phase instance to which this MojoBinding is bound. NOTE: In + * some cases, the phase name may not be known, or may not exist (as in the + * case of a direct mojo invocation from the command line or embedder). + */ + public Phase getPhase() + { + return phase; + } + + /** + * Set the Phase instance to which this MojoBinding is bound. + */ + public void setLifecycleInfo( Phase phase ) + { + this.phase = phase; + } ]]> diff --git a/maven-project/src/main/java/org/apache/maven/project/error/ProjectReporterManager.java b/maven-project/src/main/java/org/apache/maven/project/error/ProjectReporterManager.java index dfe6fd540c..a51b19742b 100644 --- a/maven-project/src/main/java/org/apache/maven/project/error/ProjectReporterManager.java +++ b/maven-project/src/main/java/org/apache/maven/project/error/ProjectReporterManager.java @@ -3,6 +3,7 @@ package org.apache.maven.project.error; public final class ProjectReporterManager { + // FIXME: This is not threadsafe! private static ProjectErrorReporter reporter; private ProjectReporterManager()