mirror of https://github.com/apache/maven.git
reformat before patch
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@567948 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1bb845492e
commit
7a8dd28f80
|
@ -25,7 +25,15 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||||
import org.apache.maven.context.BuildContextManager;
|
import org.apache.maven.context.BuildContextManager;
|
||||||
import org.apache.maven.context.SystemBuildContext;
|
import org.apache.maven.context.SystemBuildContext;
|
||||||
import org.apache.maven.execution.*;
|
import org.apache.maven.execution.BuildFailure;
|
||||||
|
import org.apache.maven.execution.DefaultMavenExecutionResult;
|
||||||
|
import org.apache.maven.execution.ExecutionBuildContext;
|
||||||
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
|
import org.apache.maven.execution.MavenExecutionResult;
|
||||||
|
import org.apache.maven.execution.MavenSession;
|
||||||
|
import org.apache.maven.execution.ReactorManager;
|
||||||
|
import org.apache.maven.execution.RuntimeInformation;
|
||||||
|
import org.apache.maven.execution.SessionContext;
|
||||||
import org.apache.maven.extension.BuildExtensionScanner;
|
import org.apache.maven.extension.BuildExtensionScanner;
|
||||||
import org.apache.maven.extension.ExtensionScanningException;
|
import org.apache.maven.extension.ExtensionScanningException;
|
||||||
import org.apache.maven.lifecycle.LifecycleExecutor;
|
import org.apache.maven.lifecycle.LifecycleExecutor;
|
||||||
|
@ -56,7 +64,12 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jason van zyl
|
* @author jason van zyl
|
||||||
|
@ -72,7 +85,7 @@ public class DefaultMaven
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
protected BuildContextManager buildContextManager;
|
protected BuildContextManager buildContextManager;
|
||||||
|
|
||||||
protected MavenProjectBuilder projectBuilder;
|
protected MavenProjectBuilder projectBuilder;
|
||||||
|
|
||||||
protected LifecycleExecutor lifecycleExecutor;
|
protected LifecycleExecutor lifecycleExecutor;
|
||||||
|
@ -98,7 +111,7 @@ public class DefaultMaven
|
||||||
public MavenExecutionResult execute( MavenExecutionRequest request )
|
public MavenExecutionResult execute( MavenExecutionRequest request )
|
||||||
{
|
{
|
||||||
request.setStartTime( new Date() );
|
request.setStartTime( new Date() );
|
||||||
|
|
||||||
initializeBuildContext( request );
|
initializeBuildContext( request );
|
||||||
|
|
||||||
EventDispatcher dispatcher = new DefaultEventDispatcher( request.getEventMonitors() );
|
EventDispatcher dispatcher = new DefaultEventDispatcher( request.getEventMonitors() );
|
||||||
|
@ -130,7 +143,7 @@ public class DefaultMaven
|
||||||
// Either the build was successful, or it was a fail_at_end/fail_never reactor build
|
// Either the build was successful, or it was a fail_at_end/fail_never reactor build
|
||||||
|
|
||||||
ReactorManager reactorManager = result.getReactorManager();
|
ReactorManager reactorManager = result.getReactorManager();
|
||||||
|
|
||||||
// TODO: should all the logging be left to the CLI?
|
// TODO: should all the logging be left to the CLI?
|
||||||
logReactorSummary( reactorManager );
|
logReactorSummary( reactorManager );
|
||||||
|
|
||||||
|
@ -150,7 +163,8 @@ public class DefaultMaven
|
||||||
|
|
||||||
line();
|
line();
|
||||||
|
|
||||||
return new DefaultMavenExecutionResult( Collections.singletonList( new MavenExecutionException( "Some builds failed" ) ) );
|
return new DefaultMavenExecutionResult(
|
||||||
|
Collections.singletonList( new MavenExecutionException( "Some builds failed" ) ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -171,21 +185,20 @@ public class DefaultMaven
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize some context objects to be stored in the container's context map for reference by
|
* Initialize some context objects to be stored in the container's context map for reference by
|
||||||
* other Maven components (including custom components that need more information about the
|
* other Maven components (including custom components that need more information about the
|
||||||
* build than is supplied to them by the APIs).
|
* build than is supplied to them by the APIs).
|
||||||
*/
|
*/
|
||||||
private void initializeBuildContext( MavenExecutionRequest request )
|
private void initializeBuildContext( MavenExecutionRequest request )
|
||||||
{
|
{
|
||||||
new ExecutionBuildContext( request ).store( buildContextManager );
|
new ExecutionBuildContext( request ).store( buildContextManager );
|
||||||
|
|
||||||
SystemBuildContext systemContext = SystemBuildContext.getSystemBuildContext( buildContextManager, true );
|
SystemBuildContext systemContext = SystemBuildContext.getSystemBuildContext( buildContextManager, true );
|
||||||
|
|
||||||
systemContext.setSystemProperties( request.getProperties() );
|
systemContext.setSystemProperties( request.getProperties() );
|
||||||
systemContext.store( buildContextManager );
|
systemContext.store( buildContextManager );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logErrors( ReactorManager rm,
|
private void logErrors( ReactorManager rm, boolean showErrors )
|
||||||
boolean showErrors )
|
|
||||||
{
|
{
|
||||||
for ( Iterator it = rm.getSortedProjects().iterator(); it.hasNext(); )
|
for ( Iterator it = rm.getSortedProjects().iterator(); it.hasNext(); )
|
||||||
{
|
{
|
||||||
|
@ -214,8 +227,7 @@ public class DefaultMaven
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private MavenExecutionResult doExecute( MavenExecutionRequest request,
|
private MavenExecutionResult doExecute( MavenExecutionRequest request, EventDispatcher dispatcher )
|
||||||
EventDispatcher dispatcher )
|
|
||||||
{
|
{
|
||||||
List executionExceptions = new ArrayList();
|
List executionExceptions = new ArrayList();
|
||||||
|
|
||||||
|
@ -292,7 +304,7 @@ public class DefaultMaven
|
||||||
lifecycleExecutor.execute( session, rm, dispatcher );
|
lifecycleExecutor.execute( session, rm, dispatcher );
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
executionExceptions.add( new BuildFailureException( e.getMessage(), e ) );
|
executionExceptions.add( new BuildFailureException( e.getMessage(), e ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,12 +329,11 @@ public class DefaultMaven
|
||||||
return superProject;
|
return superProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List getProjects( MavenExecutionRequest request,
|
private List getProjects( MavenExecutionRequest request, ProfileManager globalProfileManager )
|
||||||
ProfileManager globalProfileManager )
|
|
||||||
throws MavenExecutionException, BuildFailureException
|
throws MavenExecutionException, BuildFailureException
|
||||||
{
|
{
|
||||||
List projects;
|
List projects;
|
||||||
|
|
||||||
List files;
|
List files;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -332,7 +343,7 @@ public class DefaultMaven
|
||||||
{
|
{
|
||||||
throw new MavenExecutionException( "Error selecting project files for the reactor: " + e.getMessage(), e );
|
throw new MavenExecutionException( "Error selecting project files for the reactor: " + e.getMessage(), e );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: We should probably do this discovery just-in-time, if we can move to building project
|
// TODO: We should probably do this discovery just-in-time, if we can move to building project
|
||||||
// instances just-in-time.
|
// instances just-in-time.
|
||||||
try
|
try
|
||||||
|
@ -343,7 +354,7 @@ public class DefaultMaven
|
||||||
{
|
{
|
||||||
throw new MavenExecutionException( "Error scanning for extensions: " + e.getMessage(), e );
|
throw new MavenExecutionException( "Error scanning for extensions: " + e.getMessage(), e );
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
projects = collectProjects( files, request.getLocalRepository(), request.isRecursive(),
|
projects = collectProjects( files, request.getLocalRepository(), request.isRecursive(),
|
||||||
|
@ -365,15 +376,12 @@ public class DefaultMaven
|
||||||
return projects;
|
return projects;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logReactorSummaryLine( String name,
|
private void logReactorSummaryLine( String name, String status )
|
||||||
String status )
|
|
||||||
{
|
{
|
||||||
logReactorSummaryLine( name, status, -1 );
|
logReactorSummaryLine( name, status, -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logReactorSummaryLine( String name,
|
private void logReactorSummaryLine( String name, String status, long time )
|
||||||
String status,
|
|
||||||
long time )
|
|
||||||
{
|
{
|
||||||
StringBuffer messageBuffer = new StringBuffer();
|
StringBuffer messageBuffer = new StringBuffer();
|
||||||
|
|
||||||
|
@ -422,12 +430,8 @@ public class DefaultMaven
|
||||||
return fmt.format( new Date( time ) );
|
return fmt.format( new Date( time ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private List collectProjects( List files,
|
private List collectProjects( List files, ArtifactRepository localRepository, boolean recursive, Settings settings,
|
||||||
ArtifactRepository localRepository,
|
ProfileManager globalProfileManager, boolean isRoot )
|
||||||
boolean recursive,
|
|
||||||
Settings settings,
|
|
||||||
ProfileManager globalProfileManager,
|
|
||||||
boolean isRoot )
|
|
||||||
throws ArtifactResolutionException, ProjectBuildingException, ProfileActivationException,
|
throws ArtifactResolutionException, ProjectBuildingException, ProfileActivationException,
|
||||||
MavenExecutionException, BuildFailureException
|
MavenExecutionException, BuildFailureException
|
||||||
{
|
{
|
||||||
|
@ -477,7 +481,8 @@ public class DefaultMaven
|
||||||
|
|
||||||
if ( StringUtils.isEmpty( StringUtils.trim( name ) ) )
|
if ( StringUtils.isEmpty( StringUtils.trim( name ) ) )
|
||||||
{
|
{
|
||||||
getLogger().warn( "Empty module detected. Please check you don't have any empty module definitions in your POM." );
|
getLogger().warn(
|
||||||
|
"Empty module detected. Please check you don't have any empty module definitions in your POM." );
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -501,7 +506,7 @@ public class DefaultMaven
|
||||||
{
|
{
|
||||||
throw new MavenExecutionException( "Unable to canonicalize file name " + moduleFile, e );
|
throw new MavenExecutionException( "Unable to canonicalize file name " + moduleFile, e );
|
||||||
}
|
}
|
||||||
|
|
||||||
moduleFiles.add( moduleFile );
|
moduleFiles.add( moduleFile );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,9 +521,7 @@ public class DefaultMaven
|
||||||
return projects;
|
return projects;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenProject getProject( File pom,
|
public MavenProject getProject( File pom, ArtifactRepository localRepository, Settings settings,
|
||||||
ArtifactRepository localRepository,
|
|
||||||
Settings settings,
|
|
||||||
ProfileManager globalProfileManager )
|
ProfileManager globalProfileManager )
|
||||||
throws ProjectBuildingException, ArtifactResolutionException, ProfileActivationException
|
throws ProjectBuildingException, ArtifactResolutionException, ProfileActivationException
|
||||||
{
|
{
|
||||||
|
@ -543,15 +546,14 @@ public class DefaultMaven
|
||||||
// the session type would be specific to the request i.e. having a project
|
// the session type would be specific to the request i.e. having a project
|
||||||
// or not.
|
// or not.
|
||||||
|
|
||||||
protected MavenSession createSession( MavenExecutionRequest request,
|
protected MavenSession createSession( MavenExecutionRequest request, ReactorManager rpm,
|
||||||
ReactorManager rpm,
|
|
||||||
EventDispatcher dispatcher )
|
EventDispatcher dispatcher )
|
||||||
{
|
{
|
||||||
MavenSession session = new MavenSession( container, request, dispatcher, rpm );
|
MavenSession session = new MavenSession( container, request, dispatcher, rpm );
|
||||||
|
|
||||||
SessionContext ctx = new SessionContext( session );
|
SessionContext ctx = new SessionContext( session );
|
||||||
ctx.store( buildContextManager );
|
ctx.store( buildContextManager );
|
||||||
|
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,8 +584,7 @@ public class DefaultMaven
|
||||||
logTrace( error, true );
|
logTrace( error, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void logError( Exception e,
|
protected void logError( Exception e, boolean showErrors )
|
||||||
boolean showErrors )
|
|
||||||
{
|
{
|
||||||
line();
|
line();
|
||||||
|
|
||||||
|
@ -603,8 +604,7 @@ public class DefaultMaven
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void logFailure( BuildFailureException e,
|
protected void logFailure( BuildFailureException e, boolean showErrors )
|
||||||
boolean showErrors )
|
|
||||||
{
|
{
|
||||||
line();
|
line();
|
||||||
|
|
||||||
|
@ -617,8 +617,7 @@ public class DefaultMaven
|
||||||
logTrace( e, showErrors );
|
logTrace( e, showErrors );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logTrace( Throwable t,
|
private void logTrace( Throwable t, boolean showErrors )
|
||||||
boolean showErrors )
|
|
||||||
{
|
{
|
||||||
if ( getLogger().isDebugEnabled() )
|
if ( getLogger().isDebugEnabled() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue