Building the docker image with Maven is stuck
I have a problem creating the docker image with Maven (via intellij or CMD) , as it is stuck on
"Image will be built as server:8030/some-project:latest"
So, i tried to do it via Intellij or Cmd line directly with command (which includes the command docker build)
mvn clean package
Also, did with command
mvn dockerfile:build
And always i get this output :
"C:Program FilesJavajdk1.8.0_201binjava.exe" -Dvisualvm.id=8821691920900 -Dmaven.multiModuleProjectDirectory=C:workspace_gitsome-project"-Dmaven.home=C:Program FilesJetBrainsIntelliJ IDEA 2019.3.3pluginsmavenlibmaven3" "-Dclassworlds.conf=C:Program FilesJetBrainsIntelliJ IDEA 2019.3.3pluginsmavenlibmaven3binm2.conf" "-Dmaven.ext.class.path=C:Program FilesJetBrainsIntelliJ IDEA 2019.3.3pluginsmavenlibmaven-event-listener.jar" "-javaagent:C:Program FilesJetBrainsIntelliJ IDEA 2019.3.3libidea_rt.jar=59091:C:Program FilesJetBrainsIntelliJ IDEA 2019.3.3bin" -Dfile.encoding=UTF-8 -classpath "C:Program FilesJetBrainsIntelliJ IDEA 2019.3.3pluginsmavenlibmaven3bootplexus-classworlds-2.6.0.jar" org.codehaus.classworlds.Launcher -Didea.version2019.3.3 com.spotify:dockerfile-maven-plugin:1.4.13:build
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.myproject:some-project >----------------------
[INFO] Building some-project 2.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- dockerfile-maven-plugin:1.4.13:build (default-cli) @ some-project ---
[INFO] dockerfile: C:workspace_gitsome-projectDockerfile
[INFO] contextDirectory: C:workspace_gitsome-project
[INFO] Building Docker context C:workspace_gitsome-project
[INFO] Path(dockerfile): C:workspace_gitsome-projectDockerfile
[INFO] Path(contextDirectory): C:workspace_gitsome-project
[INFO]
[INFO] Image will be built as server:8030/some-project:latest
[INFO]
I use spotify with latest version build in pom.xml :
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.13</version>
<executions>
<execution>
<id>tag-version</id>
<goals>
<goal>build</goal>
<goal>tag</goal>
<goal>push</goal>
</goals>
<configuration>
<tag>${project.version}</tag>
</configuration>
</execution>
</executions>
<configuration>
<contextDirectory>${project.basedir}</contextDirectory>
<writeTestMetadata>false</writeTestMetadata>
<dockerInfoDirectory>${project.basedir}</dockerInfoDirectory>
<verbose>true</verbose>
<forceCreation>true</forceCreation>
<repository>server:8030/${project.name}</repository>
<dockerfile>Dockerfile</dockerfile>
<pullNewerImage>false</pullNewerImage>
<skipDockerInfo>true</skipDockerInfo>
<useMavenSettingsForAuth>true</useMavenSettingsForAuth>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
If i execute from cmd line but with only below command then the image is build successfully with all commands in DockerFile
docker build .
I don’t know what to do else. Tried to search anyone in internet with similar issue but no success. I uninstalled and installed docker twice… Also maven upgraded to the last one 3.6.3. The settings.xml in .m2 folder is also updated with the server section :
<settings>
....
<servers>
<server>
<id>server:8030</id>
<username>USERNAME</username>
<password>PASSWORD</password>
</server>
</servers>
....
</settings>
I assume that something wrong with maven as it can’t execute with it and without maven docker succeeds and works very well.
Please any advice to help here.
Thanks
Source: Docker Questions