surefireBooterArtifact.isSnapshot(); // MNG-2961: before Maven 2.0.8, fixes getBaseVersion to be -SNAPSHOT if needed
final Classpath bootClasspathConfiguration =
getArtifactClasspath( shadeFire != null ? shadeFire : surefireBooterArtifact );
ForkConfiguration fork = new ForkConfiguration( bootClasspathConfiguration, getForkMode(), tmpDir );
fork.setTempDirectory( tmpDir );
processSystemProperties( !fork.isForking() );
verifyLegalSystemProperties();
if ( getLog().isDebugEnabled() )
{
showMap( getInternalSystemProperties(), "system property" );
}
Toolchain tc = getToolchain();
if ( tc != null )
{
getLog().info( "Toolchain in " + getPluginName() + "-plugin: " + tc );
if ( isForkModeNever() )
{
setForkMode( ForkConfiguration.FORK_ONCE );
}
if ( getJvm() != null )
{
getLog().warn( "Toolchains are ignored, 'executable' parameter is set to " + getJvm() );
}
else
{
setJvm( tc.findTool( "java" ) ); //NOI18N
}
}
if ( fork.isForking() )
{
setUseSystemClassLoader( isUseSystemClassLoader() );
fork.setSystemProperties( getInternalSystemProperties() );
if ( "true".equals( getDebugForkedProcess() ) )
{
setDebugForkedProcess(
"-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" );
}
fork.setDebugLine( getDebugForkedProcess() );
if ( ( getJvm() == null || "".equals( getJvm() ) ) )
{
// use the same JVM as the one used to run Maven (the "java.home" one)
setJvm( System.getProperty( "java.home" ) + File.separator + "bin" + File.separator + "java" );
getLog().debug( "Using JVM: " + getJvm() );
}
fork.setJvmExecutable( getJvm() );
if ( getWorkingDirectory() != null )
{
fork.setWorkingDirectory( getWorkingDirectory() );
}
else
{
fork.setWorkingDirectory( getBasedir() );
}
fork.setArgLine( getArgLine() );
fork.setEnvironmentVariables( getEnvironmentVariables() );
if ( getLog().isDebugEnabled() )
{
showMap( getEnvironmentVariables(), "environment variable" );
fork.setDebug( true );
}
if ( getArgLine() != null )
{
List<String> args = Arrays.asList( getArgLine().split( " " ) );
if ( args.contains( "-da" ) || args.contains( "-disableassertions" ) )
{
setEnableAssertions( false );
}
}
if ( fork.getForkMode().equals( ForkConfiguration.FORK_PERTHREAD ) )
{
fork.setThreadCount( getThreadCount() );
}
else
{
fork.setThreadCount( 1 );
}
}
return fork;
}