Dockerfile-maven: Logger injection error during install when running with Maven < 3.5.x

Created on 21 Nov 2018  路  16Comments  路  Source: spotify/dockerfile-maven

Is this a BUG REPORT or FEATURE REQUEST?: Bug report

Description

When running mvn install with the plugin on Maven 3.3.9 (the default version embedded with Intellij 2018.2), the following injection error occurs and causes the build to fail.

java.lang.IllegalArgumentException: Can not set org.eclipse.aether.spi.log.Logger field org.apache.maven.repository.internal.DefaultVersionResolver.logger to org.eclipse.aether.internal.impl.slf4j.Slf4jLoggerFactory

With Maven 3.5.4 the error disappears.

Similar problem here, with full stacktrace: https://github.com/jeremylong/DependencyCheck/issues/1054

How to reproduce

Use the plugin with Maven 3.3.9 using the plugin configuration below and run mvn install.

<plugin>
    <groupId>com.spotify</groupId>
    <artifactId>dockerfile-maven-plugin</artifactId>
    <version>1.4.8</version>
    <executions>
        <execution>
            <id>deploy-image</id>
            <goals>
                <goal>build</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <!-- must not contain uppercase letters or docker refuses connection! -->
        <repository>foo/bar-app</repository>
        <buildArgs>
            <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
        </buildArgs>
    </configuration>
</plugin>

What do you expect

Build should succeed

What happened instead

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:10 min
[INFO] Finished at: 2018-11-21T15:05:46+01:00
[INFO] Final Memory: 52M/393M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.5.2:install (default-install) on project gateway: Execution default-install of goal org.apache.maven.plugins:maven-install-plugin:2.5.2:install failed: Unable to load the mojo 'install' (or one of its required components) from the plugin 'org.apache.maven.plugins:maven-install-plugin:2.5.2': com.google.inject.ProvisionException: Unable to provision, see the following errors:
...
[ERROR] 4 errors

Software:

  • Output of docker version:

Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:21:34 2018
OS/Arch: windows/amd64
Experimental: false

Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:29:02 2018
OS/Arch: linux/amd64
Experimental: false

  • Spotify's dockerfile-maven version: 1.4.8

Full backtrace

Four long stacktraces show that a logger could not be injected four times, too long to paste here

stale

Most helpful comment

I'm seeing this issue as well, using maven 3.3.9 and dockerfile-maven-plugin 1.4.10. Please mark the required maven version in the POM

All 16 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I was getting the issue with version 1.4.10 of the plugin, but reverting to version 1.4.1 fixed it.

We got the same issue with IntelliJ 2018.3.4. Last plugin version that works is 1.4.6 , all later versions produce the same error.

We ran into the same issue after trying to update the maven plugin version. We are not able to use maven inside latest Intellij 2018.3 with all plugin versions since 1.4.7. Need to downgrade to 1.4.6.

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /opt/intellij-2018.3/plugins/maven/lib/maven3
Java version: 1.8.0_181, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre

I found a bit more on this issue in https://stackoverflow.com/questions/47920305/can-not-set-org-eclipse-aether-spi-log-logger-with-custom-maven-plugin

It seems like a general issue with Maven plugins, not something unique to dockerfile-maven-plugin.

I think the specific commit in this repo where this started is https://github.com/spotify/dockerfile-maven/commit/6744acf3335802b3c04a062155543ad9300f9f52 where we upgraded the maven-core and other dependencies to be able to support Java 11.

I'm seeing this issue as well, using maven 3.3.9 and dockerfile-maven-plugin 1.4.10. Please mark the required maven version in the POM

Reproduced the error, with Maven embedded in Eclipse (3.3.3). The error occurred when trying to push, but I got no error when building the image.
I agree about the maven enforcer plugin said by @hauntingEcho, and please also put in documentation that dockerfile-maven-plugin <=1.4.6 needs Maven 3.X, and for other case Maven >= 3.5.2.

I ended up here having the same error. It used to work before when I used oracle java - now I use open JDK

Apache Maven 3.6.0
Java version: 1.8.0_212, vendor: Oracle Corporation
1.4.10

, this works now. I just changed back to Oracle java.

With openjdk version "1.8.0_212" I get the error.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

bumping to save the issue from stalebot

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Up. There is no reason why a change of documentation should be difficult, I can do a PR if the author wants. The only change I ask is to clarify the Maven version prerequisite.

@antoinetran a PR is definitely welcome

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings