You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dan Tran <da...@gmail.com> on 2014/08/17 07:50:23 UTC

Remove old snapshots under local repository

Hi I need to find a way to walk into local repository and remove all old
snapshots.

This is very helpful for developer to clean up his/her local rep.

how safe it is by blindly remove any file with timestamp format ( ie
xxx-1.0.0-20140816.071953-49.jar)?

Thanks

-D

Re: Remove old snapshots under local repository

Posted by Mark Derricutt <ma...@talios.com>.
I tend to use:

     mvn dependency:purge-local-repository

when sitting in a project directory, it'll go thru and delete all the 
SNAPSHOTs and re-resolve.

The only problem with it in the default mode, is that is _only_ deletes 
the `.jar`. files and doesn't rebuild any metadata, so if you're using 
version ranges you're kinda f**ked.

However, I usually use it with the following setting:

     mvn dependency:purge-local-repository 
-DresolutionFuzziness=artifactId

which will delete ALL files related to the artifact - all versions, all 
meta data - it doesn't mean there's more to download again but works 
wonderfully.

MaRK

On 18 Aug 2014, at 21:10, Adrien Rivard wrote:

> Or delete all directories that end with -SNAPSHOT
>
>
>
> On Sun, Aug 17, 2014 at 8:18 AM, Dan Tran <da...@gmail.com> wrote:
>
>> sounds like a good option.
>>
>> Thanks
>>
>> -D
>>
>>
>> On Sat, Aug 16, 2014 at 11:11 PM, Ron Wheeler <
>> rwheeler@artifact-software.com> wrote:
>>
>>> On 17/08/2014 1:50 AM, Dan Tran wrote:
>>>
>>>> Hi I need to find a way to walk into local repository and remove 
>>>> all old
>>>> snapshots.
>>>>
>>>> This is very helpful for developer to clean up his/her local rep.
>>>>
>>>> how safe it is by blindly remove any file with timestamp format ( 
>>>> ie
>>>> xxx-1.0.0-20140816.071953-49.jar)?
>>>>
>>>> Thanks
>>>>
>>>> -D
>>>>
>>>> Easiest thing to do is to delete the entire organization or project
>>> branch (com.mycompany.project.*) from the local repo.
>>>
>>> This will not likely delete anything of great value or anything that 
>>> can
>>> not be easily retrieved from your company repo.
>>>
>>>
>>> Ron
>>>
>>> --
>>> Ron Wheeler
>>> President
>>> Artifact Software Inc
>>> email: rwheeler@artifact-software.com
>>> skype: ronaldmwheeler
>>> phone: 866-970-2435, ext 102
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>
>
>
> -- 
> Adrien Rivard

Re: Remove old snapshots under local repository

Posted by Dan Tran <da...@gmail.com>.
ah, that works with a project, in my case, i prefer not to have a project


On Tue, Aug 19, 2014 at 8:07 PM, Mark Derricutt <ma...@talios.com> wrote:

> Nope, it's takes the dependencies from your project pom.xml:
>
>    mvn dependency:purge-local-repository -DresolutionFuzziness=artifactId
>
> Mark
>
> On 20 Aug 2014, at 14:11, Dan Tran wrote:
>
> > the problem here is I have to enter artifactId, am I missing any thing?
> > specially for a developer who is very clueless about Maven
> >
> > -D
> >
> >
> > On Tue, Aug 19, 2014 at 7:09 PM, Mark Derricutt <ma...@talios.com> wrote:
> >
> >> So not using the dependency plugin like I suggested?
> >>
> >> On 20 Aug 2014, at 10:14, Dan Tran wrote:
> >>
> >>> After all consideration.  I use Ron's advice and create a internal
> plugin
> >>> to clean it up.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Remove old snapshots under local repository

Posted by Mark Derricutt <ma...@talios.com>.
Nope, it's takes the dependencies from your project pom.xml:

   mvn dependency:purge-local-repository -DresolutionFuzziness=artifactId

Mark

On 20 Aug 2014, at 14:11, Dan Tran wrote:

> the problem here is I have to enter artifactId, am I missing any thing?
> specially for a developer who is very clueless about Maven
>
> -D
>
>
> On Tue, Aug 19, 2014 at 7:09 PM, Mark Derricutt <ma...@talios.com> wrote:
>
>> So not using the dependency plugin like I suggested?
>>
>> On 20 Aug 2014, at 10:14, Dan Tran wrote:
>>
>>> After all consideration.  I use Ron's advice and create a internal plugin
>>> to clean it up.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Remove old snapshots under local repository

Posted by Dan Tran <da...@gmail.com>.
the problem here is I have to enter artifactId, am I missing any thing?
specially for a developer who is very clueless about Maven

-D


On Tue, Aug 19, 2014 at 7:09 PM, Mark Derricutt <ma...@talios.com> wrote:

