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

public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo
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 Details

    • project

      @Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject project
      The Maven project.
      Since:
      1.0.0
    • classesDirectory

      @Parameter(defaultValue="${project.build.outputDirectory}", required=true) protected File classesDirectory
      Directory 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.MojoFailureException
      Run with a forked VM, using the specified class name.
      Parameters:
      workingDirectory - the working directory of the forked JVM
      startClassName - the name of the class to execute
      environmentVariables - the environment variables
      Throws:
      org.apache.maven.plugin.MojoExecutionException - in case of MOJO execution errors
      org.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

      protected String 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

      protected void addArgs(List<String> args)
    • resolveJvmArguments

      protected org.springframework.boot.maven.RunArguments resolveJvmArguments()
      Resolve the JVM arguments to use.
      Returns:
      a RunArguments defining the JVM arguments
    • addJvmArgs

      protected void addJvmArgs(List<String> args)
    • addClasspath

      protected void addClasspath(List<String> args) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getStartClass

      protected String getStartClass() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getClassPathUrls

      protected abstract URL[] getClassPathUrls() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • addUserDefinedDirectories

      protected void addUserDefinedDirectories(List<URL> urls) throws MalformedURLException
      Throws:
      MalformedURLException
    • addProjectClasses

      protected void addProjectClasses(List<URL> urls) throws MalformedURLException
      Throws:
      MalformedURLException
    • addDependencies

      protected void addDependencies(List<URL> urls, org.apache.maven.shared.artifact.filter.collection.FilterArtifacts filters) throws MalformedURLException, org.apache.maven.plugin.MojoExecutionException
      Throws:
      MalformedURLException
      org.apache.maven.plugin.MojoExecutionException