Class StartMojo

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

@Mojo(name="start", requiresProject=true, defaultPhase=PRE_INTEGRATION_TEST, requiresDependencyResolution=TEST) public class StartMojo extends AbstractRunMojo
Start a spring application. Contrary to the run goal, this does not block and allows other goals to operate on the application. This goal is typically used in integration test scenario where the application is started before a test suite and stopped after.
Since:
1.3.0
Author:
Stephane Nicoll
See Also:
  • Constructor Details

    • StartMojo

      public StartMojo()
  • Method Details

    • 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
    • resolveApplicationArguments

      protected org.springframework.boot.maven.RunArguments resolveApplicationArguments()
      Description copied from class: AbstractRunMojo
      Resolve the application arguments to use.
      Overrides:
      resolveApplicationArguments in class AbstractRunMojo
      Returns:
      a RunArguments defining the application arguments
    • 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
    • execute

      public <T> T execute(long wait, int maxAttempts, Callable<T> callback) throws Exception
      Execute a task, retrying it on failure.
      Type Parameters:
      T - the result type
      Parameters:
      wait - the wait time
      maxAttempts - the maximum number of attempts
      callback - the task to execute (possibly multiple times). The callback should return null to indicate that another attempt should be made
      Returns:
      the result
      Throws:
      Exception - in case of execution errors