Class DefaultForkConfiguration
- java.lang.Object
-
- org.apache.maven.plugin.surefire.booterclient.ForkConfiguration
-
- org.apache.maven.plugin.surefire.booterclient.DefaultForkConfiguration
-
- Direct Known Subclasses:
AbstractClasspathForkConfiguration
,ModularClasspathForkConfiguration
public abstract class DefaultForkConfiguration extends ForkConfiguration
Basic framework which constructs CLI.- Since:
- 2.21.0.Jigsaw
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
argLine
private Classpath
booterClasspath
private boolean
debug
private java.lang.String
debugLine
private java.util.Map<java.lang.String,java.lang.String>
environmentVariables
private java.lang.String[]
excludedEnvironmentVariables
private int
forkCount
private ConsoleLogger
log
private java.util.Properties
modelProperties
private Platform
pluginPlatform
private boolean
reuseForks
private java.io.File
tempDirectory
private java.io.File
workingDirectory
-
Fields inherited from class org.apache.maven.plugin.surefire.booterclient.ForkConfiguration
DEFAULT_PROVIDER_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultForkConfiguration(Classpath booterClasspath, java.io.File tempDirectory, java.lang.String debugLine, java.io.File workingDirectory, java.util.Properties modelProperties, java.lang.String argLine, java.util.Map<java.lang.String,java.lang.String> environmentVariables, java.lang.String[] excludedEnvironmentVariables, boolean debug, int forkCount, boolean reuseForks, Platform pluginPlatform, ConsoleLogger log)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description OutputStreamFlushableCommandline
createCommandLine(StartupConfiguration config, int forkNumber, java.io.File dumpLogDirectory)
protected java.lang.String
extendJvmArgLine(java.lang.String jvmArgLine)
private static java.lang.String
findStartClass(StartupConfiguration config)
protected java.lang.String
getArgLine()
protected Classpath
getBooterClasspath()
protected java.lang.String
getDebugLine()
protected java.util.Map<java.lang.String,java.lang.String>
getEnvironmentVariables()
protected java.lang.String[]
getExcludedEnvironmentVariables()
protected int
getForkCount()
protected JdkAttributes
getJdkForTests()
protected ConsoleLogger
getLogger()
protected java.util.Properties
getModelProperties()
protected Platform
getPluginPlatform()
java.io.File
getTempDirectory()
protected java.io.File
getWorkingDirectory()
private java.io.File
getWorkingDirectory(int forkNumber)
private java.lang.String
interpolateArgLineWithPropertyExpressions()
Replaces expressionsprotected boolean
isDebug()
protected boolean
isReuseForks()
private java.lang.String
newJvmArgLine(int forks)
protected abstract void
resolveClasspath(OutputStreamFlushableCommandline cli, java.lang.String booterThatHasMainMethod, StartupConfiguration config, java.io.File dumpLogDirectory)
private static java.lang.String
stripNewLines(java.lang.String argLine)
protected java.util.List<java.lang.String>
toCompleteClasspath(StartupConfiguration conf)
private static <K,V>
java.util.Map<K,V>toImmutable(java.util.Map<K,V> map)
Immutable map.
-
-
-
Field Detail
-
booterClasspath
@Nonnull private final Classpath booterClasspath
-
tempDirectory
@Nonnull private final java.io.File tempDirectory
-
debugLine
@Nullable private final java.lang.String debugLine
-
workingDirectory
@Nonnull private final java.io.File workingDirectory
-
modelProperties
@Nonnull private final java.util.Properties modelProperties
-
argLine
@Nullable private final java.lang.String argLine
-
environmentVariables
@Nonnull private final java.util.Map<java.lang.String,java.lang.String> environmentVariables
-
excludedEnvironmentVariables
@Nonnull private final java.lang.String[] excludedEnvironmentVariables
-
debug
private final boolean debug
-
forkCount
private final int forkCount
-
reuseForks
private final boolean reuseForks
-
pluginPlatform
@Nonnull private final Platform pluginPlatform
-
log
@Nonnull private final ConsoleLogger log
-
-
Constructor Detail
-
DefaultForkConfiguration
protected DefaultForkConfiguration(@Nonnull Classpath booterClasspath, @Nonnull java.io.File tempDirectory, @Nullable java.lang.String debugLine, @Nonnull java.io.File workingDirectory, @Nonnull java.util.Properties modelProperties, @Nullable java.lang.String argLine, @Nonnull java.util.Map<java.lang.String,java.lang.String> environmentVariables, @Nonnull java.lang.String[] excludedEnvironmentVariables, boolean debug, int forkCount, boolean reuseForks, @Nonnull Platform pluginPlatform, @Nonnull ConsoleLogger log)
-
-
Method Detail
-
resolveClasspath
protected abstract void resolveClasspath(@Nonnull OutputStreamFlushableCommandline cli, @Nonnull java.lang.String booterThatHasMainMethod, @Nonnull StartupConfiguration config, @Nonnull java.io.File dumpLogDirectory) throws SurefireBooterForkException
- Throws:
SurefireBooterForkException
-
extendJvmArgLine
@Nonnull protected java.lang.String extendJvmArgLine(@Nonnull java.lang.String jvmArgLine)
-
createCommandLine
@Nonnull public OutputStreamFlushableCommandline createCommandLine(@Nonnull StartupConfiguration config, int forkNumber, @Nonnull java.io.File dumpLogDirectory) throws SurefireBooterForkException
- Specified by:
createCommandLine
in classForkConfiguration
- Parameters:
config
- The startup configurationforkNumber
- index of forked JVM, to be the replacement in the argLinedumpLogDirectory
- directory for dump log file- Returns:
- CommandLine able to flush entire command going to be sent to forked JVM
- Throws:
SurefireBooterForkException
- when unable to perform the fork
-
getLogger
protected ConsoleLogger getLogger()
-
toCompleteClasspath
@Nonnull protected java.util.List<java.lang.String> toCompleteClasspath(StartupConfiguration conf) throws SurefireBooterForkException
- Throws:
SurefireBooterForkException
-
getWorkingDirectory
@Nonnull private java.io.File getWorkingDirectory(int forkNumber) throws SurefireBooterForkException
- Throws:
SurefireBooterForkException
-
interpolateArgLineWithPropertyExpressions
@Nonnull private java.lang.String interpolateArgLineWithPropertyExpressions()
Replaces expressions@{property-name}
with the corresponding properties from the model. This allows late evaluation of property values when the plugin is executed (as compared to evaluation when the pom is parsed as is done with${property-name}
expressions). This allows other plugins to modify or set properties with the changes getting picked up by surefire.
-
stripNewLines
@Nonnull private static java.lang.String stripNewLines(@Nonnull java.lang.String argLine)
-
toImmutable
@Nonnull private static <K,V> java.util.Map<K,V> toImmutable(@Nullable java.util.Map<K,V> map)
Immutable map.- Type Parameters:
K
- key typeV
- value type- Parameters:
map
- immutable map copies elements frommap
- Returns:
- never returns null
-
getTempDirectory
@Nonnull public java.io.File getTempDirectory()
- Specified by:
getTempDirectory
in classForkConfiguration
-
getDebugLine
@Nullable protected java.lang.String getDebugLine()
- Specified by:
getDebugLine
in classForkConfiguration
-
getWorkingDirectory
@Nonnull protected java.io.File getWorkingDirectory()
- Specified by:
getWorkingDirectory
in classForkConfiguration
-
getModelProperties
@Nonnull protected java.util.Properties getModelProperties()
- Specified by:
getModelProperties
in classForkConfiguration
-
getArgLine
@Nullable protected java.lang.String getArgLine()
- Specified by:
getArgLine
in classForkConfiguration
-
getEnvironmentVariables
@Nonnull protected java.util.Map<java.lang.String,java.lang.String> getEnvironmentVariables()
- Specified by:
getEnvironmentVariables
in classForkConfiguration
-
getExcludedEnvironmentVariables
@Nonnull protected java.lang.String[] getExcludedEnvironmentVariables()
- Specified by:
getExcludedEnvironmentVariables
in classForkConfiguration
-
isDebug
protected boolean isDebug()
- Specified by:
isDebug
in classForkConfiguration
-
getForkCount
protected int getForkCount()
- Specified by:
getForkCount
in classForkConfiguration
-
isReuseForks
protected boolean isReuseForks()
- Specified by:
isReuseForks
in classForkConfiguration
-
getPluginPlatform
@Nonnull protected Platform getPluginPlatform()
- Specified by:
getPluginPlatform
in classForkConfiguration
-
getJdkForTests
@Nonnull protected JdkAttributes getJdkForTests()
- Specified by:
getJdkForTests
in classForkConfiguration
-
getBooterClasspath
@Nonnull protected Classpath getBooterClasspath()
- Specified by:
getBooterClasspath
in classForkConfiguration
-
newJvmArgLine
@Nonnull private java.lang.String newJvmArgLine(int forks)
-
findStartClass
@Nonnull private static java.lang.String findStartClass(StartupConfiguration config)
-
-