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
Modifier and TypeFieldDescriptionprotected File
Directory containing the classes and resource files that should be packaged into the archive.protected org.apache.maven.project.MavenProject
The Maven project.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
addClasspath
(List<String> args) protected void
addDependencies
(List<URL> urls, org.apache.maven.shared.artifact.filter.collection.FilterArtifacts filters) protected void
addJvmArgs
(List<String> args) protected void
addProjectClasses
(List<URL> urls) protected void
addUserDefinedDirectories
(List<URL> urls) void
execute()
protected abstract URL[]
protected String
Provides access to the java binary executable, regardless of OS.protected String
protected boolean
hasTerminatedSuccessfully
(int exitCode) Specify if the forked process has terminated successfully, based on its exit code.protected org.springframework.boot.maven.RunArguments
Resolve the application arguments to use.protected org.springframework.boot.maven.EnvVariables
Resolve the environment variables to use.protected org.springframework.boot.maven.RunArguments
Resolve the JVM arguments to use.protected abstract void
Run with a forked VM, using the specified class name.Methods inherited from class org.springframework.boot.maven.AbstractDependencyFilterMojo
filterDependencies, getFilters, setExcludeGroupIds, setExcludes, setIncludes
Methods 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.MojoExecutionException
org.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:
true
if the process has terminated successfully
-
resolveApplicationArguments
protected org.springframework.boot.maven.RunArguments resolveApplicationArguments()Resolve the application arguments to use.- Returns:
- a
RunArguments
defining 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
EnvVariables
defining the environment variables
-
addArgs
-
resolveJvmArguments
protected org.springframework.boot.maven.RunArguments resolveJvmArguments()Resolve the JVM arguments to use.- Returns:
- a
RunArguments
defining 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
-