Package org.springframework.boot.maven
Class StartMojo
- java.lang.Object
- org.apache.maven.plugin.AbstractMojo
- org.springframework.boot.maven.AbstractDependencyFilterMojo
- org.springframework.boot.maven.AbstractRunMojo
- org.springframework.boot.maven.StartMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="start", requiresProject=true, defaultPhase=PRE_INTEGRATION_TEST, requiresDependencyResolution=TEST) public class StartMojo extends AbstractRunMojoStart a spring application. Contrary to therungoal, this does not block and allows other goal to operate on the application. This goal is typically used in integration test scenario where the application is started before a test suite and stopped after.- Since:
- 1.3.0
- See Also:
StopMojo
Constructor Summary
Constructors Constructor Description StartMojo()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Texecute(long wait, int maxAttempts, Callable<T> callback)Execute a task, retrying it on failure.protected org.springframework.boot.maven.RunArgumentsresolveApplicationArguments()Resolve the application arguments to use.protected org.springframework.boot.maven.RunArgumentsresolveJvmArguments()Resolve the JVM arguments to use.protected voidrunWithForkedJvm(File workingDirectory, List<String> args, Map<String,String> environmentVariables)Run with a forked VM, using the specified command line arguments.protected voidrunWithMavenJvm(String startClassName, String... arguments)Run with the current VM, using the specified arguments.Methods inherited from class org.springframework.boot.maven.AbstractRunMojo
enableForkByDefault, execute, getClassPathUrls, isFork, logDisabledFork, resolveEnvVariables
Methods inherited from class org.springframework.boot.maven.AbstractDependencyFilterMojo
filterDependencies, getFilters, setExcludeGroupIds, setExcludes, setIncludes
Constructor Detail
StartMojo
public StartMojo()
Method Detail
runWithForkedJvm
protected void runWithForkedJvm(File workingDirectory, List<String> args, Map<String,String> environmentVariables) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
Description copied from class:AbstractRunMojoRun with a forked VM, using the specified command line arguments.- Specified by:
runWithForkedJvmin classAbstractRunMojo- Parameters:
workingDirectory- the working directory of the forked JVMargs- the arguments (JVM arguments and application arguments)environmentVariables- the environment variables- Throws:
org.apache.maven.plugin.MojoExecutionException- in case of MOJO execution errorsorg.apache.maven.plugin.MojoFailureException- in case of MOJO failures
resolveApplicationArguments
protected org.springframework.boot.maven.RunArguments resolveApplicationArguments()
Description copied from class:AbstractRunMojoResolve the application arguments to use.- Overrides:
resolveApplicationArgumentsin classAbstractRunMojo- Returns:
- a
RunArgumentsdefining the application arguments
resolveJvmArguments
protected org.springframework.boot.maven.RunArguments resolveJvmArguments()
Description copied from class:AbstractRunMojoResolve the JVM arguments to use.- Overrides:
resolveJvmArgumentsin classAbstractRunMojo- Returns:
- a
RunArgumentsdefining the JVM arguments
runWithMavenJvm
protected void runWithMavenJvm(String startClassName, String... arguments) throws org.apache.maven.plugin.MojoExecutionException
Description copied from class:AbstractRunMojoRun with the current VM, using the specified arguments.- Specified by:
runWithMavenJvmin classAbstractRunMojo- Parameters:
startClassName- the class to runarguments- the class arguments- Throws:
org.apache.maven.plugin.MojoExecutionException- in case of MOJO execution errors
execute
public <T> T execute(long wait, int maxAttempts, Callable<T> callback) throws Exception
Execute a task, retrying it on failure.- Type Parameters:
T- the result type- Parameters:
wait- the wait timemaxAttempts- the maximum number of attemptscallback- the task to execute (possibly multiple times). The callback should returnnullto indicate that another attempt should be made- Returns:
- the result
- Throws:
Exception- in case of execution errors