在IDEA中打包项目自动部署在docker容器,这个坑应该很少有人踩,分享给大家。
Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (default-cli) on project microservice-cloud-11-config-server-5001: Exception caught: 238 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (default-cli) on project microservice-cloud-11-config-server-5001: Exceptio
n caught
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception caught
at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:151)
at com.spotify.docker.BuildMojo.execute(BuildMojo.java:87)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
… 20 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 238
at org.glassfish.jersey.internal.util.Base64.encode(Base64.java:98)
at org.glassfish.jersey.internal.util.Base64.encodeAsString(Base64.java:169)
at org.glassfish.jersey.internal.util.Base64.encodeAsString(Base64.java:185)
at com.spotify.docker.client.DefaultDockerClient.authRegistryHeader(DefaultDockerClient.java:2447)
at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1379)
at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1348)
at com.spotify.docker.BuildMojo.buildImage(BuildMojo.java:580)
at com.spotify.docker.BuildMojo.execute(BuildMojo.java:360)
at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:149)
… 23 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

E:\SpringBootProject\springCloud\microservice-cloud-01\microservice-cloud-11-config-server-5001>mvn clean package docker:build -DpushImage
[INFO] Scanning for projects…
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building microservice-cloud-11-config-server-5001 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] — maven-clean-plugin:3.0.0:clean (default-clean) @ microservice-cloud-11-config-server-5001 —
[INFO] Deleting E:\SpringBootProject\springCloud\microservice-cloud-01\microservice-cloud-11-config-server-5001\target
[INFO]
[INFO] — maven-resources-plugin:3.0.2:resources (default-resources) @ microservice-cloud-11-config-server-5001 —
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] — maven-compiler-plugin:3.7.0:compile (default-compile) @ microservice-cloud-11-config-server-5001 —
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to E:\SpringBootProject\springCloud\microservice-cloud-01\microservice-cloud-11-config-server-5001\target\classes
[INFO]
[INFO] — maven-resources-plugin:3.0.2:testResources (default-testResources) @ microservice-cloud-11-config-server-5001 —
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\SpringBootProject\springCloud\microservice-cloud-01\microservice-cloud-11-config-server-5001\src\test\resources
[INFO]
[INFO] — maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ microservice-cloud-11-config-server-5001 —
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] — maven-surefire-plugin:2.21.0:test (default-test) @ microservice-cloud-11-config-server-5001 —
[INFO] No tests to run.
[INFO]
[INFO] — maven-jar-plugin:3.0.2:jar (default-jar) @ microservice-cloud-11-config-server-5001 —
[INFO] Building jar: E:\SpringBootProject\springCloud\microservice-cloud-01\microservice-cloud-11-config-server-5001\target\config.jar
[INFO]
[INFO] — spring-boot-maven-plugin:2.0.7.RELEASE:repackage (default) @ microservice-cloud-11-config-server-5001 —
[INFO]
[INFO] — docker-maven-plugin:1.0.0:build (default-cli) @ microservice-cloud-11-config-server-5001 —
[INFO] Using authentication suppliers: [ConfigFileRegistryAuthSupplier, NoOpRegistryAuthSupplier]
[INFO] Copying E:\SpringBootProject\springCloud\microservice-cloud-01\microservice-cloud-11-config-server-5001\target\config.jar -> E:\SpringBootProject\springCloud\microservice-cloud-01\microservic
e-cloud-11-config-server-5001\target\docker\config.jar
[INFO] Building image registry.cn-hangzhou.aliyuncs.com/haogenmin/microservice-cloud-11-config-server-5001:1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.670 s
[INFO] Finished at: 2020-05-06T12:36:53+08:00
[INFO] Final Memory: 51M/415M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (default-cli) on project microservice-cloud-11-config-server-5001: Exception caught: 238 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

很简单,我用的阿里云的镜像库,阿里云的账号可以是中文,但是,在这里上传就会报错,改成英文即可……
https://github.com/spotify/docker-maven-plugin/issues

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