Jump to content

How to clean up a Maven repository with CCleaner?


Recommended Posts

Hi,

 

I would love to use CCleaner to remove old snapshots from my Maven repository. I tried to set that up in the Include section but that fails with the message "For system safety reasons you cannot select this specific location."

 

This was what I tried:

Include: Drive or Folder: "C:\Java\.m2\repository\"

File Types: Filetypes "*-SNAPSHOT"

Options: Include files, subfolders and the folder itself.

 

I expected this to scan this folder and its subfolders for anything (that means including folders) ending with *-SNAPSHOT and then deleting it. If there is a better way to configure that, please tell me.

 

Cheers,

Kai

Link to comment
Share on other sites

Is this a wise thing to do ?

 

Have you a significant issue that as administrator you need to fix?

Have you noticed a file space manager reporting a lot of snapshots and you thought you would give it a whack ! !

 

I have just Googled the search phrase "C:\Java\.m2\repository\"

Only 802 results, and they look to heavy for me apart from the link to this post.

 

If you want to "mix it with the big boys" perhaps you should look at

http://mule.1045714.n5.nabble.com/seasar2-dev-110-trunk-mule-module-seasar2-examples-td2731691.html

or

http://fisheye.muleforge.org/rdiff/seasar2?csid=139&u&N

Link to comment
Share on other sites

Is this a wise thing to do ?

 

100%. The local repository on my computer grows with each snapshot release of any library that we're working on at my workplace. That is more than a GB each month of a lot of files I don't have any interest in after all. Each time a colleague is publishing his piece of work a library gets created and all projects depending on that are published as well. Long story short: I don't need most of them in future, and the ones I might need can easily be retrieved again from our central repository.

 

Cheers,

Kai

Link to comment
Share on other sites

O.K. You are one of the "Big Boys"

 

I just recognise that Java stuff is way out of my league.

 

You can POSSIBLY defeat the problem by editing the Include stuff with Notepad ! !

When you are setting an include via the CCleaner GUI at each stage of the path you are "browsing" and I believe some "reparse points" prevent you browsing through them,

but you may have access to delete through them if you stipulate the target point

 

There is no way you can stipulate %APPDATA% via CCLeaner GUI, it will convert that into the path for YOUR profile,

but with Notepad I can use %APPDATA% and it happens for which ever user profile is running it.

 

Either use the Portable version of CCleaner as I do,

or in Options => Advanced click "Save all settings to INI file".

 

Now ensure there are two items in the include section (add some if necessary) and then close CCleaner.

 

You now have in the same folder as CCleaner.exe a new CCleaner.INI.

This you can edit with Notepad or similar.

You can stipulate an exact path without having to browse.

I added to mine :-

Include1=PATH|%APPDATA%\Adobe\Flash Player\AssetCache\|*.*|RECURSE
Include2=PATH|%APPDATA%\Macromedia\Flash Player\|*.*|RECURSE

and that takes care of all the Flash junk that I object to.

 

Just ensure that all "Includes" have suitable numeric suffixes.

I think you do not need to keep them in sequence, but I believe they are processed in numerical sequence,

and if a number is skipped then all the following are never processed - so it helps to keep in sequence.

 

No promises, but that should allow you to aim at targets,

and if that fails you probably do not have permission/authority.

 

I think whatever you can do CCleaner can also do using your authority.

 

When it works for you then you can launch CCleaner and cancel the "Save Settings ..." option and your new includes will be preserved in the registry as normal.

Link to comment
Share on other sites

Hi Alan,

 

I could more or less follow your description (it was missing the piece that I need to set the advanced options to save to an ini file, and where actually the ini file is stored to.)

 

I was anyway not able to trigger the deletion I wanted. This what is there and in bold what should be removed:

 

C:\Java\.m2\repository\com\ourcompany\oursuite\ourfirstmodule\6.1.0-SNAPSHOT\*.*

C:\Java\.m2\repository\com\ourcompany\oursuite\oursecondmodule\6.1.0-SNAPSHOT\*.*

C:\Java\.m2\repository\com\ourcompany\oursuite\ourthirdmodule\6.1.0-SNAPSHOT\*.*

 

but I don't want to name all of our modules in CCLeaner, that why I want it to scan the complete C:\Java\.m2\repository folder and delete every folder ending with -SNAPSHOT.

 

Cheers,

Kai

Link to comment
Share on other sites

I think what you want would be satisfied by wild cards, something like

C:\Java\.m2\repository\com\ourcompany\oursuite\our*module\*-SNAPSHOT\*.*

 

Unfortunately although I have seen a request for such wild card capability,

I do not think we have it yet and I do not know if/when it might happen.

 

Possibly a moderator might step in with a word from above.

 

Would a BAT script solution be applicable ?

 

I love the Xmarks Addon but absolutely loath and detest its needless burden of all the languages under the sun.

It dumps far more files in my Firefox profile than the sum total of all the files in all my other Addons.

You may get an idea from my script below.

This detects if an update has dumped on me any foreign language folder F*

(in which case the rest of the world has also been dumped on me)

Then it looks at all the language folders and, with the exception of my "en-US" language, deletes them.

N.B. Before action it lists all targets and waits authorisation so I can abort if appropriate.

echo Purging foreign languages from Xmarks
CD /D %APPDATA%\Mozilla\Firefox\Profiles\*.DEF\EXTENS~1\FOXMAR~1.COM\chrome\locale\
IF NOT EXIST F* GOTO SKIP
DIR | FIND "/"
SET ANS=N & SET /P ANS="PURGE all above except en-US ?  P(urge) / N(o) :- "
IF %ANS% NEQ P GOTO SKIP
ECHO PURGING ...
FOR /D %%X IN (*) DO IF NOT %%X==en-US RMDIR /S /Q %%X
PAUSE
:SKIP

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.