> So not using the dependency plugin like I suggested?
>
> On 20 Aug 2014, at 10:14, Dan Tran wrote:
>
> > After all consideration.  I use Ron's advice and create a internal plugin
> > to clean it up.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Remove old snapshots under local repository

Posted by Mark Derricutt <ma...@talios.com>.
So not using the dependency plugin like I suggested?

On 20 Aug 2014, at 10:14, Dan Tran wrote:

> After all consideration.  I use Ron's advice and create a internal plugin
> to clean it up.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Remove old snapshots under local repository

Posted by Dan Tran <da...@gmail.com>.
After all consideration.  I use Ron's advice and create a internal plugin
to clean it up.

-D


On Tue, Aug 19, 2014 at 6:06 AM, Ron Wheeler <rwheeler@artifact-software.com
> wrote:

> On 19/08/2014 1:49 AM, Barrie Treloar wrote:
>
>> What's wrong with just blowing away ~/.m2/repository ?
>>
>> If you have a local Maven Repository Manager it doesn't take very long to
>> reseed it.
>> (At least less time in aggregate than thinking of ways to prune snapshot
>> files in the repository correctly...)
>>
>>
> A few days ago, I suggested just blowing away the organization's
> sub-folder under .m2/repository.
> A bit more surgical. Would that work?
>
> If you have a corporate repo (and everyone should) it does not take long
> to repopulate your local repo.
>
> Probably a good idea to get rid of the entire local repo every year just
> get rid of old version that you will never need again.
> I don't need to carry a 7 year history of log4j on my hard drive.
>
>
> Ron
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: rwheeler@artifact-software.com
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Remove old snapshots under local repository

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 19/08/2014 1:49 AM, Barrie Treloar wrote:
> What's wrong with just blowing away ~/.m2/repository ?
>
> If you have a local Maven Repository Manager it doesn't take very long to
> reseed it.
> (At least less time in aggregate than thinking of ways to prune snapshot
> files in the repository correctly...)
>

A few days ago, I suggested just blowing away the organization's 
sub-folder under .m2/repository.
A bit more surgical. Would that work?

If you have a corporate repo (and everyone should) it does not take long 
to repopulate your local repo.

Probably a good idea to get rid of the entire local repo every year just 
get rid of old version that you will never need again.
I don't need to carry a 7 year history of log4j on my hard drive.

Ron

-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Remove old snapshots under local repository

Posted by Barrie Treloar <ba...@gmail.com>.
What's wrong with just blowing away ~/.m2/repository ?

If you have a local Maven Repository Manager it doesn't take very long to
reseed it.
(At least less time in aggregate than thinking of ways to prune snapshot
files in the repository correctly...)

Re: Remove old snapshots under local repository

Posted by Anders Hammar <an...@hammar.net>.
Sure it would. It's only the files that gets a timestamp; the directories
are still called x.y.z-SNAPSHOT.
However, be adviced that I've run into cases in the wild where the
artifactId would end in "-SNAPSHOT" and this solution would remove such
directories as well although it's could contain releases (and snapshots).
Such a artifactId naming is not very good and kind of deserves to cause
issues though...

/Anders
On Tue, Aug 19, 2014 at 7:28 AM, Dan Tran <da...@gmail.com> wrote:

> This would not work, since it still leave all snapshot of timestamp around
>
> -D
>
>
> On Mon, Aug 18, 2014 at 2:10 AM, Adrien Rivard <ad...@gmail.com>
> wrote:
>
> > Or delete all directories that end with -SNAPSHOT
> >
> >
> >
> > On Sun, Aug 17, 2014 at 8:18 AM, Dan Tran <da...@gmail.com> wrote:
> >
> > > sounds like a good option.
> > >
> > > Thanks
> > >
> > > -D
> > >
> > >
> > > On Sat, Aug 16, 2014 at 11:11 PM, Ron Wheeler <
> > > rwheeler@artifact-software.com> wrote:
> > >
> > > > On 17/08/2014 1:50 AM, Dan Tran wrote:
> > > >
> > > >> Hi I need to find a way to walk into local repository and remove all
> > old
> > > >> snapshots.
> > > >>
> > > >> This is very helpful for developer to clean up his/her local rep.
> > > >>
> > > >> how safe it is by blindly remove any file with timestamp format ( ie
> > > >> xxx-1.0.0-20140816.071953-49.jar)?
> > > >>
> > > >> Thanks
> > > >>
> > > >> -D
> > > >>
> > > >>  Easiest thing to do is to delete the entire organization or project
> > > > branch (com.mycompany.project.*) from the local repo.
> > > >
> > > > This will not likely delete anything of great value or anything that
> > can
> > > > not be easily retrieved from your company repo.
> > > >
> > > >
> > > > Ron
> > > >
> > > > --
> > > > Ron Wheeler
> > > > President
> > > > Artifact Software Inc
> > > > email: rwheeler@artifact-software.com
> > > > skype: ronaldmwheeler
> > > > phone: 866-970-2435, ext 102
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > Adrien Rivard
> >
>

