@Mojo(name="run",
defaultPhase=PREPARE_PACKAGE,
requiresDependencyResolution=COMPILE_PLUS_RUNTIME)
public class KarafRunMojo
extends org.codehaus.mojo.exec.AbstractExecMojo
| Modifier and Type | Field and Description |
|---|---|
protected String |
applicationContextUri
The classpath based application context uri that spring want to gets.
|
protected String[] |
arguments
The class arguments.
|
protected String |
basedPackages
The basedPackages that spring java config want to gets.
|
protected boolean |
cleanupDaemonThreads
Whether to interrupt/join and possibly stop the daemon threads upon quitting.
|
protected String |
configAdminFileName
The configureAdmin persistent file name, it will be used when loading the camel context from blueprint.
|
protected String |
configAdminPid
The configureAdmin persistent id, it will be used when loading the camel context from blueprint.
|
protected String |
configClasses
The configClasses that spring java config want to gets.
|
protected long |
daemonThreadJoinTimeout
This defines the number of milliseconds to wait for daemon threads to quit following their interruption.
This is only taken into account if cleanupDaemonThreads is true. |
protected String |
duration
Sets the time duration (seconds) that the application will run for before terminating.
|
protected String |
durationIdle
Sets the idle time duration (seconds) duration that the application can be idle before terminating.
|
protected String |
durationMaxMessages
Sets the duration of maximum number of messages that the application will process before terminating.
|
protected org.codehaus.mojo.exec.ExecutableDependency |
executableDependency
If provided the ExecutableDependency identifies which of the plugin dependencies contains the executable class.
|
protected String |
extendedPluginDependencyArtifactId |
protected String |
fileApplicationContextUri
The filesystem based application context uri that spring want to gets.
|
protected String |
fileWatcherDirectory
To watch the directory for file changes which triggers a live reload of the Camel routes on-the-fly.
|
protected boolean |
includePluginDependencies
Indicates if this plugin's dependencies should be used when executing the main class.
|
protected boolean |
includeProjectDependencies
Indicates if the project dependencies should be used when executing the main class.
|
protected boolean |
keepAlive
Deprecated; this is not needed anymore.
|
protected boolean |
logClasspath
Whether to log the classpath when starting
|
protected String |
mainClass
The main class to execute.
|
protected org.apache.maven.project.MavenProject |
project
The maven project.
|
protected boolean |
stopUnresponsiveDaemonThreads
Wether to call
Thread.stop() following a timing out of waiting for an interrupted thread to finish. |
protected org.codehaus.mojo.exec.Property[] |
systemProperties
A list of system properties to be passed.
|
protected boolean |
trace
Whether to enable the tracer or not
|
protected Boolean |
useBlueprint
Whether to use Blueprint when running, instead of Spring
|
| Constructor and Description |
|---|
KarafRunMojo() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterBootstrapCamel()
Allows plugin extensions to do custom logic after bootstrapping Camel.
|
protected void |
beforeBootstrapCamel()
Allows plugin extensions to do custom logic before bootstrapping Camel.
|
void |
execute()
Execute goal.
|
protected org.apache.maven.artifact.Artifact |
findExecutableArtifact()
Examine the plugin dependencies to find the executable artifact.
|
protected List<String> |
parseArguments() |
collectProjectArtifactsAndClasspath, hasCommandlineArgs, isSkip, parseCommandlineArgs, registerSourceRoots@Parameter(property="project",
required=true,
readonly=true)
protected org.apache.maven.project.MavenProject project
@Parameter(property="camel.duration",
defaultValue="-1")
protected String duration
@Parameter(property="camel.durationIdle",
defaultValue="-1")
protected String durationIdle
@Parameter(property="camel.duration.maxMessages",
defaultValue="-1")
protected String durationMaxMessages
@Parameter(property="camel.logClasspath",
defaultValue="false")
protected boolean logClasspath
@Parameter(property="camel.useBlueprint") protected Boolean useBlueprint
@Parameter(property="camel.trace") protected boolean trace
@Parameter(property="camel.mainClass") protected String mainClass
@Parameter(property="camel.basedPackages") protected String basedPackages
@Parameter(property="camel.configClasses") protected String configClasses
@Parameter(property="camel.applicationContextUri") protected String applicationContextUri
@Parameter(property="camel.fileApplicationContextUri") protected String fileApplicationContextUri
@Parameter(property="camel.configAdminPid") protected String configAdminPid
@Parameter(property="camel.configAdminFileName") protected String configAdminFileName
@Parameter(property="camel.fileWatcherDirectory") protected String fileWatcherDirectory
@Parameter(property="camel.arguments") protected String[] arguments
protected org.codehaus.mojo.exec.Property[] systemProperties
@Parameter(property="camel.keepAlive") protected boolean keepAlive
@Parameter(property="camel.includeProjectDependencies",
defaultValue="true")
protected boolean includeProjectDependencies
@Parameter(property="camel.includePluginDependencies",
defaultValue="false")
protected boolean includePluginDependencies
@Parameter(property="camel.executableDependency") protected org.codehaus.mojo.exec.ExecutableDependency executableDependency
true, all of the project dependencies will be included on
the executable's classpath. Whether a particular project dependency is a dependency of the identified
ExecutableDependency will be irrelevant to its inclusion in the classpath.@Parameter(property="camel.cleanupDaemonThreads",
defaultValue="true")
protected boolean cleanupDaemonThreads
false, maven does nothing about the daemon threads. When maven has no more work to do,
the VM will normally terminate any remaining daemon threads.
In certain cases (in particular if maven is embedded), you might need to keep this enabled to make sure threads
are properly cleaned up to ensure they don't interfere with subsequent activity. In that case, see
daemonThreadJoinTimeout and stopUnresponsiveDaemonThreads for further tuning.
@Parameter(property="camel.daemonThreadJoinTimeout",
defaultValue="15000")
protected long daemonThreadJoinTimeout
cleanupDaemonThreads is true. A value <=0 means to
not timeout (i.e. wait indefinitely for threads to finish). Following a timeout, a warning will be logged.
Note: properly coded threads should terminate upon interruption but some threads may prove problematic: as the VM does interrupt daemon threads, some code may not have been written to handle interruption properly. For example java.util.Timer is known to not handle interruptions in JDK <= 1.6. So it is not possible for us to infinitely wait by default otherwise maven could hang. A sensible default value has been chosen, but this default value may change in the future based on user feedback.
@Parameter(property="camel.stopUnresponsiveDaemonThreads",
defaultValue="15000")
protected boolean stopUnresponsiveDaemonThreads
Thread.stop() following a timing out of waiting for an interrupted thread to finish. This
is only taken into account if cleanupDaemonThreads is true and the
daemonThreadJoinTimeout threshold has been reached for an uncooperative thread. If this is
false, or if Thread.stop() fails to get the thread to stop, then a warning is logged and
Maven will continue on while the affected threads (and related objects in memory) linger on. Consider setting
this to true if you are invoking problematic code that you can't fix. An example is
Timer which doesn't respond to interruption. To have Timer fixed, vote for
this bug.protected String extendedPluginDependencyArtifactId
protected List<String> parseArguments() throws org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoFailureExceptionpublic void execute()
throws org.apache.maven.plugin.MojoExecutionException,
org.apache.maven.plugin.MojoFailureException
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...protected void beforeBootstrapCamel()
throws Exception
Exceptionprotected void afterBootstrapCamel()
throws Exception
Exceptionprotected org.apache.maven.artifact.Artifact findExecutableArtifact()
throws org.apache.maven.plugin.MojoExecutionException
findExecutableArtifact in class org.codehaus.mojo.exec.AbstractExecMojoorg.apache.maven.plugin.MojoExecutionExceptionApache Camel