Skip to content

Commit 49e355d

Browse files
author
Omur
committed
modifications
1 parent f053bb3 commit 49e355d

8 files changed

Lines changed: 931 additions & 3 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,3 +360,5 @@ jdk_8_maven/em/external/rest/spring-batch-rest/target
360360
/jdk_21_maven/cs/rest-gui/webgoat/tmp
361361
/jdk_21_maven/em/embedded/rest-gui/webgoat/target
362362
/jdk_21_maven/em/external/rest-gui/webgoat/target
363+
364+
/jdk_8_maven/cs/rest/original/swagger-petstore/target

jdk_8_maven/cs/rest/original/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<module>blogapi</module>
2626
<module>spring-batch-rest</module>
2727
<module>spring-actuator-demo</module>
28+
<module>swagger-petstore</module>
2829
</modules>
2930

3031

jdk_8_maven/cs/rest/original/swagger-petstore/pom.xml

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>io.swagger</groupId>
44
<artifactId>swagger-petstore</artifactId>
5-
<packaging>war</packaging>
5+
<!-- <packaging>war</packaging>-->
6+
<packaging>jar</packaging>
67
<name>swagger-petstore</name>
78
<description>swagger-petstore</description>
89
<url>https://github.com/swagger-api/swagger-petstore</url>
@@ -37,8 +38,38 @@
3738
<build>
3839
<defaultGoal>install</defaultGoal>
3940
<directory>target</directory>
40-
<finalName>${project.artifactId}-${project.version}</finalName>
41+
<finalName>${project.artifactId}-sut</finalName>
4142
<plugins>
43+
<!-- MODIFIED-->
44+
<plugin>
45+
<groupId>org.apache.maven.plugins</groupId>
46+
<artifactId>maven-shade-plugin</artifactId>
47+
<version>3.5.1</version>
48+
<executions>
49+
<execution>
50+
<phase>package</phase>
51+
<goals><goal>shade</goal></goals>
52+
<configuration>
53+
<filters>
54+
<filter>
55+
<artifact>*:*</artifact>
56+
<excludes>
57+
<exclude>META-INF/*.SF</exclude>
58+
<exclude>META-INF/*.DSA</exclude>
59+
<exclude>META-INF/*.RSA</exclude>
60+
</excludes>
61+
</filter>
62+
</filters>
63+
<transformers>
64+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
65+
<mainClass>io.swagger.petstore.Main</mainClass>
66+
</transformer>
67+
</transformers>
68+
</configuration>
69+
</execution>
70+
</executions>
71+
</plugin>
72+
<!-- MODIFIED-->
4273
<plugin>
4374
<artifactId>maven-compiler-plugin</artifactId>
4475
<version>3.11.0</version>
@@ -175,7 +206,23 @@
175206
</plugins>
176207
</build>
177208
<dependencies>
178-
209+
<!--MODIFIED-->
210+
<dependency>
211+
<groupId>org.apache.tomcat.embed</groupId>
212+
<artifactId>tomcat-embed-core</artifactId>
213+
<version>9.0.89</version>
214+
</dependency>
215+
<dependency>
216+
<groupId>org.apache.tomcat.embed</groupId>
217+
<artifactId>tomcat-embed-jasper</artifactId>
218+
<version>9.0.89</version>
219+
</dependency>
220+
<dependency>
221+
<groupId>javax.servlet</groupId>
222+
<artifactId>javax.servlet-api</artifactId>
223+
<version>4.0.1</version>
224+
</dependency>
225+
<!-- MODIFIED-->
179226
<dependency>
180227
<groupId>com.fasterxml.jackson.core</groupId>
181228
<artifactId>jackson-databind</artifactId>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//MODIFIED: This code is a simple Java application that starts an embedded Tomcat server to serve the Swagger Petstore application.
2+
3+
package io.swagger.petstore;
4+
5+
import org.apache.catalina.startup.Tomcat;
6+
7+
import java.io.File;
8+
9+
public class Main {
10+
public static void main(String[] args) throws Exception {
11+
int port = 8080;
12+
13+
if (args.length > 0) {
14+
try {
15+
port = Integer.parseInt(args[0]);
16+
} catch (NumberFormatException e) {
17+
System.err.println("Invalid port number: " + args[0] + ". Using default port 8080.");
18+
}
19+
}
20+
21+
Tomcat tomcat = new Tomcat();
22+
tomcat.setPort(port);
23+
tomcat.getConnector();
24+
25+
String webappDirLocation = "src/main/webapp";
26+
tomcat.addWebapp("", new File(webappDirLocation).getAbsolutePath());
27+
28+
System.out.println("Swagger Petstore running at http://localhost:" + port);
29+
tomcat.start();
30+
tomcat.getServer().await();
31+
}
32+
}

0 commit comments

Comments
 (0)