-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem using mvn at building time #32
Comments
Nothing in /root/.m2 is persisted in the image, you would need to put the jars somewhere else |
Thanks for the quick reply. Based on what you said, this is what worked for me (maybe it can help others): As the repository defined on settings.xml is only available on runtime, I have set it explicitly during my builds. Building the first project:
This has left the jars on
And it found the dependencies on |
Hi @doublebyte1, @carlossg. Thanks for both of your answers. I am actually having a similar issue. How did you customize the contents of setting-docker.xml inside of your image? I currently need to set up a proxy for maven so I am trying to set up the build on a CI with the following image (https://github.com/alirizasaral/Maven-with-Proxy). This works fine, but I have the issue that maven downloads all the dependencies from scratch without caching them inside the repository every time I run a build on the CI. Should I not be using an image based on alpine to get the maven repository to work correctly, or am I missing something more fundamental? |
@KevinSilvaQuintana Add in your Dockerfile
use in all mvn command run again a build with no-cache to avoid to reuse some step that were not creating dependency jar in new repository folder |
Hi @cedricwalter , I actually ended up finding a solution which I have outlined in this post: However, between that and your solution, I am not sure which is more 'clean'. Your approach is very simple and straight forward. However, I think that being able to centralize everything in the CI build file will allow for a more generic re-use for future projects. I'll give it a try though. 👍 |
.m2 is no longer a volume |
I have the following use case:
1 - In the Dockerfile I build a mvn project and generate some jars
2 - then I go and build another project which uses the previous jars as dependencies
with the /root/.m2 volume, I find that the dependency jars (build on step 1), are gone, so I cannot successfully build the second project. This is maybe because the Dockerfile has layers, and the repository is not persisted in the second layer?
I already tried the approach that you advise in the README (using the settings.xml, as persisted repository), but I think this approach is designed to persist the repositories after the build of the Dockerfile , on runtime. I can see this image is designed to use maven on runtime, but what would be the correct way to use it also during building time?
The text was updated successfully, but these errors were encountered: