Package org.springframework.boot.maven
Class AbstractRunMojo
- java.lang.Object
- org.apache.maven.plugin.AbstractMojo
- org.springframework.boot.maven.AbstractDependencyFilterMojo
- org.springframework.boot.maven.AbstractRunMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo
Base class to run a spring application.
Constructor Summary
Constructors Constructor Description AbstractRunMojo()
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
enableForkByDefault()
Specify if fork should be enabled by default.void
execute()
protected URL[]
getClassPathUrls()
protected boolean
isFork()
Specify if the application process should be forked.protected void
logDisabledFork()
Log a warning indicating that fork mode has been explicitly disabled while some conditions are present that require to enable it.protected org.springframework.boot.maven.RunArguments
resolveApplicationArguments()
Resolve the application arguments to use.protected org.springframework.boot.maven.EnvVariables
resolveEnvVariables()
Resolve the environment variables to use.protected org.springframework.boot.maven.RunArguments
resolveJvmArguments()
Resolve the JVM arguments to use.protected abstract void
runWithForkedJvm(File workingDirectory, List<String> args, Map<String,String> environmentVariables)
Run with a forked VM, using the specified command line arguments.protected abstract void
runWithMavenJvm(String startClassName, String... arguments)
Run with the current VM, using the specified arguments.Methods inherited from class org.springframework.boot.maven.AbstractDependencyFilterMojo
filterDependencies, getFilters, setExcludeGroupIds, setExcludes, setIncludes
Constructor Detail
AbstractRunMojo
public AbstractRunMojo()
Method Detail
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
isFork
protected boolean isFork()
Specify if the application process should be forked.- Returns:
true
if the application process should be forked
enableForkByDefault
protected boolean enableForkByDefault()
Specify if fork should be enabled by default.- Returns:
true
if fork should be enabled by default- See Also:
logDisabledFork()
logDisabledFork
protected void logDisabledFork()
Log a warning indicating that fork mode has been explicitly disabled while some conditions are present that require to enable it.- See Also:
enableForkByDefault()
runWithForkedJvm
protected abstract void runWithForkedJvm(File workingDirectory, List<String> args, Map<String,String> environmentVariables) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
Run with a forked VM, using the specified command line arguments.- 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
runWithMavenJvm
protected abstract void runWithMavenJvm(String startClassName, String... arguments) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
Run with the current VM, using the specified arguments.- Parameters:
startClassName
- the class to runarguments
- the class arguments- 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()
Resolve the application arguments to use.- Returns:
- a
RunArguments
defining the application arguments
resolveEnvVariables
protected org.springframework.boot.maven.EnvVariables resolveEnvVariables()
Resolve the environment variables to use.- Returns:
- an
EnvVariables
defining the environment variables
resolveJvmArguments
protected org.springframework.boot.maven.RunArguments resolveJvmArguments()
Resolve the JVM arguments to use.- Returns:
- a
RunArguments
defining the JVM arguments
getClassPathUrls
protected URL[] getClassPathUrls() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException