Class StartMojo

  • 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 application. Contrary to the run goal, this does not block and allows other goal 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:
    StopMojo
    • Field Summary

      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      StartMojo()  
    • Method Summary

      Modifier and Type Method Description
      <T> T execute​(long wait, int maxAttempts, java.util.concurrent.Callable<T> callback)
      Execute a task, retrying it on failure.
      protected io.joshworks.snappy.maven.RunArguments resolveApplicationArguments()
      Resolve the application arguments to use.
      protected io.joshworks.snappy.maven.RunArguments resolveJvmArguments()
      Resolve the JVM arguments to use.
      protected void runWithForkedJvm​(java.util.List<java.lang.String> args)
      Run with a forked VM, using the specified command line arguments.
      protected void runWithMavenJvm​(java.lang.String startClassName, java.lang.String... arguments)
      Run with the current VM, using the specified arguments.
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StartMojo

        public StartMojo()
    • Method Detail

      • runWithForkedJvm

        protected void runWithForkedJvm​(java.util.List<java.lang.String> args)
                                 throws org.apache.maven.plugin.MojoExecutionException,
                                        org.apache.maven.plugin.MojoFailureException
        Description copied from class: AbstractRunMojo
        Run with a forked VM, using the specified command line arguments.
        Specified by:
        runWithForkedJvm in class AbstractRunMojo
        Parameters:
        args - the arguments (JVM arguments and application arguments)
        Throws:
        org.apache.maven.plugin.MojoExecutionException - in case of MOJO execution errors
        org.apache.maven.plugin.MojoFailureException - in case of MOJO failures
      • resolveApplicationArguments

        protected io.joshworks.snappy.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 io.joshworks.snappy.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
      • runWithMavenJvm

        protected void runWithMavenJvm​(java.lang.String startClassName,
                                       java.lang.String... arguments)
                                throws org.apache.maven.plugin.MojoExecutionException
        Description copied from class: AbstractRunMojo
        Run with the current VM, using the specified arguments.
        Specified by:
        runWithMavenJvm in class AbstractRunMojo
        Parameters:
        startClassName - the class to run
        arguments - the class arguments
        Throws:
        org.apache.maven.plugin.MojoExecutionException - in case of MOJO execution errors
      • execute

        public <T> T execute​(long wait,
                             int maxAttempts,
                             java.util.concurrent.Callable<T> callback)
                      throws java.lang.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:
        java.lang.Exception - in case of execution errors