-
-
Notifications
You must be signed in to change notification settings - Fork 468
Expand file tree
/
Copy pathMain.java
More file actions
32 lines (26 loc) · 999 Bytes
/
Main.java
File metadata and controls
32 lines (26 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package io.sentry.samples.spring;
import java.io.File;
import java.io.IOException;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.startup.Tomcat;
public class Main {
public static void main(String[] args) throws LifecycleException, IOException {
File webappsDirectory = new File("./tomcat.8080/webapps");
if (!webappsDirectory.exists()) {
boolean didCreateDirectories = webappsDirectory.mkdirs();
if (!didCreateDirectories) {
throw new RuntimeException(
"Failed to create directory required by Tomcat: " + webappsDirectory.getAbsolutePath());
}
}
String pathToWar = "./build/libs";
String warName = "sentry-samples-spring-0.0.1-SNAPSHOT";
File war = new File(pathToWar + "/" + warName + ".war");
Tomcat tomcat = new Tomcat();
tomcat.setPort(8080);
tomcat.getConnector();
tomcat.addWebapp("/" + warName, war.getCanonicalPath());
tomcat.start();
tomcat.getServer().await();
}
}