【发布时间】:2019-08-07 17:26:43
【问题描述】:
我正在使用 docker-maven-plugin 为 Java 微服务创建 dockerfile 和 docker 映像。当我运行命令mvn package -DskipTest=true 时,它不会创建 Dockerfile。
我正在使用 docker-maven-plugin 为 Java 微服务创建 dockerfile 和 docker 映像。当我运行命令mvn package -DskipTest=true 时。它成功运行,没有任何错误,但它不会生成 Dockerfile。查看发送到屏幕的消息,虽然它是在“构建”中配置的,但该插件看起来并没有运行
以下是 pom.xml 中构建任务的配置:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<imageName>explorecali-${ec-profile}</imageName>
<baseImage>java</baseImage>
<entryPoint>["java", "-Dspring.profiles.active=${ec-profile}", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<forceTags>true</forceTags>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
没有错误消息,但没有 Dockefile。以下是我运行它时向屏幕发出的消息:
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.example.ec:explorecali >---------------------
[INFO] Building explorecali 2.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ explorecali ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] Copying 7 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ explorecali ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ explorecali ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\fikhas\dev\spring\Ex_Files_Ext_Docker_Spring_Boot\Exercise Files\Ch05\05_05\explorecali\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ explorecali ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ explorecali ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ explorecali ---
[INFO] Building jar: C:\Users\fikhas\dev\spring\Ex_Files_Ext_Docker_Spring_Boot\Exercise Files\Ch05\05_05\explorecali\target\explorecali-2.0.0-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.0.1.RELEASE:repackage (default) @ explorecali ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.576 s
[INFO] Finished at: 2019-08-07T13:25:58-04:00
[INFO] ------------------------------------------------------------------------
【问题讨论】:
标签: maven docker dockerfile