Jenkins also has a setting "Use private Maven repository" in the build
section of the job configuration which takes care of this for you.

Mike

On Wed, Mar 7, 2012 at 5:41 AM, Srinath C <[email protected]> wrote:
> Always use a different local repositories for different projects in Jenkins.
> You can do this by setting the system property
> -Dmaven.local.repo={project_workspace_dir}
>
> Regards,
> Srinath.
>
>
> On Wed, Mar 7, 2012 at 1:59 PM, Jörg Schaible
> <[email protected]>wrote:
>
>> Hi Guillaume,
>>
>> Guillaume Polet wrote:
>>
>> > Dear all,
>> >
>> > I was having some doubts regarding Maven's ability to handle properly
>> > concurrent builds. Lately, I had several builds of our project that
>> > failed and it seemed that it was due to interferences between concurrent
>> > builds of the same version of the same project.
>> >
>> > I have a jenkins server which have 6 different builds:
>> > * 1 for continuous build (which runs tests but does not deploy the
>> > artifacts)
>> > * 1 for nightly build
>> > * 1 for releases (or almost release, ie, the pom is still in SNAPSHOT
>> > version but could become a release)
>> > All this is multiplied by two, because I have two versions (on 2
>> > different branches).
>> >
>> > So I had 2 questions:
>> > 1. Can/Does Maven support concurrent builds of the same version of the
>> > same project?
>>
>> Not out of the box. Since by default both builds will use the same local
>> repository creating the same artifacts at same time, the artifacts in the
>> repository are likely to be corrupted.
>>
>> > If yes, do I need to do something to achieve this?
>>
>> Use separate local repositories, it can be defined using separate
>> settings.xml files or by call with a system property. Actually I don't know
>> if Jenkins already supports something like this, because it's a general
>> problem, see below.
>>
>> > If not,
>> > is it something that Maven developers are considering?
>>
>> It's not the first time this problem has been risen.
>>
>> > 2. Can/Does Maven support concurrent builds of different versions of the
>> > same project?
>>
>> They may still corrupt the metadata.xml files, but it is less likely and
>> has
>> AFAICS less consequences.
>>
>> However, every concurrent build may corrupt a shared local repository,
>> because both builds may download the same artifacts at same time. A
>> scenario
>> where this might happen is when you upgrade versions (e.g. of plugins) in a
>> common master-pom and start two parallel builds then. Actually I am not
>> sure
>> if you're safe when running one Maven build in parallel mode. A repository
>> manager like Nexus might prevent this scenario by detecting the same
>> request, but again I am not sure if it does.
>>
>> BTW: This is also the reason why you should never share a local repository
>> with a network mount by multiple users.
>>
>>
>> >
>> > Cheers,
>> > Guillaume
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to