We also have similar situation with multiple branches and the same maven
snapshot version.
Stefan, did you manage to run builds for separate branches without version
clashes?
On Friday, August 19, 2016 at 10:46:00 AM UTC+1, Álvaro Lobato wrote:
>
> I think that multibranch have a workspace for each branch (I'm away from
> my computer and can't check it) if that is the case it is safe to just use
> .repository, if not you can use what you propose or
> .reposotory_${env.BRANCH_NAME} which will make it relative and it should be
> persistent between executions.
>
> El 19/8/2016 9:32, "ST" <[email protected] <javascript:>> escribió:
>
>> Hi Alvaro,
>>
>> Thanks for your reply. So in a multi-branch project, do you have any
>> better proposal than to use the following?
>>
>> withMaven(mavenLocalRepo: "/tmp/${env.BRANCH_NAME}/.repository") {
>> // Run the maven build sh "mvn clean package"
>>
>> }
>>
>> Since we're "mvn install"-ing snapshots, we cannot reuse the same .m2 repo
>> for different branches...
>>
>>
>> On Tue, Aug 16, 2016 at 10:25 PM, Álvaro Lobato <[email protected]
>> <javascript:>> wrote:
>>
>>> Hello Stefan,
>>>
>>> An easy way to do it is to use the new Pipeline Maven
>>> <https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Maven+Plugin> plugin.
>>> It allows you to define a local maven repository, relative to to the
>>> workspace of the job or with an absolute path, you can also use shell
>>> variables expansion. In your case would be as easy as using a job similar
>>> to this one:
>>>
>>> withMaven(mavenLocalRepo: '.repository') {
>>> // Run the maven build sh "mvn clean package"
>>>
>>> }
>>>
>>>
>>> This will execute the specified mvn command with a local repo on the
>>> folder .repository inside the workspace.
>>>
>>> You can also use other parameters to customise you maven behaviour or
>>> even auto-install it. If you want more information check the plugin
>>> wiki page
>>> <https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Maven+Plugin> or
>>> this thread from the forum
>>> <https://groups.google.com/forum/#!topic/jenkinsci-users/9vS0DpU9oeM>.
>>>
>>> It is still in beta phase, but working well so far.
>>>
>>> Cheers
>>> Alvaro
>>>
>>> El lunes, 15 de agosto de 2016, 18:36:30 (UTC+2), ST escribió:
>>>>
>>>> Hi!
>>>>
>>>> I am migrating our build pipeline from a set of maven-type jobs to a
>>>> multi-branch project defined in a Jenkinsfile, and I am wondering how
>>>> people solve the .m2 problem ? I cannot see any way to configure every
>>>> job/branch to have its own private .m2 repo through a comfortable boolean
>>>> config option, did I miss something?
>>>>
>>>> Otherwise I guess the solution is to set the .m2 path via
>>>> -Dmaven.repo.local. But how to best define this path so it is different
>>>> for
>>>> every job/branch? Put it under /tmp/<GIT_BRANCH_NAME>? Any other more
>>>> elegant options?
>>>>
>>>> Best regards,
>>>> stefan.
>>>>
>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Jenkins Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected] <javascript:>.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jenkinsci-users/5970854a-5e55-4475-bf75-5da0227202d9%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/jenkinsci-users/5970854a-5e55-4475-bf75-5da0227202d9%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Jenkins Users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/jenkinsci-users/6NCL_RTSRDY/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/CABwQARtxFg8f82BxxM_aToua8Q3hG_qUsZqjrQt871cVkQOEtA%40mail.gmail.com
>>
>> <https://groups.google.com/d/msgid/jenkinsci-users/CABwQARtxFg8f82BxxM_aToua8Q3hG_qUsZqjrQt871cVkQOEtA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/30b35a77-a958-40b5-91e3-b87bf54b280d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.