Created
May 5, 2016 09:04
-
-
Save johnllao/fc1c50c1425c0eaecd60385254cc7e5d to your computer and use it in GitHub Desktop.
Embedded Tomcat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package quickweb; | |
import javax.servlet.ServletException; | |
import org.apache.catalina.LifecycleException; | |
import org.apache.catalina.startup.Tomcat; | |
public class Launcher { | |
public static void main(String[] args) { | |
System.out.println("Quickweb (version 1.0)"); | |
System.out.println(); | |
final Tomcat tomcat = new Tomcat(); | |
tomcat.setPort(8081); | |
tomcat.setBaseDir("D:/temp/java/quickweb"); | |
try { | |
tomcat.addWebapp("", System.getProperty("user.dir")); | |
tomcat.start(); | |
System.out.println("Started."); | |
tomcat.getServer().await(); | |
} | |
catch (LifecycleException e) { | |
System.out.printf("LifecycleException. %s\n", e.getMessage()); | |
} | |
catch (ServletException e) { | |
System.out.printf("ServletException. %s\n", e.getMessage()); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>quickweb</groupId> | |
<artifactId>quickweb</artifactId> | |
<packaging>war</packaging> | |
<version>1.0</version> | |
<name>Quick Web</name> | |
<url>http://quickweb.org</url> | |
<properties> | |
<tomcat.version>8.5.0</tomcat.version> | |
</properties> | |
<dependencies> | |
<dependency> | |
<groupId>org.apache.tomcat.embed</groupId> | |
<artifactId>tomcat-embed-core</artifactId> | |
<version>${tomcat.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.tomcat.embed</groupId> | |
<artifactId>tomcat-embed-logging-juli</artifactId> | |
<version>${tomcat.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.tomcat.embed</groupId> | |
<artifactId>tomcat-embed-jasper</artifactId> | |
<version>${tomcat.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.tomcat</groupId> | |
<artifactId>tomcat-jasper</artifactId> | |
<version>${tomcat.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.tomcat</groupId> | |
<artifactId>tomcat-jasper-el</artifactId> | |
<version>${tomcat.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.tomcat</groupId> | |
<artifactId>tomcat-jsp-api</artifactId> | |
<version>${tomcat.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>jstl</groupId> | |
<artifactId>jstl</artifactId> | |
<version>1.2</version> | |
</dependency> | |
</dependencies> | |
<build> | |
<finalName>Quick Web</finalName> | |
</build> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment