Quantcast

clean up maven repo in Jenkins slave

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

clean up maven repo in Jenkins slave

jasonxiu0722
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: clean up maven repo in Jenkins slave

domi@fortysix.ch
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: clean up maven repo in Jenkins slave

jasonxiu0722
Hi Domi,

this is a great help. I have more questions.....
where can I check/change the home directory of my user jenkins running
with? Is that a good idea if i put maven repos in a share drive and
mount it on both maven and jenkins slave servers so that only one
location should be cleared up once too many dependencies are there and
maven does not need to copy files to jenkins slave when build job
running?
Thanks,

Jason

On Apr 14, 3:02 am, domi <[hidden email]> wrote:

> 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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: clean up maven repo in Jenkins slave

domi@fortysix.ch
Jason,
if you talk about jenkins home, there are two homes you have to think about:
- JENKINS_HOME, this is where the config of Jenkins will be, have a look here: https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins 
- Home of the user Jenkins is running with: this depends on the system Jenkins os running on: Windows / *nix - don't know how to change it on Windows, on *nix its in the /etc/passwd. But before you do that, you should get familiar with what you are doing.
At the end its probably more a question of why you want to change the home directory… If you just want to change it to have the maven repo at a different location, then you should rather just change that location in your settings.xml (http://maven.apache.org/settings.html)

About deleting and sharing the local repo: you have to be aware, that the local maven repo is not multi thread aware - e.g. if two builds download the same artifact at the same time you might get into trouble. This is also the reason, why Jenkins allows to configure the local repo for each build/executor/workspace (have a look at the Jenkins' global 'Maven Project Configuration').
So my advice is: get enough space to allow all this repos to exist.
regards Domi


On 16.04.2012, at 19:30, JasonX wrote:

> Hi Domi,
>
> this is a great help. I have more questions.....
> where can I check/change the home directory of my user jenkins running
> with? Is that a good idea if i put maven repos in a share drive and
> mount it on both maven and jenkins slave servers so that only one
> location should be cleared up once too many dependencies are there and
> maven does not need to copy files to jenkins slave when build job
> running?
> Thanks,
>
> Jason
>
> On Apr 14, 3:02 am, domi <[hidden email]> wrote:
>> 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.

Loading...