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.StringargLineprivate ClasspathbooterClasspathprivate booleandebugprivate java.lang.StringdebugLineprivate java.util.Map<java.lang.String,java.lang.String>environmentVariablesprivate intforkCountprivate ConsoleLoggerlogprivate java.util.PropertiesmodelPropertiesprivate PlatformpluginPlatformprivate booleanreuseForksprivate java.io.FiletempDirectoryprivate java.io.FileworkingDirectory-
Fields inherited from class org.apache.maven.plugin.surefire.booterclient.ForkConfiguration
DEFAULT_PROVIDER_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultForkConfiguration(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, 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 OutputStreamFlushableCommandlinecreateCommandLine(StartupConfiguration config, int forkNumber, java.io.File dumpLogDirectory)protected java.lang.StringextendJvmArgLine(java.lang.String jvmArgLine)private static java.lang.StringfindStartClass(StartupConfiguration config)protected java.lang.StringgetArgLine()protected ClasspathgetBooterClasspath()protected java.lang.StringgetDebugLine()protected java.util.Map<java.lang.String,java.lang.String>getEnvironmentVariables()protected intgetForkCount()protected JdkAttributesgetJdkForTests()protected ConsoleLoggergetLogger()protected java.util.PropertiesgetModelProperties()protected PlatformgetPluginPlatform()java.io.FilegetTempDirectory()protected java.io.FilegetWorkingDirectory()private java.io.FilegetWorkingDirectory(int forkNumber)private java.lang.StringinterpolateArgLineWithPropertyExpressions()Replaces expressionsprotected booleanisDebug()protected booleanisReuseForks()private java.lang.StringnewJvmArgLine(int forks)protected abstract voidresolveClasspath(OutputStreamFlushableCommandline cli, java.lang.String booterThatHasMainMethod, StartupConfiguration config, java.io.File dumpLogDirectory)private static java.lang.StringstripNewLines(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
-
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, 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:
createCommandLinein 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:
getTempDirectoryin classForkConfiguration
-
getDebugLine
@Nullable protected java.lang.String getDebugLine()
- Specified by:
getDebugLinein classForkConfiguration
-
getWorkingDirectory
@Nonnull protected java.io.File getWorkingDirectory()
- Specified by:
getWorkingDirectoryin classForkConfiguration
-
getModelProperties
@Nonnull protected java.util.Properties getModelProperties()
- Specified by:
getModelPropertiesin classForkConfiguration
-
getArgLine
@Nullable protected java.lang.String getArgLine()
- Specified by:
getArgLinein classForkConfiguration
-
getEnvironmentVariables
@Nonnull protected java.util.Map<java.lang.String,java.lang.String> getEnvironmentVariables()
- Specified by:
getEnvironmentVariablesin classForkConfiguration
-
isDebug
protected boolean isDebug()
- Specified by:
isDebugin classForkConfiguration
-
getForkCount
protected int getForkCount()
- Specified by:
getForkCountin classForkConfiguration
-
isReuseForks
protected boolean isReuseForks()
- Specified by:
isReuseForksin classForkConfiguration
-
getPluginPlatform
@Nonnull protected Platform getPluginPlatform()
- Specified by:
getPluginPlatformin classForkConfiguration
-
getJdkForTests
@Nonnull protected JdkAttributes getJdkForTests()
- Specified by:
getJdkForTestsin classForkConfiguration
-
getBooterClasspath
@Nonnull protected Classpath getBooterClasspath()
- Specified by:
getBooterClasspathin classForkConfiguration
-
newJvmArgLine
@Nonnull private java.lang.String newJvmArgLine(int forks)
-
findStartClass
@Nonnull private static java.lang.String findStartClass(StartupConfiguration config)
-
-