summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/maven/maven-tuscany-plugin/pom.xml41
-rw-r--r--sca-java-2.x/trunk/maven/maven-tuscany-plugin/src/main/java/org/apache/tuscany/maven/plugin/TuscanyRunMojo.java33
2 files changed, 63 insertions, 11 deletions
diff --git a/sca-java-2.x/trunk/maven/maven-tuscany-plugin/pom.xml b/sca-java-2.x/trunk/maven/maven-tuscany-plugin/pom.xml
index a6057e528b..8fec7956f5 100644
--- a/sca-java-2.x/trunk/maven/maven-tuscany-plugin/pom.xml
+++ b/sca-java-2.x/trunk/maven/maven-tuscany-plugin/pom.xml
@@ -48,7 +48,6 @@
<artifactId>maven-artifact</artifactId>
<version>2.0.3</version>
</dependency>
-
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-base-runtime</artifactId>
@@ -59,16 +58,36 @@
<artifactId>tuscany-domain-hazelcast</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- <version>0.9.95-huynhjl</version>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1.19</version>
- </dependency>
+ <dependency>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ <version>0.9.95-huynhjl</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ <version>7.0.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-logging-juli</artifactId>
+ <version>7.0.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-jasper</artifactId>
+ <version>7.0.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jasper-el</artifactId>
+ <version>7.0.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jdt.core.compiler</groupId>
+ <artifactId>ecj</artifactId>
+ <version>3.5.1</version>
+ </dependency>
</dependencies>
diff --git a/sca-java-2.x/trunk/maven/maven-tuscany-plugin/src/main/java/org/apache/tuscany/maven/plugin/TuscanyRunMojo.java b/sca-java-2.x/trunk/maven/maven-tuscany-plugin/src/main/java/org/apache/tuscany/maven/plugin/TuscanyRunMojo.java
index 4b9e523740..312e4f0e5f 100644
--- a/sca-java-2.x/trunk/maven/maven-tuscany-plugin/src/main/java/org/apache/tuscany/maven/plugin/TuscanyRunMojo.java
+++ b/sca-java-2.x/trunk/maven/maven-tuscany-plugin/src/main/java/org/apache/tuscany/maven/plugin/TuscanyRunMojo.java
@@ -26,6 +26,12 @@ import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.List;
+import javax.servlet.ServletException;
+
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.core.AprLifecycleListener;
+import org.apache.catalina.core.StandardServer;
+import org.apache.catalina.startup.Tomcat;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -114,11 +120,38 @@ public class TuscanyRunMojo extends AbstractMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
if (mainClass != null) {
executeMainMethod();
+ } else if (".war".equals(packaging)) {
+ try {
+ executeTomcat();
+ } catch (Exception e) {
+ throw new MojoExecutionException("Exception running Tuscany/Tomcat", e);
+ }
} else {
executeShell();
}
}
+ private void executeTomcat() throws ServletException, LifecycleException, MalformedURLException {
+ getLog().info("Starting Tuscany/Tomcat...");
+
+ Tomcat tomcat = new Tomcat();
+ tomcat.setPort(8080);
+
+ tomcat.setBaseDir("target");
+ String appBase = "../src/main/webapp";
+ tomcat.getHost().setAppBase(".");
+ String contextPath = "/" + artifactId;
+
+ StandardServer server = (StandardServer)tomcat.getServer();
+ server.setParentClassLoader(getMainClassLoader());
+ AprLifecycleListener listener = new AprLifecycleListener();
+ server.addLifecycleListener(listener);
+
+ tomcat.addWebapp(contextPath, appBase);
+ tomcat.start();
+ tomcat.getServer().await();
+ }
+
private void executeShell() throws MojoExecutionException {
getLog().info("Starting Tuscany Shell...");