Skip to content

Commit 0da8d21

Browse files
committed
migrate to springboot based app
1 parent d1742ab commit 0da8d21

File tree

5 files changed

+63
-41
lines changed

5 files changed

+63
-41
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!/entrypoint.sh
3+
!/target/extracted

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
FROM docker.io/tomcat:9.0.87-jre21-temurin-jammy
2-
COPY target/struts-blank.war /usr/local/tomcat/webapps/
1+
FROM docker.io/azul/zulu-openjdk:21.0.1-21.30.15
2+
WORKDIR /app
3+
COPY target/extracted/dependencies/ ./
4+
COPY target/extracted/spring-boot-loader/ ./
5+
COPY target/extracted/snapshot-dependencies/ ./
6+
COPY target/extracted/application/ ./
7+
COPY entrypoint.sh ./
38

9+
ENTRYPOINT ["./entrypoint.sh"]

entrypoint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
main() {
4+
launch
5+
}
6+
7+
launch() {
8+
java \
9+
${DEBUG_PORT:+ -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:${DEBUG_PORT}} \
10+
"org.springframework.boot.loader.launch.WarLauncher"
11+
}
12+
13+
main

pom.xml

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,42 @@
11
<?xml version="1.0"?>
2-
<!--
3-
Licensed to the Apache Software Foundation (ASF) under one or more
4-
contributor license agreements. See the NOTICE file distributed with
5-
this work for additional information regarding copyright ownership.
6-
The ASF licenses this file to You under the Apache License, Version 2.0
7-
(the "License"); you may not use this file except in compliance with
8-
the License. You may obtain a copy of the License at
9-
10-
http://www.apache.org/licenses/LICENSE-2.0
11-
12-
Unless required by applicable law or agreed to in writing, software
13-
distributed under the License is distributed on an "AS IS" BASIS,
14-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
See the License for the specific language governing permissions and
16-
limitations under the License.
17-
-->
18-
19-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
215

226
<modelVersion>4.0.0</modelVersion>
237
<groupId>org.apache.struts</groupId>
248
<artifactId>struts-blank</artifactId>
259
<packaging>war</packaging>
2610
<name>Struts Apps - Blank</name>
2711
<version>1.0.0</version>
28-
12+
<properties>
13+
<maven.compiler.source>21</maven.compiler.source>
14+
<maven.compiler.target>21</maven.compiler.target>
15+
</properties>
16+
<repositories>
17+
<repository>
18+
<id>local-repo</id>
19+
<url>file:../mvn-repo</url>
20+
</repository>
21+
</repositories>
2922
<dependencies>
3023
<dependency>
31-
<groupId>org.apache.struts</groupId>
32-
<artifactId>struts-taglib</artifactId>
33-
<version>1.3.10</version>
34-
</dependency>
35-
<dependency>
36-
<groupId>javax.servlet</groupId>
37-
<artifactId>servlet-api</artifactId>
38-
<version>2.3</version>
39-
<scope>provided</scope>
24+
<groupId>springing-struts</groupId>
25+
<artifactId>struts1-core</artifactId>
26+
<version>1.0.0</version>
4027
</dependency>
4128
</dependencies>
42-
4329
<build>
44-
<finalName>${project.artifactId}</finalName>
4530
<plugins>
4631
<plugin>
47-
<groupId>org.apache.maven.plugins</groupId>
48-
<artifactId>maven-war-plugin</artifactId>
49-
<version>3.4.0</version>
32+
<groupId>org.springframework.boot</groupId>
33+
<artifactId>spring-boot-maven-plugin</artifactId>
34+
<configuration>
35+
<mainClass>springing.struts1.entrypoint.Main</mainClass>
36+
<layout>WAR</layout>
37+
<version>3.2.5</version>
38+
</configuration>
5039
</plugin>
51-
</plugins>
40+
</plugins>
5241
</build>
53-
</project>
42+
</project>

scripts/deploy-local.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))
44
PROJECT_BASE_DIR=$(realpath $SCRIPT_DIR/..)
55

6-
APP_NAME=blank
7-
CONTAINER_NAME=springing-struts1-$APP_NAME
6+
APP_NAME=struts-blank
7+
CONTAINER_NAME=springing-struts-$APP_NAME
88
DOCKER=$((which podman &> /dev/null) && echo podman || echo docker)
99
1010
main() {
@@ -14,7 +14,18 @@ main() {
1414
1515
build() {
1616
(cd $PROJECT_BASE_DIR
17-
mvn clean package -U
17+
mvn \
18+
clean \
19+
dependency:purge-local-repository \
20+
-DreResolve=false \
21+
-DactTransitively=false \
22+
-DmanualInclude='springing-struts' \
23+
package -U \
24+
spring-boot:repackage \
25+
&& java \
26+
-Djarmode=layertools \
27+
-jar target/$APP_NAME-*.war \
28+
extract --destination target/extracted
1829
)
1930
}
2031

0 commit comments

Comments
 (0)