Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -492,32 +492,41 @@ public abstract class AbstractInvokerMojo
* invoker.goals.2 = ${project.groupId}:${project.artifactId}:${project.version}:run
*
* # A comma or space separated list of profiles to activate
* # can be indexed
* invoker.profiles = its,jdk15
*
* # The path to an alternative POM or base directory to invoke Maven on, defaults to the
* # project that was originally specified in the plugin configuration
* # Since plugin version 1.4
* # can be indexed
* invoker.project = sub-module
*
* # The value for the environment variable MAVEN_OPTS
* # can be indexed
* invoker.mavenOpts = -Dfile.encoding=UTF-16 -Xms32m -Xmx256m
*
* # Possible values are "fail-fast" (default), "fail-at-end" and "fail-never"
* # can be indexed
* invoker.failureBehavior = fail-never
*
* # The expected result of the build, possible values are "success" (default) and "failure"
* # can be indexed
* invoker.buildResult = failure
*
* # A boolean value controlling the aggregator mode of Maven, defaults to "false"
*
* # can be indexed
* invoker.nonRecursive = true
*
* # A boolean value controlling the network behavior of Maven, defaults to "false"
* # Since plugin version 1.4
* # can be indexed
* invoker.offline = true
*
* # The path to the properties file from which to load system properties, defaults to the
* # filename given by the plugin parameter testPropertiesFile
* # Since plugin version 1.4
* # can be indexed
* invoker.systemPropertiesFile = test.properties
*
* # An optional human friendly name for this build job to be included in the build reports.
Expand Down Expand Up @@ -556,10 +565,17 @@ public abstract class AbstractInvokerMojo
*
* # A boolean value controlling the debug logging level of Maven, , defaults to "false"
* # Since plugin version 1.8
* # can be indexed
* invoker.debug = true
*
* The execution timeout in seconds.
* # Since plugin version 3.0.2
* # can be indexed
* invoker.timeoutInSeconds = 5
*
* # Path to an alternate settings.xml to use for Maven invocation with this IT.
* # Since plugin version 3.0.1
* # can be indexed
* invoker.settingsFile = ../
*
* # An integer value to control run order of projects. sorted in the descending order of the ordinal.
Expand Down Expand Up @@ -1981,67 +1997,35 @@ private boolean runBuild( File basedir, File pomFile, File settingsFile, File ac
throw new RunFailureException( BuildJob.Result.FAILURE_PRE_HOOK, e );
}

final InvocationRequest request = new DefaultInvocationRequest();

request.setLocalRepositoryDirectory( localRepositoryPath );

request.setBatchMode( true );

request.setShowErrors( showErrors );

request.setDebug( debug );

request.setShowVersion( showVersion );

setupLoggerForBuildJob( logger, request );

if ( mavenHome != null )
{
invoker.setMavenHome( mavenHome );
// FIXME: Should we really take care of M2_HOME?
request.addShellEnvironment( "M2_HOME", mavenHome.getAbsolutePath() );
}
// TODO - move to request
invoker.setMavenHome( mavenHome );

if ( mavenExecutable != null )
{
invoker.setMavenExecutable( new File( mavenExecutable ) );
}

if ( actualJavaHome != null )
{
request.setJavaHome( actualJavaHome );
}

if ( environmentVariables != null )
{
for ( Map.Entry<String, String> variable : environmentVariables.entrySet() )
{
request.addShellEnvironment( variable.getKey(), variable.getValue() );
}
}

for ( int invocationIndex = 1;; invocationIndex++ )
{
if ( invocationIndex > 1 && !invokerProperties.isInvocationDefined( invocationIndex ) )
{
break;
}

request.setBaseDirectory( basedir );

request.setPomFile( pomFile );

request.setGoals( goals );
final InvocationRequest request = new DefaultInvocationRequest();

request.setProfiles( profiles );
request.setBatchMode( true );

request.setMavenOpts( mavenOpts );
// values only from Mojo configurations
request.setLocalRepositoryDirectory( localRepositoryPath );
request.setShowErrors( showErrors );
request.setShowVersion( showVersion );
request.setJavaHome( actualJavaHome );

request.setOffline( false );
setupLoggerForBuildJob( logger, request );

int timeOut = invokerProperties.getTimeoutInSeconds( invocationIndex );
// not set so we use the one at the mojo level
request.setTimeoutInSeconds( timeOut < 0 ? timeoutInSeconds : timeOut );
request.setBaseDirectory( basedir );
request.setPomFile( pomFile );

String customSettingsFile = invokerProperties.getSettingsFile( invocationIndex );
if ( customSettingsFile != null )
Expand Down Expand Up @@ -2137,7 +2121,6 @@ private void setupLoggerForBuildJob( final FileLogger logger, final InvocationRe
if ( logger != null )
{
request.setErrorHandler( logger );

request.setOutputHandler( logger );
}
}
Expand Down Expand Up @@ -2639,7 +2622,19 @@ private InvokerProperties getInvokerProperties( final File projectDirectory, Pro
}
props.setProperty( key, value );
}
return new InvokerProperties( props );

InvokerProperties invokerProperties = new InvokerProperties( props );

// set default value for Invoker - it will be used if not present in properties
invokerProperties.setDefaultDebug( debug );
invokerProperties.setDefaultGoals( goals );
invokerProperties.setDefaultProfiles( profiles );
invokerProperties.setDefaultMavenOpts( mavenOpts );
invokerProperties.setDefaultTimeoutInSeconds( timeoutInSeconds );
invokerProperties.setDefaultEnvironmentVariables( environmentVariables );


return invokerProperties;
}

static class ToolchainPrivateManager
Expand Down
Loading