<?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"> <parent> <artifactId>docker</artifactId> <groupId>com.jd.blockchain</groupId> <version>1.4.2.RELEASE</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>docker-demo</artifactId> <dependencies> <dependency> <groupId>com.jd.blockchain</groupId> <artifactId>docker-sdk</artifactId> <version>${project.version}</version> </dependency> </dependencies> <build> <finalName>jdchain-demo</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> <optimize>false</optimize> <debug>true</debug> <showDeprecation>false</showDeprecation> <showWarnings>false</showWarnings> </configuration> </plugin> <!-- <plugin>--> <!-- <groupId>org.apache.maven.plugins</groupId>--> <!-- <artifactId>maven-dependency-plugin</artifactId>--> <!-- <executions>--> <!-- <execution>--> <!-- <id>copy-dependencies</id>--> <!-- <phase>package</phase>--> <!-- <goals>--> <!-- <goal>copy-dependencies</goal>--> <!-- </goals>--> <!-- <configuration>--> <!-- <outputDirectory>${project.build.directory}/dependencies</outputDirectory>--> <!-- <excludeTransitive>false</excludeTransitive>--> <!-- <stripVersion>false</stripVersion>--> <!-- <includeScope>runtime</includeScope>--> <!-- </configuration>--> <!-- </execution>--> <!-- </executions>--> <!-- </plugin>--> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> <executions> <execution> <id>copy-resources</id> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <!-- 将资源文件拷贝到config目录下 --> <encoding>UTF-8</encoding> <outputDirectory>${project.basedir}/src/main/docker/zip</outputDirectory> <overwrite>false</overwrite> <resources> <resource> <directory>${project.basedir}/../../deploy-peer/target/</directory> <filtering>false</filtering> <includes> <include>jdchain-peer-${project.version}.zip</include> </includes> </resource> <resource> <directory>${project.basedir}/../../deploy-gateway/target/</directory> <filtering>false</filtering> <includes> <include>jdchain-gateway-${project.version}.zip</include> </includes> </resource> <!-- sdk --> <resource> <directory>${project.basedir}/../docker-sdk/target/</directory> <filtering>false</filtering> <includes> <include>docker-sdk-${project.version}.jar</include> </includes> </resource> </resources> </configuration> </execution> </executions> </plugin> <!-- 使用Maven插件直接将应用打包为一个Docker镜像 --> <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>1.2.2</version> <!--将插件绑定在某个phase执行--> <executions> <execution> <id>build-image</id> <!--将插件绑定在package这个phase上。也就是说,用户只需执行mvn package ,就会自动执行mvn docker:build--> <phase>package</phase> <goals> <goal>build</goal> </goals> </execution> </executions> <configuration> <imageName>jdchain-demo</imageName> <imageTags> <imageTag>${project.version}</imageTag> </imageTags> <!-- 指定 Dockerfile 路径--> <dockerDirectory>${project.basedir}/target</dockerDirectory> </configuration> </plugin> </plugins> </build> </project>