spotify / docker-maven-plugin

INACTIVE: A maven plugin for Docker
Apache License 2.0
2.66k stars 575 forks source link

Error in using private docker registery: java.lang.ArrayIndexOutOfBoundsException: 255 #362

Closed huadong closed 6 years ago

huadong commented 6 years ago

Description

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (build-image) on project xxxx: Exception caught: 255 -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (build-image) on project xxxx: Exception 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:497) 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: 255 at org.glassfish.jersey.internal.util.Base64.encode(Base64.java:100) 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

How to reproduce

  1. login private registery of docker using docker cli
  2. build the image using mvn command

pom.xml

<plugin>
    <groupId>com.spotify</groupId>
    <artifactId>docker-maven-plugin</artifactId>
    <version>1.0.0</version>
    <executions>
        <execution>
            <id>build-image</id>
            <phase>package</phase>
            <goals>
                <goal>build</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <imageName>${project.groupId}_${project.artifactId}:${project.version}</imageName>
        <imageTags>
            <imageTag>latest</imageTag>
            <imageTag>${profiles.active}</imageTag>
        </imageTags>
        <dockerDirectory>${project.build.directory}/docker</dockerDirectory>
        <resources>
            <resource>
                <targetPath>/</targetPath>
                <directory>${project.build.directory}</directory>
                <include>${project.build.finalName}.jar</include>
                <include>lib/*</include>
            </resource>
        </resources>
    </configuration>
</plugin>

Software:

davidxia commented 6 years ago

fixed by https://github.com/spotify/docker-client/pull/942