Re: Remove old snapshots under local repository

Posted by Dan Tran <da...@gmail.com>.
This would not work, since it still leave all snapshot of timestamp around

-D


On Mon, Aug 18, 2014 at 2:10 AM, Adrien Rivard <ad...@gmail.com>
wrote:

> Or delete all directories that end with -SNAPSHOT
>
>
>
> On Sun, Aug 17, 2014 at 8:18 AM, Dan Tran <da...@gmail.com> wrote:
>
> > sounds like a good option.
> >
> > Thanks
> >
> > -D
> >
> >
> > On Sat, Aug 16, 2014 at 11:11 PM, Ron Wheeler <
> > rwheeler@artifact-software.com> wrote:
> >
> > > On 17/08/2014 1:50 AM, Dan Tran wrote:
> > >
> > >> Hi I need to find a way to walk into local repository and remove all
> old
> > >> snapshots.
> > >>
> > >> This is very helpful for developer to clean up his/her local rep.
> > >>
> > >> how safe it is by blindly remove any file with timestamp format ( ie
> > >> xxx-1.0.0-20140816.071953-49.jar)?
> > >>
> > >> Thanks
> > >>
> > >> -D
> > >>
> > >>  Easiest thing to do is to delete the entire organization or project
> > > branch (com.mycompany.project.*) from the local repo.
> > >
> > > This will not likely delete anything of great value or anything that
> can
> > > not be easily retrieved from your company repo.
> > >
> > >
> > > Ron
> > >
> > > --
> > > Ron Wheeler
> > > President
> > > Artifact Software Inc
> > > email: rwheeler@artifact-software.com
> > > skype: ronaldmwheeler
> > > phone: 866-970-2435, ext 102
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
>
>
>
> --
> Adrien Rivard
>

Re: Remove old snapshots under local repository

Posted by Adrien Rivard <ad...@gmail.com>.
Or delete all directories that end with -SNAPSHOT



On Sun, Aug 17, 2014 at 8:18 AM, Dan Tran <da...@gmail.com> wrote:

> sounds like a good option.
>
> Thanks
>
> -D
>
>
> On Sat, Aug 16, 2014 at 11:11 PM, Ron Wheeler <
> rwheeler@artifact-software.com> wrote:
>
> > On 17/08/2014 1:50 AM, Dan Tran wrote:
> >
> >> Hi I need to find a way to walk into local repository and remove all old
> >> snapshots.
> >>
> >> This is very helpful for developer to clean up his/her local rep.
> >>
> >> how safe it is by blindly remove any file with timestamp format ( ie
> >> xxx-1.0.0-20140816.071953-49.jar)?
> >>
> >> Thanks
> >>
> >> -D
> >>
> >>  Easiest thing to do is to delete the entire organization or project
> > branch (com.mycompany.project.*) from the local repo.
> >
> > This will not likely delete anything of great value or anything that can
> > not be easily retrieved from your company repo.
> >
> >
> > Ron
> >
> > --
> > Ron Wheeler
> > President
> > Artifact Software Inc
> > email: rwheeler@artifact-software.com
> > skype: ronaldmwheeler
> > phone: 866-970-2435, ext 102
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>



-- 
Adrien Rivard

Re: Remove old snapshots under local repository

Posted by Dan Tran <da...@gmail.com>.
sounds like a good option.

Thanks

-D


On Sat, Aug 16, 2014 at 11:11 PM, Ron Wheeler <
rwheeler@artifact-software.com> wrote:

> On 17/08/2014 1:50 AM, Dan Tran wrote:
>
>> Hi I need to find a way to walk into local repository and remove all old
>> snapshots.
>>
>> This is very helpful for developer to clean up his/her local rep.
>>
>> how safe it is by blindly remove any file with timestamp format ( ie
>> xxx-1.0.0-20140816.071953-49.jar)?
>>
>> Thanks
>>
>> -D
>>
>>  Easiest thing to do is to delete the entire organization or project
> branch (com.mycompany.project.*) from the local repo.
>
> This will not likely delete anything of great value or anything that can
> not be easily retrieved from your company repo.
>
>
> Ron
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: rwheeler@artifact-software.com
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Remove old snapshots under local repository

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 17/08/2014 1:50 AM, Dan Tran wrote:
> Hi I need to find a way to walk into local repository and remove all old
> snapshots.
>
> This is very helpful for developer to clean up his/her local rep.
>
> how safe it is by blindly remove any file with timestamp format ( ie
> xxx-1.0.0-20140816.071953-49.jar)?
>
> Thanks
>
> -D
>
Easiest thing to do is to delete the entire organization or project 
branch (com.mycompany.project.*) from the local repo.

This will not likely delete anything of great value or anything that can 
not be easily retrieved from your company repo.


Ron

-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org