Add a new project with dependencies to separate the layers

This commit is contained in:
Cavero Barca 2020-09-22 01:08:21 +02:00
parent cd89253474
commit f84e609938
5 changed files with 77 additions and 13 deletions

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.baeldung.docker</groupId>
<artifactId>docker-spring-boot-parent</artifactId>
<version>0.0.1</version>
</parent>
<artifactId>docker-internal-dto</artifactId>
</project>

View File

@ -0,0 +1,14 @@
package com.baeldung.docker;
public class VariableDto {
private final String value;
public VariableDto(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}

View File

@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
<groupId>com.baeldung.docker</groupId>
<artifactId>docker-spring-boot-parent</artifactId>
<version>0.0.1</version>
</parent>
<groupId>com.baeldung.docker</groupId>
<artifactId>spring-boot-docker</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring-boot-docker</name>
<artifactId>docker-spring-boot</artifactId>
<name>docker-spring-boot</name>
<description>Demo project showing Spring Boot and Docker</description>
<properties>
<java.version>8</java.version>
<java.version>11</java.version>
</properties>
<dependencies>
@ -24,6 +24,12 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.baeldung.docker</groupId>
<artifactId>docker-internal-dto</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

View File

@ -9,8 +9,8 @@ RUN java -Djarmode=layertools -jar application.jar extract
FROM adoptopenjdk:11-jre-hotspot
COPY --from=builder dependencies/ ./
COPY --from=builder snapshot-dependencies/ ./
COPY --from=builder internal-dependencies/ ./
COPY --from=builder spring-boot-loader/ ./
COPY --from=builder internal-dependencies/ ./
COPY --from=builder snapshot-dependencies/ ./
COPY --from=builder application/ ./
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]

30
docker/pom.xml Normal file
View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.baeldung.docker</groupId>
<artifactId>docker-spring-boot-parent</artifactId>
<version>0.0.1</version>
<name>docker-spring-boot-parent</name>
<description>Demo project showing Spring Boot and Docker</description>
<packaging>pom</packaging>
<properties>
<java.version>11</java.version>
</properties>
<modules>
<module>docker-internal-dto</module>
<module>docker-spring-boot</module>
</modules>
</project>