It's not jenkins who copies the dependencies to this location, its maven.
There are multiple reasons which could cause this:
- you have configured /opt to be the home directory of your user you running 
jenkins with.
- this location is configured in your settings.xml 
If you delete all these, maven will just download them the next time again (and 
slow down the build). If you have multiple maven jobs running at the same time, 
you should also not delete the directory/repository while a build is running, 
this would just remove the needed libraries and the build will fail.
I recommend you use the 'Config File Provide Plugin' [1] - this will allow you 
to configure your settings.xml at a central place and select one within your 
job configuration from a drop down menu.
regards Domi

[1] https://wiki.jenkins-ci.org/display/JENKINS/Config+File+Provider+Plugin

On 13.04.2012, at 20:43, JasonX wrote:

> I saw maven repo is copied to /opt/.m2 directory on Jenkins slave from
> maven server and it fills up Jenkins slave disk. I wanna clean it up.
> How  can I do it? can I remove all of the repos from Jenkins slave
> after each build? is that necessary to keep all dependencies on
> Jenkins slave but they are already existing in maven server.

Reply via email to