From 552ab6d2b3876d95bd7b33ea82ef1f0ff77079d8 Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Sat, 8 Oct 2005 14:48:38 +0000 Subject: [PATCH] PR: MNG-914 set start time to the start of the request instead of the start of the executor to account for parent pom resolution git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@307300 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/maven/DefaultMaven.java | 2 +- .../DefaultMavenExecutionRequest.java | 20 +++++++++++------- .../execution/MavenExecutionRequest.java | 3 +++ .../apache/maven/execution/MavenSession.java | 21 ++++++++++++------- .../lifecycle/DefaultLifecycleExecutor.java | 2 +- 5 files changed, 31 insertions(+), 17 deletions(-) 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 12bb16b28f..5ec691fa8c 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -505,7 +505,7 @@ public class DefaultMaven { return new MavenSession( container, request.getSettings(), request.getLocalRepository(), request.getEventDispatcher(), rpm, request.getGoals(), request.getBaseDirectory(), - request.getExecutionProperties() ); + request.getExecutionProperties(), request.getStartTime() ); } /** diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java index 0a5d969f1c..884baf9e28 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java @@ -22,6 +22,7 @@ import org.apache.maven.monitor.event.EventMonitor; import org.apache.maven.profiles.ProfileManager; import org.apache.maven.settings.Settings; +import java.util.Date; import java.util.List; import java.util.Properties; @@ -59,13 +60,11 @@ public class DefaultMavenExecutionRequest private final Properties executionProperties; - public DefaultMavenExecutionRequest( ArtifactRepository localRepository, - Settings settings, - EventDispatcher eventDispatcher, - List goals, - String baseDirectory, - ProfileManager globalProfileManager, - Properties executionProperties ) + private final Date startTime; + + public DefaultMavenExecutionRequest( ArtifactRepository localRepository, Settings settings, + EventDispatcher eventDispatcher, List goals, String baseDirectory, + ProfileManager globalProfileManager, Properties executionProperties ) { this.localRepository = localRepository; @@ -80,6 +79,8 @@ public class DefaultMavenExecutionRequest this.globalProfileManager = globalProfileManager; this.executionProperties = executionProperties; + + this.startTime = new Date(); } public Settings getSettings() @@ -175,4 +176,9 @@ public class DefaultMavenExecutionRequest { return globalProfileManager; } + + public Date getStartTime() + { + return startTime; + } } diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java index 58f9861386..53f39bdf07 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java @@ -22,6 +22,7 @@ import org.apache.maven.monitor.event.EventMonitor; import org.apache.maven.profiles.ProfileManager; import org.apache.maven.settings.Settings; +import java.util.Date; import java.util.List; import java.util.Properties; @@ -66,4 +67,6 @@ public interface MavenExecutionRequest ProfileManager getGlobalProfileManager(); Properties getExecutionProperties(); + + Date getStartTime(); } 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 7ee2d520a1..4c4c6c6c3a 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 @@ -24,6 +24,7 @@ import org.apache.maven.settings.Settings; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.Properties; @@ -53,14 +54,11 @@ public class MavenSession private final Properties executionProperties; - public MavenSession( PlexusContainer container, - Settings settings, - ArtifactRepository localRepository, - EventDispatcher eventDispatcher, - ReactorManager reactorManager, - List goals, - String executionRootDir, - Properties executionProperties ) + private final Date startTime; + + public MavenSession( PlexusContainer container, Settings settings, ArtifactRepository localRepository, + EventDispatcher eventDispatcher, ReactorManager reactorManager, List goals, + String executionRootDir, Properties executionProperties, Date startTime ) { this.container = container; @@ -77,6 +75,8 @@ public class MavenSession this.executionRootDir = executionRootDir; this.executionProperties = executionProperties; + + this.startTime = startTime; } public Map getPluginContext( PluginDescriptor pluginDescriptor, MavenProject project ) @@ -161,4 +161,9 @@ public class MavenSession { return usingPOMsFromFilesystem; } + + public Date getStartTime() + { + return startTime; + } } \ 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 68e5e90b9a..51f6b2453c 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 @@ -121,7 +121,7 @@ public class DefaultLifecycleExecutor MavenExecutionResponse response = new MavenExecutionResponse(); - response.setStart( new Date() ); + response.setStart( session.getStartTime() ); try {