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
- Direct Known Subclasses:
AbstractApplicationRunMojo,AotGenerateMojo
Base class to support running a process that deals with a Spring application.
- Since:
- 1.3.0
- Author:
- Phillip Webb, Stephane Nicoll, David Liu, Daniel Young, Dmytro Nosan
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FileDirectory containing the classes and resource files that should be packaged into the archive.protected org.apache.maven.project.MavenProjectThe Maven project.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidaddClasspath(List<String> args) protected voidaddDependencies(List<URL> urls, org.apache.maven.shared.artifact.filter.collection.FilterArtifacts filters) protected voidaddJvmArgs(List<String> args) protected voidaddProjectClasses(List<URL> urls) protected voidaddUserDefinedDirectories(List<URL> urls) voidexecute()protected abstract URL[]protected StringProvides access to the java binary executable, regardless of OS.protected Stringprotected booleanhasTerminatedSuccessfully(int exitCode) Specify if the forked process has terminated successfully, based on its exit code.protected org.springframework.boot.maven.RunArgumentsResolve the application arguments to use.protected org.springframework.boot.maven.EnvVariablesResolve the environment variables to use.protected org.springframework.boot.maven.RunArgumentsResolve the JVM arguments to use.protected abstract voidRun with a forked VM, using the specified class name.Methods inherited from class org.springframework.boot.maven.AbstractDependencyFilterMojo
filterDependencies, getFilters, setExcludeGroupIds, setExcludes, setIncludesMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
project
@Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject projectThe Maven project.- Since:
- 1.0.0
-
classesDirectory
@Parameter(defaultValue="${project.build.outputDirectory}", required=true) protected File classesDirectoryDirectory containing the classes and resource files that should be packaged into the archive.- Since:
- 1.0.0
-
-
Constructor Details
-
AbstractRunMojo
public AbstractRunMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
run
protected abstract void run(File workingDirectory, String startClassName, Map<String, String> environmentVariables) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureExceptionRun with a forked VM, using the specified class name.- Parameters:
workingDirectory- the working directory of the forked JVMstartClassName- the name of the class to executeenvironmentVariables- the environment variables- Throws:
org.apache.maven.plugin.MojoExecutionException- in case of MOJO execution errorsorg.apache.maven.plugin.MojoFailureException- in case of MOJO failures
-
hasTerminatedSuccessfully
protected boolean hasTerminatedSuccessfully(int exitCode) Specify if the forked process has terminated successfully, based on its exit code.- Parameters:
exitCode- the exit code of the process- Returns:
trueif the process has terminated successfully
-
resolveApplicationArguments
protected org.springframework.boot.maven.RunArguments resolveApplicationArguments()Resolve the application arguments to use.- Returns:
- a
RunArgumentsdefining the application arguments
-
getJavaExecutable
Provides access to the java binary executable, regardless of OS.- Returns:
- the java executable
-
resolveEnvVariables
protected org.springframework.boot.maven.EnvVariables resolveEnvVariables()Resolve the environment variables to use.- Returns:
- an
EnvVariablesdefining the environment variables
-
addArgs
-
resolveJvmArguments
protected org.springframework.boot.maven.RunArguments resolveJvmArguments()Resolve the JVM arguments to use.- Returns:
- a
RunArgumentsdefining the JVM arguments
-
addJvmArgs
-
addClasspath
protected void addClasspath(List<String> args) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getStartClass
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getClassPathUrls
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
addUserDefinedDirectories
- Throws:
MalformedURLException
-
addProjectClasses
- Throws:
MalformedURLException
-