Skip to content

Commit 3e60683

Browse files
author
Cavero Barca
committed
Add a new project with dependencies to separate the layers
1 parent 78006ab commit 3e60683

File tree

5 files changed

+77
-13
lines changed

5 files changed

+77
-13
lines changed

docker/docker-internal-dto/pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
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/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>com.baeldung.docker</groupId>
8+
<artifactId>docker-spring-boot-parent</artifactId>
9+
<version>0.0.1</version>
10+
</parent>
11+
12+
<artifactId>docker-internal-dto</artifactId>
13+
14+
</project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.baeldung.docker;
2+
3+
public class VariableDto {
4+
5+
private final String value;
6+
7+
public VariableDto(String value) {
8+
this.value = value;
9+
}
10+
11+
public String getValue() {
12+
return value;
13+
}
14+
}

docker/docker-spring-boot/pom.xml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
45
<modelVersion>4.0.0</modelVersion>
56
<parent>
6-
<groupId>org.springframework.boot</groupId>
7-
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>2.3.1.RELEASE</version>
9-
<relativePath/> <!-- lookup parent from repository -->
7+
<groupId>com.baeldung.docker</groupId>
8+
<artifactId>docker-spring-boot-parent</artifactId>
9+
<version>0.0.1</version>
1010
</parent>
11-
<groupId>com.baeldung.docker</groupId>
12-
<artifactId>spring-boot-docker</artifactId>
13-
<version>0.0.1-SNAPSHOT</version>
14-
<name>spring-boot-docker</name>
11+
12+
<artifactId>docker-spring-boot</artifactId>
13+
14+
<name>docker-spring-boot</name>
1515
<description>Demo project showing Spring Boot and Docker</description>
1616

1717
<properties>
18-
<java.version>8</java.version>
18+
<java.version>11</java.version>
1919
</properties>
2020

2121
<dependencies>
@@ -24,6 +24,12 @@
2424
<artifactId>spring-boot-starter-web</artifactId>
2525
</dependency>
2626

27+
<dependency>
28+
<groupId>com.baeldung.docker</groupId>
29+
<artifactId>docker-internal-dto</artifactId>
30+
<version>0.0.1</version>
31+
</dependency>
32+
2733
<dependency>
2834
<groupId>org.springframework.boot</groupId>
2935
<artifactId>spring-boot-starter-test</artifactId>

docker/docker-spring-boot/src/main/docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ RUN java -Djarmode=layertools -jar application.jar extract
99

1010
FROM adoptopenjdk:11-jre-hotspot
1111
COPY --from=builder dependencies/ ./
12-
COPY --from=builder snapshot-dependencies/ ./
13-
COPY --from=builder internal-dependencies/ ./
1412
COPY --from=builder spring-boot-loader/ ./
13+
COPY --from=builder internal-dependencies/ ./
14+
COPY --from=builder snapshot-dependencies/ ./
1515
COPY --from=builder application/ ./
1616
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]

docker/pom.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>org.springframework.boot</groupId>
9+
<artifactId>spring-boot-starter-parent</artifactId>
10+
<version>2.3.1.RELEASE</version>
11+
<relativePath /> <!-- lookup parent from repository -->
12+
</parent>
13+
14+
<groupId>com.baeldung.docker</groupId>
15+
<artifactId>docker-spring-boot-parent</artifactId>
16+
<version>0.0.1</version>
17+
<name>docker-spring-boot-parent</name>
18+
<description>Demo project showing Spring Boot and Docker</description>
19+
<packaging>pom</packaging>
20+
21+
<properties>
22+
<java.version>11</java.version>
23+
</properties>
24+
25+
<modules>
26+
<module>docker-internal-dto</module>
27+
<module>docker-spring-boot</module>
28+
</modules>
29+
30+
</project>

0 commit comments

Comments
 (0)