Well, it's getting slightly off topic, but maybe not.
With Maven, I strongly recommend you *totally* wipe out the local Maven
cache (aka repository, misleadingly named) on a regular basis. Like once a
week or so.
You could have a local release version, that has actually been built only
locally. So it would stay here, possibly hiding the real one, forever until
you remove it.
So, yes, using dependency:purge-local-repository can help that use
case/issue, but again IMO it's not worth it: just wipe out everything and
redownload.

In CI, because the reproducibility and non-flakiness should be valued
over/before anything else, automate this to be done every day or so.
Ideally, every single builds.
Bottom line: engineering time is orders of magnitude more expensive than
disk space and bandwidth. You don't want your build to fail (or *not* fail)
when it should (not) and have to dig into this.

Having a private repo/cache per job helps mitigate this, but certainly does
not remove the need to wipe it out as often as possible.

And it's not just me, see
http://blog.sonatype.com/2009/01/maven-continuous-integration-best-practices/

-- Baptiste

2017-09-12 14:30 GMT+02:00 John Patrick <[email protected]>:

> I do similar to Eric for jenkins.
>
> But also for both developer builds and jenkins, I've got all projects
> setup to use the
> http://www.mojohaus.org/build-helper-maven-plugin/remove-
> project-artifact-mojo.html
> plugin. With both a default and clean phase execution. So when either
> jenkins or a developer does a clean, old artifacts are removed. This I
> find stops the need to intervention of having to manually clean up the
> local repo.
>
> I've also got a local artifactory instance running inside a vagrant
> vm, so i can safely delete my local repo if I've trouble and it can
> download what i needs to again. It also helps when working offline or
> over a slow internet connection as most things I've already download
> previously.
>
> John
>
>
>
>
> On 12 September 2017 at 12:56, Eric B <[email protected]> wrote:
> > I have my jenkins jobs designed to use private m2 repos per job.  I dont
> > find the need to delete them since the only transient changes are the
> > snapshots, which get reevaluated at every build anyhow.
> >
> > Thanks
> >
> > Eric
> >
> >
> > On Sep 11, 2017 2:43 PM, "Stephen Connolly" <
> [email protected]>
> > wrote:
> >
> > On Fri 8 Sep 2017 at 11:22, Baptiste Mathus <[email protected]> wrote:
> >
> >> Le 7 sept. 2017 17:00, "Tushar Kapila" <[email protected]> a écrit :
> >>
> >> I had to delete a directory once as i had pressed Ctrl-C while it was
> >> downloading jars and a 0kb jar was created. This was in 2013, maybe it
> >> downloads to a temp file and then create the final file? It took
> sometime
> >> to debug. Builds were failing for no reason only on that test box, but
> >> working fine on my dev box, lots of fun.
> >>
> >> > If you don't, and
> >> > you have static (persistent) agents, very bad things will happen at
> some
> >> point.
> >>
> >> Can you explain this? What agents?
> >>
> >>
> >> Hehe, I was talking about Jenkins agents, sorry just realized I mixed my
> >> MLs. I thought I was reading Jenkinsci-users one :).
> >
> >
> > Bad Ba(p)tiste™
> >
> > ;-)
> >
> >
> >>
> >>
> >> On Thu, Sep 7, 2017 at 1:59 PM, Baptiste Mathus <[email protected]> wrote:
> >>
> >> > 2017-09-07 9:17 GMT+02:00 Guang Chao <[email protected]>:
> >> >
> >> > > On Fri, Sep 1, 2017 at 11:31 AM, mingleizhang <
> [email protected]>
> >> > > wrote:
> >> > >
> >> > > > Hello friends here.
> >> > > >
> >> > > >
> >> > > >      I would like ask a question ,it probably looks silly, but I
> >> still
> >> > > > want to know. As the subject said, when time do we need to delete
> >> > > > .m2/repository files ? Does anyone improve my mind ? Thank you
> very
> >> > much!
> >> > > >
> >> > > >
> >> > > >
> >> > > There is no need to do this unless you are out of disk space. It
> will
> >> > cause
> >> > > no harm, but maven will redownload all dependencies again. So that
> > will
> >> > > slow you down a bit.
> >> > >
> >> >
> >> > I am actually going to say the contrary. You should, at I'd even say,
> > you
> >> > *must* wipe out Maven repositories on a regular basis. If you don't,
> and
> >> > you have static (persistent) agents, very bad things will happen at
> some
> >> > point.
> >> >
> >> > So, yeah, redownloading it is going to add some time to build, but
> this
> >> is
> >> > a matter of speed vs. reproducibility, so better target
> >> reproduciblity/non
> >> > flakiness then see how to optimize, not the contrary.
> >> >
> >> > And obviously, *NEVER, EVER share that .m2/repository between running
> >> > builds*.
> >> >
> >> >
> >> > >
> >> > >
> >> > > > Thanks
> >> > > > Rice.
> >> > >
> >> > >
> >> > >
> >> > >
> >> > > --
> >> > > Guang <http://javadevnotes.com/java-string-to-integer-examples/>
> >> > >
> >> >
> >>
> >>
> >>
> >> --
> >> Regards
> >> Tushar Kapila
> >>
> > --
> > Sent from my phone
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to