Comments (9)
BTW, does the problem persist when you start with a fresh daemon after authenticating with docker? Something like
docker login mvnd --stop mvnd package
If that works, it could mean that the docker plugin is keeping some global state, which would have to be fixed in the plugin.
No, still fails with missing authentication. I only have to login to our Docker registry once. After a successful login, mvn package
just works (also docker pull/push
).
Only a manual docker logout
or an update of the authentication parameters would let the build fail.
from maven-mvnd.
Could you please run mvnd package -e
and paste the stack trace?
from maven-mvnd.
The problem sounds similar to #157
Why do you think so? I do not see any system properties mentioned in your report.
from maven-mvnd.
BTW, does the problem persist when you start with a fresh daemon after authenticating with docker? Something like
docker login
mvnd --stop
mvnd package
If that works, it could mean that the docker plugin is keeping some global state, which would have to be fixed in the plugin.
from maven-mvnd.
Could you please run
mvnd package -e
and paste the stack trace?
$ mvnd package
[omitted previous steps like compile]
[INFO] --- dockerfile:1.4.13:build (package) @ <module> ---
[INFO] Google Container Registry support is disabled
[INFO] dockerfile: <path>/target/Dockerfile
[INFO] contextDirectory: <path>/<module>
[INFO] Building Docker context <path>/<module>
[INFO] Path(dockerfile): <path>/<module>/target/Dockerfile
[INFO] Path(contextDirectory): <path>/<module>
[INFO]
[INFO] Image will be built as <company-registry-url>/<module>:<version>
[INFO]
[INFO] Step 1/20 : FROM <company-registry-url>/eclipse-temurin:17.0.8_7-jre-alpine
[INFO]
[ERROR] Head "<company-registry-url/eclipse-temurin/manifests/17.0.8_7-jre-alpine": unknown: Authentication is required
[WARNING] An attempt failed, will retry 1 more timesorg.apache.maven.plugin.MojoExecutionException: Could not build image
at com.spotify.plugin.dockerfile.BuildMojo.buildImage (BuildMojo.java:247)
at com.spotify.plugin.dockerfile.BuildMojo.execute (BuildMojo.java:135)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute (AbstractDockerMojo.java:265)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute (AbstractDockerMojo.java:254)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:143)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:330)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:318)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:214)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:74)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:111)
at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject (SmartBuilderImpl.java:209)
at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run (SmartBuilderImpl.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
at java.lang.Thread.run (Thread.java:840)
Caused by: com.spotify.docker.client.exceptions.DockerException: Head "<company-registry-url>/eclipse-temurin/manifests/17.0.8_7-jre-alpine": unknown: Authentication is required
at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleError (LoggingProgressHandler.java:105)
at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress (LoggingProgressHandler.java:63)
at com.spotify.docker.client.DefaultDockerClient$BuildProgressHandler.progress (DefaultDockerClient.java:312)
at com.spotify.docker.client.ProgressStream.tail (ProgressStream.java:77)
at com.spotify.docker.client.DefaultDockerClient$ResponseTailReader.call (DefaultDockerClient.java:2754)
at com.spotify.docker.client.DefaultDockerClient$ResponseTailReader.call (DefaultDockerClient.java:2738)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
at java.lang.Thread.run (Thread.java:840)
[INFO] Google Container Registry support is disabled
[INFO] dockerfile: <path>/target/Dockerfile
[INFO] contextDirectory: <path>/<module>
[INFO] Building Docker context <path>/<module>
[INFO] Path(dockerfile): <path>/<module>/target/Dockerfile
[INFO] Path(contextDirectory): <path>/<module>
[INFO]
[INFO] Image will be built as <company-registry-url>/<module>:<version>
[INFO]
[INFO] Step 1/20 : FROM <company-registry-url>/eclipse-temurin:17.0.8_7-jre-alpine
[INFO]
[ERROR] Head "<company-registry-url>/eclipse-temurin/manifests/17.0.8_7-jre-alpine": unknown: Authentication is required
[INFO] --------------------------------------------------------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] --------------------------------------------------------------------------------------------------------------------------
[INFO] Total time: 33.002 s (Wall Clock)
[INFO] Finished at: 2024-02-14T07:09:46Z
[INFO] --------------------------------------------------------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.13:build (package) on project <module>: Could not build image: Head "<company-registry-url>/eclipse-temurin/manifests/17.0.8_7-jre-alpine": unknown: Authentication is required -> [Help 1]org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.13:build (package) on project <module>: Could not build image
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:336)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:318)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:214)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:74)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:111)
at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject (SmartBuilderImpl.java:209)
at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run (SmartBuilderImpl.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
at java.lang.Thread.run (Thread.java:840)
Caused by: org.apache.maven.plugin.MojoExecutionException: Could not build image
at com.spotify.plugin.dockerfile.BuildMojo.buildImage (BuildMojo.java:247)
at com.spotify.plugin.dockerfile.BuildMojo.execute (BuildMojo.java:135)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute (AbstractDockerMojo.java:265)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute (AbstractDockerMojo.java:254)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:143)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:330)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:318)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:214)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:74)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:111)
at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject (SmartBuilderImpl.java:209)
at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run (SmartBuilderImpl.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
at java.lang.Thread.run (Thread.java:840)
Caused by: com.spotify.docker.client.exceptions.DockerException: Head "<company-registry-url>/eclipse-temurin/manifests/17.0.8_7-jre-alpine": unknown: Authentication is required
at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleError (LoggingProgressHandler.java:105)
at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress (LoggingProgressHandler.java:63)
at com.spotify.docker.client.DefaultDockerClient$BuildProgressHandler.progress (DefaultDockerClient.java:312)
at com.spotify.docker.client.ProgressStream.tail (ProgressStream.java:77)
at com.spotify.docker.client.DefaultDockerClient$ResponseTailReader.call (DefaultDockerClient.java:2754)
at com.spotify.docker.client.DefaultDockerClient$ResponseTailReader.call (DefaultDockerClient.java:2738)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
at java.lang.Thread.run (Thread.java:840)
from maven-mvnd.
I guess one would have to debug the execution of the plugin to see why it does not pick the credentials. Esp. the AuthSuppliers enabled in https://github.com/spotify/dockerfile-maven/blob/986f960cb82085d2f666acd6c2682672d47f5bb0/plugin/src/main/java/com/spotify/plugin/dockerfile/AbstractDockerMojo.java#L450 would be interesting.
You can pass -Dmvnd.debug
to mvnd
to start the daemon in debug mode. See mvnd --help
for more info.
from maven-mvnd.
The problem is the property -Ddockerfile.useMavenSettingsForAuth
of the plugin dockerfile-maven-plugin
.
I set it to true
in my .mavenrc
file.
Setting it as a CLI option does work:
mvnd package -Ddockerfile.useMavenSettingsForAuth=true
So does adding it to the [project-home]/.mvn/jvm.config
like stated in this comment: #567 (comment)
But it does not work, when I add it to the user property file ~/.m2/mvnd.properties
like this:
mvnd.jvmArgs=-Ddockerfile.useMavenSettingsForAuth\=true
Stated in this comment: #567 (comment)
How can I achieve that? Is that even possible?
(we set other options like the path to a keystore with -Djavax.net.ssl.keyStore
). So I would like to set these options in the property file of the user
from maven-mvnd.
Thanks for the investigation @reissseb.
Apparently mvnd does not honor .mavenrc.
In case of stock Maven it is sourced inside the mvn
shell script:
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
It is honored by mvnd.sh
though - using mvnd.sh
instead of mvnd
would be the most straightforward workaround for your problem.
I do not think mvnd.properties
is the right place for this.
Another possible way of solving this would be to put those local properties into a profile in settings.xml that would be active by default.
@gnodet do you think we should support .mavenrc
?
from maven-mvnd.
That doesn't work either. The property is set as a MAVEN_OPTS
in the .mavenrc
:
MAVEN_OPTS="-Ddockerfile.useMavenSettingsForAuth=true"
And MAVEN_OPTS
is not supported by mvnd
AFAIK.
I guess I am back to using jvm.config
or the CLI option.
Thanks for your help @ppalaga
from maven-mvnd.
Related Issues (20)
- exec clean package install command display garbled codes HOT 1
- Detect smart builder in .mvn/extensions.xml and ignore it
- Support comments in .mvn/maven.config (the same way as Maven does)
- Mvnd complains about comments in .mvn/maven.config
- Interpolation in .mvn/maven.config HOT 3
- String index out of range when paramter is malformed
- Would it be possible to have linux arm64 as a standard release asset? HOT 1
- Update: Maven 3.9.6 + Resolver 1.9.18
- if i use nixos system, how can i install HOT 1
- TerminalOutput.pathToMaven throws StringIndexOutOfBoundsException HOT 5
- Unsupported socket address: ''
- Pick up Maven 3.9.7, OR at least resolver 1.9.19
- Make mvnd Java17 HOT 1
- Make client thin HOT 1
- mvnd happily fails to load extension and continues on
- Mvnd should fail is extension cannot be loaded
- maven-git-versioning-extension extension is not supported HOT 1
- Split mvnd for Maven 3.x and 4.x support HOT 1
- Hang with SpotBugs plugin and fork=false HOT 2
- If Maven Daemon executes in 0.2s, the summary output might be printed too early HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from maven-mvnd.