Class RunMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.codehaus.mojo.exec.AbstractExecMojo
org.apache.camel.maven.RunMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
DevMojo

@Mojo(name="run", defaultPhase=PREPARE_PACKAGE, requiresDependencyResolution=COMPILE_PLUS_RUNTIME) public class RunMojo extends org.codehaus.mojo.exec.AbstractExecMojo
Runs a CamelContext using any Spring configuration files found in META-INF/spring/*.xml, and camel-*.xml and starting up the context.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.apache.maven.artifact.resolver.ArtifactResolver
     
    protected String
    Sets the time duration (seconds) that the application will run for before terminating.
    protected String
    Sets the idle time duration (seconds) duration that the application can be idle before terminating.
    protected String
    Sets the duration of maximum number of messages that the application will process before terminating.
    protected String
     
    protected boolean
    Whether to log the classpath when starting
    protected String
    Whether to use built-in console logging (uses log4j), which does not require to add any logging dependency to your project.
    protected String
    To run with a specific Camel Main profile (dev,test,prod)
    protected org.apache.maven.project.MavenProject
    The maven project.
    protected Boolean
    Whether to use Kamelet (camel-main-kamelet) when running, instead of Spring

    Fields inherited from class org.codehaus.mojo.exec.AbstractExecMojo

    classpathScope, repositorySystem

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

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Allows plugin extensions to do custom logic after bootstrapping Camel.
    protected void
    Allows plugin extensions to do custom logic before bootstrapping Camel.
    protected Set<org.apache.maven.artifact.Artifact>
    Determine all plugin dependencies relevant to the executable.
    void
    Execute goal.
    protected org.apache.maven.artifact.Artifact
    Examine the plugin dependencies to find the executable artifact.
    protected List<org.apache.maven.artifact.Artifact>
     
    protected String
     

    Methods inherited from class org.codehaus.mojo.exec.AbstractExecMojo

    collectProjectArtifactsAndClasspath, getPluginDependencies, getSession, hasCommandlineArgs, isSkip, parseCommandlineArgs, registerSourceRoots

    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
  • Field Details

    • project

      @Parameter(property="project", required=true, readonly=true) protected org.apache.maven.project.MavenProject project
      The maven project.
    • duration

      @Parameter(property="camel.duration", defaultValue="-1") protected String duration
      Sets the time duration (seconds) that the application will run for before terminating. A value invalid input: '<'= 0 will run forever.
    • durationIdle

      @Parameter(property="camel.durationIdle", defaultValue="-1") protected String durationIdle
      Sets the idle time duration (seconds) duration that the application can be idle before terminating. A value invalid input: '<'= 0 will run forever.
    • durationMaxMessages

      @Parameter(property="camel.duration.maxMessages", defaultValue="-1") protected String durationMaxMessages
      Sets the duration of maximum number of messages that the application will process before terminating.
    • logClasspath

      @Parameter(property="camel.logClasspath", defaultValue="false") protected boolean logClasspath
      Whether to log the classpath when starting
    • loggingLevel

      @Parameter(property="camel.loggingLevel", defaultValue="OFF") protected String loggingLevel
      Whether to use built-in console logging (uses log4j), which does not require to add any logging dependency to your project. However, the logging is fixed to log to the console, with a color style that is similar to Spring Boot. You can change the root logging level to: FATAL, ERROR, WARN, INFO, DEBUG, TRACE, OFF
    • useKamelet

      @Parameter(property="camel.useKamelet") protected Boolean useKamelet
      Whether to use Kamelet (camel-main-kamelet) when running, instead of Spring
    • profile

      @Parameter(property="camel.profile") protected String profile
      To run with a specific Camel Main profile (dev,test,prod)
    • extendedPluginDependencyArtifactId

      protected String extendedPluginDependencyArtifactId
    • artifactResolver

      @Component protected org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
  • Constructor Details

    • RunMojo

      public RunMojo()
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Execute goal.
      Throws:
      org.apache.maven.plugin.MojoExecutionException - execution of the main class or one of the threads it generated failed.
      org.apache.maven.plugin.MojoFailureException - something bad happened...
    • goal

      protected String goal()
    • beforeBootstrapCamel

      protected void beforeBootstrapCamel() throws Exception
      Allows plugin extensions to do custom logic before bootstrapping Camel.
      Throws:
      Exception
    • afterBootstrapCamel

      protected void afterBootstrapCamel() throws Exception
      Allows plugin extensions to do custom logic after bootstrapping Camel.
      Throws:
      Exception
    • getClasspath

      protected List<org.apache.maven.artifact.Artifact> getClasspath() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Returns:
      the list of artifacts corresponding to the classpath to use when launching the application
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • determineRelevantPluginDependencies

      protected Set<org.apache.maven.artifact.Artifact> determineRelevantPluginDependencies() throws org.apache.maven.plugin.MojoExecutionException
      Determine all plugin dependencies relevant to the executable. Takes includePlugins, and the executableDependency into consideration.
      Overrides:
      determineRelevantPluginDependencies in class org.codehaus.mojo.exec.AbstractExecMojo
      Returns:
      a set of Artifact objects. (Empty set is returned if there are no relevant plugin dependencies.)
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • findExecutableArtifact

      protected org.apache.maven.artifact.Artifact findExecutableArtifact() throws org.apache.maven.plugin.MojoExecutionException
      Examine the plugin dependencies to find the executable artifact.
      Overrides:
      findExecutableArtifact in class org.codehaus.mojo.exec.AbstractExecMojo
      Returns:
      an artifact which refers to the actual executable tool (not a POM)
      Throws:
      org.apache.maven.plugin.MojoExecutionException