mirror of https://github.com/apache/maven.git
some formatting
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@583515 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dc6e7c8368
commit
957a77435a
|
@ -191,164 +191,164 @@ else if ( commandLine.hasOption( CLIManager.SUPPRESS_PLUGIN_UPDATES ) )
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
List goals = commandLine.getArgList();
|
List goals = commandLine.getArgList();
|
||||||
|
|
||||||
boolean recursive = true;
|
boolean recursive = true;
|
||||||
|
|
||||||
// this is the default behavior.
|
// this is the default behavior.
|
||||||
String reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_FAST;
|
String reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_FAST;
|
||||||
|
|
||||||
if ( commandLine.hasOption( CLIManager.NON_RECURSIVE ) )
|
if ( commandLine.hasOption( CLIManager.NON_RECURSIVE ) )
|
||||||
|
{
|
||||||
|
recursive = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( commandLine.hasOption( CLIManager.FAIL_FAST ) )
|
||||||
|
{
|
||||||
|
reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_FAST;
|
||||||
|
}
|
||||||
|
else if ( commandLine.hasOption( CLIManager.FAIL_AT_END ) )
|
||||||
|
{
|
||||||
|
reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_AT_END;
|
||||||
|
}
|
||||||
|
else if ( commandLine.hasOption( CLIManager.FAIL_NEVER ) )
|
||||||
|
{
|
||||||
|
reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_NEVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean offline = false;
|
||||||
|
|
||||||
|
if ( commandLine.hasOption( CLIManager.OFFLINE ) )
|
||||||
|
{
|
||||||
|
offline = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean updateSnapshots = false;
|
||||||
|
|
||||||
|
if ( commandLine.hasOption( CLIManager.UPDATE_SNAPSHOTS ) )
|
||||||
|
{
|
||||||
|
updateSnapshots = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String globalChecksumPolicy = null;
|
||||||
|
|
||||||
|
if ( commandLine.hasOption( CLIManager.CHECKSUM_FAILURE_POLICY ) )
|
||||||
|
{
|
||||||
|
// todo; log
|
||||||
|
System.out.println( "+ Enabling strict checksum verification on all artifact downloads." );
|
||||||
|
|
||||||
|
globalChecksumPolicy = MavenExecutionRequest.CHECKSUM_POLICY_FAIL;
|
||||||
|
}
|
||||||
|
else if ( commandLine.hasOption( CLIManager.CHECKSUM_WARNING_POLICY ) )
|
||||||
|
{
|
||||||
|
// todo: log
|
||||||
|
System.out.println( "+ Disabling strict checksum verification on all artifact downloads." );
|
||||||
|
|
||||||
|
globalChecksumPolicy = MavenExecutionRequest.CHECKSUM_POLICY_WARN;
|
||||||
|
}
|
||||||
|
|
||||||
|
File baseDirectory = new File( System.getProperty( "user.dir" ) );
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Profile Activation
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
List activeProfiles = new ArrayList();
|
||||||
|
|
||||||
|
List inactiveProfiles = new ArrayList();
|
||||||
|
|
||||||
|
if ( commandLine.hasOption( CLIManager.ACTIVATE_PROFILES ) )
|
||||||
|
{
|
||||||
|
String profilesLine = commandLine.getOptionValue( CLIManager.ACTIVATE_PROFILES );
|
||||||
|
|
||||||
|
StringTokenizer profileTokens = new StringTokenizer( profilesLine, "," );
|
||||||
|
|
||||||
|
while ( profileTokens.hasMoreTokens() )
|
||||||
{
|
{
|
||||||
recursive = false;
|
String profileAction = profileTokens.nextToken().trim();
|
||||||
}
|
|
||||||
|
|
||||||
if ( commandLine.hasOption( CLIManager.FAIL_FAST ) )
|
if ( profileAction.startsWith( "-" ) )
|
||||||
{
|
|
||||||
reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_FAST;
|
|
||||||
}
|
|
||||||
else if ( commandLine.hasOption( CLIManager.FAIL_AT_END ) )
|
|
||||||
{
|
|
||||||
reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_AT_END;
|
|
||||||
}
|
|
||||||
else if ( commandLine.hasOption( CLIManager.FAIL_NEVER ) )
|
|
||||||
{
|
|
||||||
reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_NEVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean offline = false;
|
|
||||||
|
|
||||||
if ( commandLine.hasOption( CLIManager.OFFLINE ) )
|
|
||||||
{
|
|
||||||
offline = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean updateSnapshots = false;
|
|
||||||
|
|
||||||
if ( commandLine.hasOption( CLIManager.UPDATE_SNAPSHOTS ) )
|
|
||||||
{
|
|
||||||
updateSnapshots = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
String globalChecksumPolicy = null;
|
|
||||||
|
|
||||||
if ( commandLine.hasOption( CLIManager.CHECKSUM_FAILURE_POLICY ) )
|
|
||||||
{
|
|
||||||
// todo; log
|
|
||||||
System.out.println( "+ Enabling strict checksum verification on all artifact downloads." );
|
|
||||||
|
|
||||||
globalChecksumPolicy = MavenExecutionRequest.CHECKSUM_POLICY_FAIL;
|
|
||||||
}
|
|
||||||
else if ( commandLine.hasOption( CLIManager.CHECKSUM_WARNING_POLICY ) )
|
|
||||||
{
|
|
||||||
// todo: log
|
|
||||||
System.out.println( "+ Disabling strict checksum verification on all artifact downloads." );
|
|
||||||
|
|
||||||
globalChecksumPolicy = MavenExecutionRequest.CHECKSUM_POLICY_WARN;
|
|
||||||
}
|
|
||||||
|
|
||||||
File baseDirectory = new File( System.getProperty( "user.dir" ) );
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// Profile Activation
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
List activeProfiles = new ArrayList();
|
|
||||||
|
|
||||||
List inactiveProfiles = new ArrayList();
|
|
||||||
|
|
||||||
if ( commandLine.hasOption( CLIManager.ACTIVATE_PROFILES ) )
|
|
||||||
{
|
|
||||||
String profilesLine = commandLine.getOptionValue( CLIManager.ACTIVATE_PROFILES );
|
|
||||||
|
|
||||||
StringTokenizer profileTokens = new StringTokenizer( profilesLine, "," );
|
|
||||||
|
|
||||||
while ( profileTokens.hasMoreTokens() )
|
|
||||||
{
|
{
|
||||||
String profileAction = profileTokens.nextToken().trim();
|
activeProfiles.add( profileAction.substring( 1 ) );
|
||||||
|
}
|
||||||
if ( profileAction.startsWith( "-" ) )
|
else if ( profileAction.startsWith( "+" ) )
|
||||||
{
|
{
|
||||||
activeProfiles.add( profileAction.substring( 1 ) );
|
inactiveProfiles.add( profileAction.substring( 1 ) );
|
||||||
}
|
}
|
||||||
else if ( profileAction.startsWith( "+" ) )
|
else
|
||||||
{
|
{
|
||||||
inactiveProfiles.add( profileAction.substring( 1 ) );
|
// TODO: deprecate this eventually!
|
||||||
}
|
activeProfiles.add( profileAction );
|
||||||
else
|
|
||||||
{
|
|
||||||
// TODO: deprecate this eventually!
|
|
||||||
activeProfiles.add( profileAction );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MavenTransferListener transferListener;
|
MavenTransferListener transferListener;
|
||||||
|
|
||||||
if ( interactive )
|
if ( interactive )
|
||||||
{
|
{
|
||||||
transferListener = new ConsoleDownloadMonitor();
|
transferListener = new ConsoleDownloadMonitor();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
transferListener = new BatchModeDownloadMonitor();
|
transferListener = new BatchModeDownloadMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
transferListener.setShowChecksumEvents( false );
|
transferListener.setShowChecksumEvents( false );
|
||||||
|
|
||||||
// This means to scan a directory structure for POMs and process them.
|
// This means to scan a directory structure for POMs and process them.
|
||||||
boolean useReactor = false;
|
boolean useReactor = false;
|
||||||
|
|
||||||
if ( commandLine.hasOption( CLIManager.REACTOR ) )
|
if ( commandLine.hasOption( CLIManager.REACTOR ) )
|
||||||
{
|
{
|
||||||
useReactor = true;
|
useReactor = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String alternatePomFile = null;
|
String alternatePomFile = null;
|
||||||
if ( commandLine.hasOption( CLIManager.ALTERNATE_POM_FILE ) )
|
if ( commandLine.hasOption( CLIManager.ALTERNATE_POM_FILE ) )
|
||||||
{
|
{
|
||||||
alternatePomFile = commandLine.getOptionValue( CLIManager.ALTERNATE_POM_FILE );
|
alternatePomFile = commandLine.getOptionValue( CLIManager.ALTERNATE_POM_FILE );
|
||||||
}
|
}
|
||||||
|
|
||||||
int loggingLevel;
|
int loggingLevel;
|
||||||
|
|
||||||
if ( debug )
|
if ( debug )
|
||||||
{
|
{
|
||||||
loggingLevel = MavenExecutionRequest.LOGGING_LEVEL_DEBUG;
|
loggingLevel = MavenExecutionRequest.LOGGING_LEVEL_DEBUG;
|
||||||
}
|
}
|
||||||
else if ( quiet )
|
else if ( quiet )
|
||||||
{
|
{
|
||||||
// TODO: we need to do some more work here. Some plugins use sys out or log errors at info level.
|
// TODO: we need to do some more work here. Some plugins use sys out or log errors at info level.
|
||||||
// Ideally, we could use Warn across the board
|
// Ideally, we could use Warn across the board
|
||||||
loggingLevel = MavenExecutionRequest.LOGGING_LEVEL_ERROR;
|
loggingLevel = MavenExecutionRequest.LOGGING_LEVEL_ERROR;
|
||||||
// TODO:Additionally, we can't change the mojo level because the component key includes the version and it isn't known ahead of time. This seems worth changing.
|
// TODO:Additionally, we can't change the mojo level because the component key includes the version and it isn't known ahead of time. This seems worth changing.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
loggingLevel = MavenExecutionRequest.LOGGING_LEVEL_INFO;
|
loggingLevel = MavenExecutionRequest.LOGGING_LEVEL_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
Properties executionProperties = getExecutionProperties( commandLine );
|
Properties executionProperties = getExecutionProperties( commandLine );
|
||||||
|
|
||||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest()
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest()
|
||||||
.setBaseDirectory( baseDirectory )
|
.setBaseDirectory( baseDirectory )
|
||||||
.setGoals( goals )
|
.setGoals( goals )
|
||||||
.setProperties( executionProperties ) // optional
|
.setProperties( executionProperties ) // optional
|
||||||
.setReactorFailureBehavior( reactorFailureBehaviour ) // default: fail fast
|
.setReactorFailureBehavior( reactorFailureBehaviour ) // default: fail fast
|
||||||
.setRecursive( recursive ) // default: true
|
.setRecursive( recursive ) // default: true
|
||||||
.setUseReactor( useReactor ) // default: false
|
.setUseReactor( useReactor ) // default: false
|
||||||
.setPomFile( alternatePomFile ) // optional
|
.setPomFile( alternatePomFile ) // optional
|
||||||
.setShowErrors( showErrors ) // default: false
|
.setShowErrors( showErrors ) // default: false
|
||||||
.setInteractiveMode( interactive ) // default: false
|
.setInteractiveMode( interactive ) // default: false
|
||||||
.setOffline( offline ) // default: false
|
.setOffline( offline ) // default: false
|
||||||
.setUsePluginUpdateOverride( pluginUpdateOverride )
|
.setUsePluginUpdateOverride( pluginUpdateOverride )
|
||||||
.addActiveProfiles( activeProfiles ) // optional
|
.addActiveProfiles( activeProfiles ) // optional
|
||||||
.addInactiveProfiles( inactiveProfiles ) // optional
|
.addInactiveProfiles( inactiveProfiles ) // optional
|
||||||
.setLoggingLevel( loggingLevel ) // default: info
|
.setLoggingLevel( loggingLevel ) // default: info
|
||||||
.setTransferListener( transferListener ) // default: batch mode which goes along with interactive
|
.setTransferListener( transferListener ) // default: batch mode which goes along with interactive
|
||||||
.setUpdateSnapshots( updateSnapshots ) // default: false
|
.setUpdateSnapshots( updateSnapshots ) // default: false
|
||||||
.setNoSnapshotUpdates( noSnapshotUpdates ) // default: false
|
.setNoSnapshotUpdates( noSnapshotUpdates ) // default: false
|
||||||
.setGlobalChecksumPolicy( globalChecksumPolicy ); // default: warn
|
.setGlobalChecksumPolicy( globalChecksumPolicy ); // default: warn
|
||||||
|
|
||||||
File userSettingsFile;
|
File userSettingsFile;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue