Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Bug: NPEx when using serverId #89

Closed
aharonha opened this issue May 10, 2015 · 3 comments
Closed

Bug: NPEx when using serverId #89

aharonha opened this issue May 10, 2015 · 3 comments
Labels

Comments

@aharonha
Copy link
Contributor

on my POM I have this

    <build>
...
        <plugins>
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.2.8</version>
                    <configuration>
                        <serverId>docker-hub</serverId>
...
                    </configuration>
            </plugin>
        </plugins>
    </build>

under my settings.xml (xpath //settings/servers/server) I have this:

    <server>
        <id>docker-hub</id>
        <username>******</username>
        <password>*******</password>
    </server>

when running mvn clean install docker:build I get this errors

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.8:build (default-cli) on project k2: Exception caught: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:0.2.8:build (default-cli) on project k2: Exception caught
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    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:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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:117)
    at com.spotify.docker.BuildMojo.execute(BuildMojo.java:79)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: java.lang.NullPointerException
    at com.spotify.docker.AbstractDockerMojo.getEmail(AbstractDockerMojo.java:155)
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:86)
    ... 22 more
aharonha pushed a commit to aharonha/docker-maven-plugin that referenced this issue May 11, 2015
@greglanthier
Copy link

I just ran into this NPE.

Its blocking our ability to use this Maven plugin with our Jenkins CI builds.

We use Config File Provider Plugin and Credentials Plugin for managing the Maven settings.xml file in our build farm. Those plugins will stitch credentials into a settings.xml at the beginning of a build, but the XML stanzas they stitch into the settings.xml file look like this:

<server>
<id>server_id</id>
<username>...</username>
<password>...</password>
</server>

No <configuration><email>...</email></configuration> entries are created.

Perhaps there should be a way to loosen the check on whether an email needs to be present in the settings.xml file for a docker push operation?

@davidxia
Copy link
Contributor

@aharonha @greglanthier Thanks for the bug report.

I believe docker needs the email. The email, password, and username are hashed together and the has is also sent to the server during authentication. Would it help to make the error message more obvious?

@davidxia davidxia added the bug label Jun 10, 2015
davidxia added a commit that referenced this issue Jun 10, 2015
@greglanthier
Copy link

A more obvious error would be useful, sure.

In our CI environment when we do a "docker push" we only login with a usename & password. Perhaps that isn't best practice...

Regardless, the Jenkins configuration plugins I mentioned don't let you specify additional configuration XML stanzas in the <server .../> elements, and since Jenkins drives our entire CI / CD process I'm trying to find a happy compromise between Maven & Jenkins in this case.

Thanks for looking at this so quickly!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants