You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Frizz <fr...@googlemail.com.INVALID> on 2019/05/09 14:09:06 UTC

Concurrency issue while running Maven on Jenkins host

 I regularly suffer from corrupted maven-metadata-local.xml files on my
Jenkins host in directory /home/jenkins/.m2/.../some-project/

E.g. extra lines added to the end of the maven-metadata-local.xml file like
this:
...
  </versioning>
</metadata>
astUpdated>
  </versioning>
</metadata>

Do I suffer from concurrency issues? Like the one described here (created
2007, but still unresolved): https://issues.apache.org/jira/browse/MNG-2802

What could I do to mitigate the issue?

Re: Concurrency issue while running Maven on Jenkins host

Posted by Jason Young <ja...@procentive.com>.
IME, the default settings for plugins in Jenkins are sometimes objectively
incorrect. One example is the setting Karl referred to. More specifically,
if you are using the Maven plugin for Jenkins, got to your job config ->
Build -> Advanced -> Use private Maven repository. The default setting of
using one repo for all jobs is only correct if you never run more than one
Maven job at a time. Instead, set it to "Local to the executor" to avoid
concurrent access and maximize cache reuse, or "Local to the workspace" for
more isolation. (My Jenkins installation might be old.)

On Thu, May 9, 2019 at 9:33 AM Karl Heinz Marbaise <kh...@gmx.de>
wrote:

> Hi,
>
> On 09.05.19 16:09, Frizz wrote:
> >   I regularly suffer from corrupted maven-metadata-local.xml files on my
> > Jenkins host in directory /home/jenkins/.m2/.../some-project/
>
>
> I suppose you are using the local cache for all your jobs?
>
> If so this is the problem. The cache is and was intended for running a
> single build on it...If you run on a CI solution like Jenkins you should
> use the cache per job ...
>
> Kind regards
> Karl Heinz Marbaise
>
>
> >
> > E.g. extra lines added to the end of the maven-metadata-local.xml file
> like
> > this:
> > ...
> >    </versioning>
> > </metadata>
> > astUpdated>
> >    </versioning>
> > </metadata>
> >
> > Do I suffer from concurrency issues? Like the one described here (created
> > 2007, but still unresolved):
> https://issues.apache.org/jira/browse/MNG-2802
> >
> > What could I do to mitigate the issue?
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Concurrency issue while running Maven on Jenkins host

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,

On 09.05.19 16:09, Frizz wrote:
>   I regularly suffer from corrupted maven-metadata-local.xml files on my
> Jenkins host in directory /home/jenkins/.m2/.../some-project/


I suppose you are using the local cache for all your jobs?

If so this is the problem. The cache is and was intended for running a
single build on it...If you run on a CI solution like Jenkins you should
use the cache per job ...

Kind regards
Karl Heinz Marbaise


>
> E.g. extra lines added to the end of the maven-metadata-local.xml file like
> this:
> ...
>    </versioning>
> </metadata>
> astUpdated>
>    </versioning>
> </metadata>
>
> Do I suffer from concurrency issues? Like the one described here (created
> 2007, but still unresolved): https://issues.apache.org/jira/browse/MNG-2802
>
> What could I do to mitigate the issue?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Concurrency issue while running Maven on Jenkins host

Posted by Tibor Digana <ti...@apache.org>.
There was one more email with the same problem.
We are talking about this problem, global repo:
'$COMPANY_JENKINS_HOME.m2/repository/executor_$EXECUTOR_NUMBER'

Our build creates pwd() + "/.m2" in the job, and the scm checkouts git repo
to "./build" directory.
No issue then!

The Jenkinsfile should use relative paths and then it is transferable to
any new machines and any time.

Cheers
Tibor17


On Tue, May 14, 2019 at 3:13 PM Francois MAROT <fr...@gmail.com>
wrote:

> Sorry, seems my previous message missed the copy pasted content ! Here it
> is:
>
>    pipeline {
>         agent { node { label paramsMap.agentParam } }    // the build will
> only run on nodes (ie slaves) indicated
>
>         environment {
>             // To prevent simultaneous job working in the same Maven local
> repo, we use per-executor local repo (more details here:
>
> http://maven.40175.n5.nabble.com/Not-able-to-read-jars-in-repo-intermittently-td5928990.html#a5928997
> )
>             MAVEN_CMD = "mvn -U --batch-mode
> ${paramsMap.activateParallelBuild ? '-T 1C' : ''} " +
>                 "-Dmaven.repo.local=${isUnix() ?
> '$COMPANY_JENKINS_HOME.m2/repository/executor_$EXECUTOR_NUMBER' :
> '%COMPANY_JENKINS_HOME%.m2\\repository\\executor_%EXECUTOR_NUMBER%'} " +
>                 "-s ${isUnix() ? '$MAVEN_SETTINGS_XML' :
> '%MAVEN_SETTINGS_XML%'} "
>             JAVA_TOOL_OPTIONS = "${env.JAVA_TOOL_OPTIONS == null ? '' :
> env.JAVA_TOOL_OPTIONS} -Djava.io.tmpdir=${env.WORKSPACE}/target/"
>         }
> ...
>
>
>
> --
> Sent from: http://maven.40175.n5.nabble.com/Maven-Users-f40176.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Concurrency issue while running Maven on Jenkins host

Posted by Francois MAROT <fr...@gmail.com>.
Sorry, seems my previous message missed the copy pasted content ! Here it is:

   pipeline {
        agent { node { label paramsMap.agentParam } }    // the build will
only run on nodes (ie slaves) indicated 

        environment {
            // To prevent simultaneous job working in the same Maven local
repo, we use per-executor local repo (more details here:
http://maven.40175.n5.nabble.com/Not-able-to-read-jars-in-repo-intermittently-td5928990.html#a5928997
)
            MAVEN_CMD = "mvn -U --batch-mode  
${paramsMap.activateParallelBuild ? '-T 1C' : ''} " +
                "-Dmaven.repo.local=${isUnix() ?
'$COMPANY_JENKINS_HOME.m2/repository/executor_$EXECUTOR_NUMBER' :
'%COMPANY_JENKINS_HOME%.m2\\repository\\executor_%EXECUTOR_NUMBER%'} " +
                "-s ${isUnix() ? '$MAVEN_SETTINGS_XML' :
'%MAVEN_SETTINGS_XML%'} "
            JAVA_TOOL_OPTIONS = "${env.JAVA_TOOL_OPTIONS == null ? '' :
env.JAVA_TOOL_OPTIONS} -Djava.io.tmpdir=${env.WORKSPACE}/target/"
        }
...



--
Sent from: http://maven.40175.n5.nabble.com/Maven-Users-f40176.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Concurrency issue while running Maven on Jenkins host

Posted by Francois MAROT <fr...@gmail.com>.
Hello, I suffered from similar symptoms until I adjusted the build to have
per-Jenkins-executor MAven cache. So in the end, my Maven configuration in
my Jenkins pipeline looks like this:



As you can see, I do not use any Jenkins-Maven plugin and Maven is
configured by hand. Hope it may help



--
Sent from: http://maven.40175.n5.nabble.com/Maven-Users-f40176.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org