You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Adam Sandor <ad...@container-solutions.com> on 2018/03/05 08:37:29 UTC
Re: per-warm the maven cache for 2 stage Docker build
Thank you all for the helpful answers. Some of the articles linked does
indeed have a working solution - using "mvn install" instead of "mvn
dependency:go-offline". That way everything gets downloaded. The reason
that wasn't working for me was, that I'm using the Spring Boot plugin which
looks for a main class - so it cannot be run on a pom file with no sources.
I'm still wondering however about the contract for dependency:go-offline...
how can you go-offline if only a part of your dependencies get's cached and
as soon as you try to run install you will run into missing deps?
So the question of the day (maybe worth another thread) is "Isn't mvn
dependency:go-offline supposed to download all dependencies?"
On Tue, Feb 20, 2018 at 7:37 PM Laird Nelson <lj...@gmail.com> wrote:
> On Sun, Feb 4, 2018 at 3:58 AM Adam Sandor <
> adam.sandor@container-solutions.com> wrote:
>
> > The only missing piece of the puzzle I can’t figure out is how to force
> > Maven to download ALL dependencies just by using the pom file and not
> > executing any compilation.
>
> [snip]
>
> > Now the problem - Maven’s lazy downloading of dependencies. Even if I try
> > to execute “mvn dependency:go-offline” Maven still doesn’t download
> plugins
> > and other dependencies, which would only be required during the packaging
> > phase.
> >
>
> I dimly recall that if you just do:
>
> mvn dependency:go-offline
>
> …you end up running version 2.8.something of the maven-dependency-plugin.
> Its most recent version is 3.0.2. I also seem to remember that this fixed
> the issue you describe above. Maybe try:
>
> mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.2:go-offline
>
> …? Good luck.
>
> Best,
> Laird
>
--
Ádám Sándor
Senior Engineer / Consultant
Container Solutions <http://container-solutions.com/>
0680126174
<https://twitter.com/adamsand0r> <https://www.linkedin.com/in/adamsandor/>
Re: per-warm the maven cache for 2 stage Docker build
Posted by Mirko Friedenhagen <mf...@gmail.com>.
Hello Adam,
as stated on the goal page[0] dependency:go-offline "Requires
dependency resolution of artifacts in scope: test". In multi-module
projects it might even fail because of unresolvable SNAPSHOT modules
of the current reactor.
I use this shell script (I call it mvn-go-offline):
--- snip ---
#!/bin/sh
# DESC: Try to download everything needed for building/testing the project.
MVN=${MVN:-mvn}
VERSION=3.0.2
PLUGIN=org.apache.maven.plugins:maven-dependency-plugin:${VERSION}
exec ${MVN} -e -V $* $PLUGIN:resolve-plugins $PLUGIN:go-offline $PLUGIN:sources
--- snap ---
and call e.g. `mvn-go-offline test-compile`.
Regards
Mirko
[0] https://maven.apache.org/plugins/maven-dependency-plugin/go-offline-mojo.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: per-warm the maven cache for 2 stage Docker build
Posted by Adam Sandor <ad...@container-solutions.com>.
Hi Chris,
Thank you, that's very helpful. To give a bit more context here - I'm
searching for the *right* way to do Maven builds in a multi-stage Docker
environment. This means I don't want to go into such elaborate workarounds.
I have to end up with a very clean build which I can blog about to show how
to properly do multi-stage Dockers builds with Java. Basically I'm
searching for the equivalent of doing "npm install". I think it is very
important that Maven would support these builds in an elegant way without
any workarounds as multi-stage Docker builds might be the future of CI
environments.
Adam
On Mon, Mar 5, 2018 at 9:58 AM Christofer Dutz <ch...@c-ware.de>
wrote:
> Hi,
>
> When creating a maven plugin for the Edgent project, I also setup an
> integration-test
> That allows me to test the functionality of the plugin. I used the
> mrm-maven-plugin and the maven-invoker-plugin to get a dedicated local
> maven repo that is filled with all artifacts pulled in during the build.
> Eventually it might help you with your problem.
>
> Just have a look at this build:
>
> https://github.com/apache/incubator-edgent/tree/develop/utils/edgent-deployment-filter-maven-plugin
>
> Chris
>
>
> Am 05.03.18, 09:37 schrieb "Adam Sandor" <
> adam.sandor@container-solutions.com>:
>
> Thank you all for the helpful answers. Some of the articles linked does
> indeed have a working solution - using "mvn install" instead of "mvn
> dependency:go-offline". That way everything gets downloaded. The reason
> that wasn't working for me was, that I'm using the Spring Boot plugin
> which
> looks for a main class - so it cannot be run on a pom file with no
> sources.
> I'm still wondering however about the contract for
> dependency:go-offline...
> how can you go-offline if only a part of your dependencies get's
> cached and
> as soon as you try to run install you will run into missing deps?
> So the question of the day (maybe worth another thread) is "Isn't mvn
> dependency:go-offline supposed to download all dependencies?"
>
> On Tue, Feb 20, 2018 at 7:37 PM Laird Nelson <lj...@gmail.com>
> wrote:
>
> > On Sun, Feb 4, 2018 at 3:58 AM Adam Sandor <
> > adam.sandor@container-solutions.com> wrote:
> >
> > > The only missing piece of the puzzle I can’t figure out is how to
> force
> > > Maven to download ALL dependencies just by using the pom file and
> not
> > > executing any compilation.
> >
> > [snip]
> >
> > > Now the problem - Maven’s lazy downloading of dependencies. Even
> if I try
> > > to execute “mvn dependency:go-offline” Maven still doesn’t download
> > plugins
> > > and other dependencies, which would only be required during the
> packaging
> > > phase.
> > >
> >
> > I dimly recall that if you just do:
> >
> > mvn dependency:go-offline
> >
> > …you end up running version 2.8.something of the
> maven-dependency-plugin.
> > Its most recent version is 3.0.2. I also seem to remember that this
> fixed
> > the issue you describe above. Maybe try:
> >
> > mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.2:go-offline
> >
> > …? Good luck.
> >
> > Best,
> > Laird
> >
> --
>
> Ádám Sándor
>
> Senior Engineer / Consultant
>
> Container Solutions <http://container-solutions.com/>
>
> 0680126174
>
> <https://twitter.com/adamsand0r> <
> https://www.linkedin.com/in/adamsandor/>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
Re: per-warm the maven cache for 2 stage Docker build
Posted by Christofer Dutz <ch...@c-ware.de>.
Hi,
When creating a maven plugin for the Edgent project, I also setup an integration-test
That allows me to test the functionality of the plugin. I used the mrm-maven-plugin and the maven-invoker-plugin to get a dedicated local maven repo that is filled with all artifacts pulled in during the build. Eventually it might help you with your problem.
Just have a look at this build:
https://github.com/apache/incubator-edgent/tree/develop/utils/edgent-deployment-filter-maven-plugin
Chris
Am 05.03.18, 09:37 schrieb "Adam Sandor" <ad...@container-solutions.com>:
Thank you all for the helpful answers. Some of the articles linked does
indeed have a working solution - using "mvn install" instead of "mvn
dependency:go-offline". That way everything gets downloaded. The reason
that wasn't working for me was, that I'm using the Spring Boot plugin which
looks for a main class - so it cannot be run on a pom file with no sources.
I'm still wondering however about the contract for dependency:go-offline...
how can you go-offline if only a part of your dependencies get's cached and
as soon as you try to run install you will run into missing deps?
So the question of the day (maybe worth another thread) is "Isn't mvn
dependency:go-offline supposed to download all dependencies?"
On Tue, Feb 20, 2018 at 7:37 PM Laird Nelson <lj...@gmail.com> wrote:
> On Sun, Feb 4, 2018 at 3:58 AM Adam Sandor <
> adam.sandor@container-solutions.com> wrote:
>
> > The only missing piece of the puzzle I can’t figure out is how to force
> > Maven to download ALL dependencies just by using the pom file and not
> > executing any compilation.
>
> [snip]
>
> > Now the problem - Maven’s lazy downloading of dependencies. Even if I try
> > to execute “mvn dependency:go-offline” Maven still doesn’t download
> plugins
> > and other dependencies, which would only be required during the packaging
> > phase.
> >
>
> I dimly recall that if you just do:
>
> mvn dependency:go-offline
>
> …you end up running version 2.8.something of the maven-dependency-plugin.
> Its most recent version is 3.0.2. I also seem to remember that this fixed
> the issue you describe above. Maybe try:
>
> mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.2:go-offline
>
> …? Good luck.
>
> Best,
> Laird
>
--
Ádám Sándor
Senior Engineer / Consultant
Container Solutions <http://container-solutions.com/>
0680126174
<https://twitter.com/adamsand0r> <https://www.linkedin.com/in/adamsandor/>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org