We use a scheduled task that runs a Ruby program to delete our local repository 
if it is older than a week.  You could manipulate this to only delete 
snapshots, but I prefer to get everything fresh to make sure our internal 
mirror is working correctly.  The full version of this program (not included) 
also does nifty chores such as defragging and updating Subversion directories. 
If you're interested in more admin tasks with Ruby I suggest: 
http://www.pragprog.com/titles/bmsft/everyday-scripting-with-ruby

Here's the Ruby code snippet to blast the maven repository:

#Delete the local maven repository if it is older than a week
m2_repo = "c:\\path\\to\\your\\maven\\repo"
if File.exists?(m2_repo)
        one_week_in_seconds = 604800
        dir_age = start - File.ctime(m2_repo)

        if (dir_age > one_week_in_seconds)
                puts "#{m2_repo} was created #{dir_age} seconds ago."
                puts "Deleting #{m2_repo}"
                FileUtils.rm_rf(m2_repo)
                puts "Finished deleting #{m2_repo}"
        else
                puts "Skipped deleting #{m2_repo} it's only #{dir_age} seconds 
old"
        end
        "No directory #{m2_repo}"
end






-----Original Message-----
From: Mohan KR [mailto:kmoh....@gmail.com]
Sent: Monday, June 15, 2009 1:38 PM
To: 'Maven Users List'
Subject: RE: Plugin / Tool for local repository

same here, interested in any updates on the plugin from the discussion
below. Don't want to whip out another one
if it already exists.


Thanks,
mohan kr

-----Original Message-----
From: Henri Gomez [mailto:henri.go...@gmail.com]
Sent: Monday, June 15, 2009 9:32 AM
To: Maven Users List
Subject: Re: Plugin / Tool for local repository

I saw an interested thread on mojo-dev about a local repository purge
plugin.

http://www.nabble.com/local-repository-purge-plugin-td16937047.html

Any one know it status ?

2009/6/15 Henri Gomez <henri.go...@gmail.com>:
> Good stuff but I also needed the various versions of the project to be
removed.
>
>
>
> 2009/6/15 Anders Hammar <and...@hammar.net>:
>>
http://maven.apache.org/plugins/maven-dependency-plugin/purge-local-reposito
ry-mojo.html
>>
>> /Anders
>>
>> On Mon, Jun 15, 2009 at 10:46, Henri Gomez<henri.go...@gmail.com> wrote:
>>> Hi to all,
>>>
>>> I wonder if there is a plugin/tool available to clean a local repository
?
>>>
>>> After some time repository could became huge with many snapshots or
>>> versions (when using ranges) and the only way, for now, is just to
>>> clean up by hand.
>>>
>>> Repository managers like Nexus or Archiva does this cleanup, that's
>>> why I wonder if such service could exist in a maven plugin.
>>>
>>> Regards
>>>


This e-mail and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom

they are addressed. If you have received this e-mail in error please notify the 
originator of the message. This footer also

confirms that this e-mail message has been scanned for the presence of computer 
viruses. Any views expressed in this message are

those of the individual sender, except where the sender specifies and with 
authority, states them to be the views of Iowa Student

Loan.


 


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

Reply via email to