Author: davsclaus
Date: Thu Apr 12 16:44:52 2012
New Revision: 1325371
URL: http://svn.apache.org/viewvc?rev=1325371&view=rev
Log:
CAMEL-5168: Added Main class in camel-test-blueprint, to make it easier to run
Camel Blueprint out of container.
Added:
camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/log4j.properties
- copied, changed from r1325329,
camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/resources/log4j.properties
Removed:
camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/resources/log4j.properties
Modified:
camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml
camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
Modified:
camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml?rev=1325371&r1=1325370&r2=1325371&view=diff
==============================================================================
---
camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml
(original)
+++
camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml
Thu Apr 12 16:44:52 2012
@@ -115,6 +115,17 @@
<forkMode>pertest</forkMode>
</configuration>
</plugin>
+
+ <!-- to run the example using mvn camel:run -->
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-maven-plugin</artifactId>
+ <version>${camel-version}</version>
+ <configuration>
+ <useBlueprint>true</useBlueprint>
+ </configuration>
+ </plugin>
+
</plugins>
</build>
Copied:
camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/log4j.properties
(from r1325329,
camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/resources/log4j.properties)
URL:
http://svn.apache.org/viewvc/camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/log4j.properties?p2=camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/log4j.properties&p1=camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/resources/log4j.properties&r1=1325329&r2=1325371&rev=1325371&view=diff
==============================================================================
---
camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/resources/log4j.properties
(original)
+++
camel/trunk/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/log4j.properties
Thu Apr 12 16:44:52 2012
@@ -18,7 +18,7 @@
#
# The logging properties used for testing
#
-log4j.rootLogger=INFO, file
+log4j.rootLogger=INFO, out
#log4j.logger.org.apache.camel=DEBUG
Modified:
camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
URL:
http://svn.apache.org/viewvc/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java?rev=1325371&r1=1325370&r2=1325371&view=diff
==============================================================================
---
camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
(original)
+++
camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
Thu Apr 12 16:44:52 2012
@@ -114,6 +114,14 @@ public class RunMojo extends AbstractExe
protected boolean logClasspath;
/**
+ * Whether to use Blueprint when running, instead of Spring
+ *
+ * @parameter expression="${camel.blueprint}"
+ * default-value="false"
+ */
+ protected boolean useBlueprint;
+
+ /**
* @component
*/
private ArtifactResolver artifactResolver;
@@ -171,8 +179,6 @@ public class RunMojo extends AbstractExe
* The main class to execute.
*
* @parameter expression="${camel.mainClass}"
- * default-value="org.apache.camel.spring.Main"
- * @required
*/
private String mainClass;
@@ -344,6 +350,7 @@ public class RunMojo extends AbstractExe
*/
public void execute() throws MojoExecutionException, MojoFailureException {
boolean usingSpringJavaConfigureMain = false;
+ boolean usingBlueprintMain = useBlueprint;
if (killAfter != -1) {
getLog().warn("Warning: killAfter is now deprecated. Do you need
it ? Please comment on MEXEC-6.");
}
@@ -392,11 +399,22 @@ public class RunMojo extends AbstractExe
if (usingSpringJavaConfigureMain) {
mainClass = "org.apache.camel.spring.javaconfig.Main";
- getLog().info("Using the org.apache.camel.spring.javaconfig.Main
to initiate a CamelContext");
+ getLog().info("Using org.apache.camel.spring.javaconfig.Main to
initiate a CamelContext");
+ } else if (usingBlueprintMain) {
+ mainClass = "org.apache.camel.test.blueprint.Main";
+ // must include plugin dependencies for blueprint
+ includePluginDependencies = true;
+ getLog().info("Using org.apache.camel.test.blueprint.Main to
initiate a CamelContext");
+ } else if (mainClass != null) {
+ getLog().info("Using custom " + mainClass + " to initiate a
CamelContext");
+ } else {
+ // use spring by default
+ getLog().info("Using org.apache.camel.spring.Main to initiate a
CamelContext");
+ mainClass = "org.apache.camel.spring.Main";
}
if (getLog().isDebugEnabled()) {
- StringBuffer msg = new StringBuffer("Invoking : ");
+ StringBuffer msg = new StringBuffer("Invoking: ");
msg.append(mainClass);
msg.append(".main(");
for (int i = 0; i < arguments.length; i++) {