Class KarafRunMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.codehaus.mojo.exec.AbstractExecMojo
-
- org.apache.camel.maven.KarafRunMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="run", defaultPhase=PREPARE_PACKAGE, requiresDependencyResolution=COMPILE_PLUS_RUNTIME) public class KarafRunMojo extends org.codehaus.mojo.exec.AbstractExecMojoRuns a CamelContext using OSGi Blueprint.
-
-
Field Summary
Fields Modifier and Type Field Description protected StringapplicationContextUriThe classpath based application context uri that spring want to gets.protected String[]argumentsThe class arguments.protected StringbasedPackagesThe basedPackages that spring java config want to gets.protected booleancleanupDaemonThreadsWhether to interrupt/join and possibly stop the daemon threads upon quitting.protected StringconfigAdminFileNameThe configureAdmin persistent file name, it will be used when loading the camel context from blueprint.protected StringconfigAdminPidThe configureAdmin persistent id, it will be used when loading the camel context from blueprint.protected StringconfigClassesThe configClasses that spring java config want to gets.protected longdaemonThreadJoinTimeoutThis defines the number of milliseconds to wait for daemon threads to quit following their interruption.
This is only taken into account ifcleanupDaemonThreadsistrue.protected StringdurationSets the time duration (seconds) that the application will run for before terminating.protected StringdurationIdleSets the idle time duration (seconds) duration that the application can be idle before terminating.protected StringdurationMaxMessagesSets the duration of maximum number of messages that the application will process before terminating.protected org.codehaus.mojo.exec.ExecutableDependencyexecutableDependencyIf provided the ExecutableDependency identifies which of the plugin dependencies contains the executable class.protected StringextendedPluginDependencyArtifactIdprotected StringfileApplicationContextUriThe filesystem based application context uri that spring want to gets.protected StringfileWatcherDirectoryTo watch the directory for file changes which triggers a live reload of the Camel routes on-the-fly.protected booleanincludePluginDependenciesIndicates if this plugin's dependencies should be used when executing the main class.protected booleanincludeProjectDependenciesIndicates if the project dependencies should be used when executing the main class.protected booleankeepAliveDeprecated; this is not needed anymore.protected booleanlogClasspathWhether to log the classpath when startingprotected StringmainClassThe main class to execute.protected org.apache.maven.project.MavenProjectprojectThe maven project.protected booleanstopUnresponsiveDaemonThreadsWether to callThread.stop()following a timing out of waiting for an interrupted thread to finish.protected org.codehaus.mojo.exec.Property[]systemPropertiesA list of system properties to be passed.protected booleantraceWhether to enable the tracer or notprotected BooleanuseBlueprintWhether to use Blueprint when running, instead of Spring
-
Constructor Summary
Constructors Constructor Description KarafRunMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterBootstrapCamel()Allows plugin extensions to do custom logic after bootstrapping Camel.protected voidbeforeBootstrapCamel()Allows plugin extensions to do custom logic before bootstrapping Camel.voidexecute()Execute goal.protected org.apache.maven.artifact.ArtifactfindExecutableArtifact()Examine the plugin dependencies to find the executable artifact.protected List<String>parseArguments()-
Methods inherited from class org.codehaus.mojo.exec.AbstractExecMojo
collectProjectArtifactsAndClasspath, hasCommandlineArgs, isSkip, parseCommandlineArgs, registerSourceRoots
-
-
-
-
Field Detail
-
project
@Parameter(property="project", required=true, readonly=true) protected org.apache.maven.project.MavenProject projectThe maven project.
-
duration
@Parameter(property="camel.duration", defaultValue="-1") protected String durationSets the time duration (seconds) that the application will run for before terminating. A value <= 0 will run forever.
-
durationIdle
@Parameter(property="camel.durationIdle", defaultValue="-1") protected String durationIdleSets the idle time duration (seconds) duration that the application can be idle before terminating. A value <= 0 will run forever.
-
durationMaxMessages
@Parameter(property="camel.duration.maxMessages", defaultValue="-1") protected String durationMaxMessagesSets the duration of maximum number of messages that the application will process before terminating.
-
logClasspath
@Parameter(property="camel.logClasspath", defaultValue="false") protected boolean logClasspathWhether to log the classpath when starting
-
useBlueprint
@Parameter(property="camel.useBlueprint") protected Boolean useBlueprint
Whether to use Blueprint when running, instead of Spring
-
trace
@Parameter(property="camel.trace") protected boolean trace
Whether to enable the tracer or not
-
mainClass
@Parameter(property="camel.mainClass") protected String mainClass
The main class to execute.
-
basedPackages
@Parameter(property="camel.basedPackages") protected String basedPackages
The basedPackages that spring java config want to gets.
-
configClasses
@Parameter(property="camel.configClasses") protected String configClasses
The configClasses that spring java config want to gets.
-
applicationContextUri
@Parameter(property="camel.applicationContextUri") protected String applicationContextUri
The classpath based application context uri that spring want to gets.
-
fileApplicationContextUri
@Parameter(property="camel.fileApplicationContextUri") protected String fileApplicationContextUri
The filesystem based application context uri that spring want to gets.
-
configAdminPid
@Parameter(property="camel.configAdminPid") protected String configAdminPid
The configureAdmin persistent id, it will be used when loading the camel context from blueprint.
-
configAdminFileName
@Parameter(property="camel.configAdminFileName") protected String configAdminFileName
The configureAdmin persistent file name, it will be used when loading the camel context from blueprint.
-
fileWatcherDirectory
@Parameter(property="camel.fileWatcherDirectory") protected String fileWatcherDirectory
To watch the directory for file changes which triggers a live reload of the Camel routes on-the-fly.
-
arguments
@Parameter(property="camel.arguments") protected String[] arguments
The class arguments.
-
systemProperties
protected org.codehaus.mojo.exec.Property[] systemProperties
A list of system properties to be passed. Note: as the execution is not forked, some system properties required by the JVM cannot be passed here. Use MAVEN_OPTS or the exec:exec instead. See the user guide for more information.
-
keepAlive
@Parameter(property="camel.keepAlive") protected boolean keepAlive
Deprecated; this is not needed anymore. Indicates if mojo should be kept running after the mainclass terminates. Usefull for serverlike apps with deamonthreads.
-
includeProjectDependencies
@Parameter(property="camel.includeProjectDependencies", defaultValue="true") protected boolean includeProjectDependenciesIndicates if the project dependencies should be used when executing the main class.
-
includePluginDependencies
@Parameter(property="camel.includePluginDependencies", defaultValue="false") protected boolean includePluginDependenciesIndicates if this plugin's dependencies should be used when executing the main class. This is useful when project dependencies are not appropriate. Using only the plugin dependencies can be particularly useful when the project is not a java project. For example a mvn project using the csharp plugins only expects to see dotnet libraries as dependencies.
-
executableDependency
@Parameter(property="camel.executableDependency") protected org.codehaus.mojo.exec.ExecutableDependency executableDependency
If provided the ExecutableDependency identifies which of the plugin dependencies contains the executable class. This will have the affect of only including plugin dependencies required by the identified ExecutableDependency. If includeProjectDependencies is set totrue, 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.
-
cleanupDaemonThreads
@Parameter(property="camel.cleanupDaemonThreads", defaultValue="true") protected boolean cleanupDaemonThreadsWhether to interrupt/join and possibly stop the daemon threads upon quitting.
If this isfalse, 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
daemonThreadJoinTimeoutandstopUnresponsiveDaemonThreadsfor further tuning.
-
daemonThreadJoinTimeout
@Parameter(property="camel.daemonThreadJoinTimeout", defaultValue="15000") protected long daemonThreadJoinTimeoutThis defines the number of milliseconds to wait for daemon threads to quit following their interruption.
This is only taken into account ifcleanupDaemonThreadsistrue. 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.
-
stopUnresponsiveDaemonThreads
@Parameter(property="camel.stopUnresponsiveDaemonThreads", defaultValue="15000") protected boolean stopUnresponsiveDaemonThreadsWether to callThread.stop()following a timing out of waiting for an interrupted thread to finish. This is only taken into account ifcleanupDaemonThreadsistrueand thedaemonThreadJoinTimeoutthreshold has been reached for an uncooperative thread. If this isfalse, or ifThread.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 totrueif you are invoking problematic code that you can't fix. An example isTimerwhich doesn't respond to interruption. To haveTimerfixed, vote for this bug.
-
extendedPluginDependencyArtifactId
protected String extendedPluginDependencyArtifactId
-
-
Method Detail
-
parseArguments
protected List<String> parseArguments() throws org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoFailureException
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureExceptionExecute 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...
-
beforeBootstrapCamel
protected void beforeBootstrapCamel() throws ExceptionAllows plugin extensions to do custom logic before bootstrapping Camel.- Throws:
Exception
-
afterBootstrapCamel
protected void afterBootstrapCamel() throws ExceptionAllows plugin extensions to do custom logic after bootstrapping Camel.- Throws:
Exception
-
findExecutableArtifact
protected org.apache.maven.artifact.Artifact findExecutableArtifact() throws org.apache.maven.plugin.MojoExecutionExceptionExamine the plugin dependencies to find the executable artifact.- Overrides:
findExecutableArtifactin classorg.codehaus.mojo.exec.AbstractExecMojo- Returns:
- an artifact which refers to the actual executable tool (not a POM)
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
-