<?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> <groupId>org.example</groupId> <artifactId>code-test</artifactId> <version>1.0.0</version> <!--导入springboot 父工程--> <parent> <artifactId>spring-boot-starter-parent</artifactId> <groupId>org.springframework.boot</groupId> <version>2.5.3</version> </parent> <!--导入web项目场景启动器 会自动导入和web开发相关的依赖--> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> <profiles> <profile> <id>dev</id> <!--默认激活当前配置--> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <profiles.active>dev</profiles.active> <!-- Docker 配置 --> <docker.dockerHost>http://172.16.90.64:22375</docker.dockerHost> <docker.serviceId>DockerHub</docker.serviceId> <docker.image.version>1.0.0</docker.image.version> </properties> </profile> <profile> <id>pro</id> <properties> <profiles.active>pro</profiles.active> <!-- Docker 配置 --> <docker.dockerHost>http://172.17.14.184:22375</docker.dockerHost> <docker.serviceId>DockerHub</docker.serviceId> <docker.image.version>1.0.1</docker.image.version> </properties> </profile> </profiles> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18.1</version> <configuration> <skipTests>true</skipTests> </configuration> </plugin> <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>1.2.2</version> <configuration> <serverId>${docker.serviceId}</serverId> <dockerHost>${docker.dockerHost}</dockerHost> <imageName>docker.io/${project.artifactId}:${docker.image.version}</imageName> <dockerDirectory>${project.basedir}</dockerDirectory> <resources> <resource> <targetPath>/</targetPath> <directory>${project.build.directory}</directory> <include>${project.build.finalName}.jar</include> </resource> </resources> </configuration> </plugin> </plugins> </build> </project>