Author: janstey
Date: Thu Oct 16 06:15:31 2008
New Revision: 705236
URL: http://svn.apache.org/viewvc?rev=705236&view=rev
Log:
CAMEL-991 - Allow for overridden mainClass in camel:dot.
Patch applied with thanks to Seb Auvray!
Modified:
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
Modified:
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java?rev=705236&r1=705235&r2=705236&view=diff
==============================================================================
---
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java
(original)
+++
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java
Thu Oct 16 06:15:31 2008
@@ -83,6 +83,15 @@
protected boolean runCamel;
/**
+ * The main class to execute.
+ *
+ * @parameter expression="${camel.mainClass}"
+ * default-value="org.apache.camel.spring.Main"
+ * @required
+ */
+ private String mainClass;
+
+ /**
* Should we try run the DOT executable on the generated .DOT file to
* generate images
*
@@ -358,6 +367,7 @@
EmbeddedMojo mojo = new EmbeddedMojo();
mojo.setClasspathElements(list);
mojo.setDotEnabled(true);
+ mojo.setMainClass(mainClass);
if ("true".equals(getAggregate())) {
mojo.setDotAggregationEnabled(true);
}
Modified:
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java?rev=705236&r1=705235&r2=705236&view=diff
==============================================================================
---
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
(original)
+++
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
Thu Oct 16 06:15:31 2008
@@ -99,6 +99,15 @@
private List classpathElements;
/**
+ * The main class to execute.
+ *
+ * @parameter expression="${camel.mainClass}"
+ * default-value="org.apache.camel.spring.Main"
+ * @required
+ */
+ private String mainClass;
+
+ /**
* This method will run the mojo
*/
public void execute() throws MojoExecutionException {
@@ -190,6 +199,14 @@
this.fileApplicationContextUri = fileApplicationContextUri;
}
+ public String getMainClass() {
+ return mainClass;
+ }
+
+ public void setMainClass(String mainClass) {
+ this.mainClass = mainClass;
+ }
+
// Implementation methods
//-------------------------------------------------------------------------
@@ -197,7 +214,7 @@
IllegalAccessException, MojoExecutionException {
getLog().debug("Running Camel in: " + newLoader);
- Class<?> type = newLoader.loadClass("org.apache.camel.spring.Main");
+ Class<?> type = newLoader.loadClass(mainClass);
Method method = type.getMethod("main", String[].class);
String[] arguments = createArguments();
getLog().debug("Starting the Camel Main with arguments: " +
Arrays.asList(arguments));