Class TestRunMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="test-run", requiresProject=true, defaultPhase=VALIDATE, requiresDependencyResolution=TEST) @Execute(phase=TEST_COMPILE) public class TestRunMojo extends AbstractRunMojo
Run an application in place using the test runtime classpath. The main class that will be used to launch the application is determined as follows:
  1. The configured main class, if any
  2. The main class found in the test classes directory, if any
  3. The main class found in the classes directory, if any
Since:
3.1.0
Author:
Phillip Webb, Dmytro Nosan, Stephane Nicoll, Andy Wilkinson
  • Constructor Details

    • TestRunMojo

      public TestRunMojo()
  • Method Details

    • getClassesDirectories

      protected List<File> getClassesDirectories()
      Description copied from class: AbstractRunMojo
      Returns the directories that contain the application's classes and resources. When the application's main class has not been configured, each directory is searched in turn for an appropriate main class.
      Overrides:
      getClassesDirectories in class AbstractRunMojo
      Returns:
      the directories that contain the application's classes and resources
    • isUseTestClasspath

      protected boolean isUseTestClasspath()
      Specified by:
      isUseTestClasspath in class AbstractRunMojo
    • resolveJvmArguments

      protected org.springframework.boot.maven.RunArguments resolveJvmArguments()
      Description copied from class: AbstractRunMojo
      Resolve the JVM arguments to use.
      Overrides:
      resolveJvmArguments in class AbstractRunMojo
      Returns:
      a RunArguments defining the JVM arguments
    • run

      protected void run(org.springframework.boot.maven.JavaProcessExecutor processExecutor, File workingDirectory, List<String> args, Map<String,String> environmentVariables) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Description copied from class: AbstractRunMojo
      Run the application.
      Specified by:
      run in class AbstractRunMojo
      Parameters:
      processExecutor - the JavaProcessExecutor to use
      workingDirectory - the working directory of the forked JVM
      args - the arguments (JVM arguments and application arguments)
      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