I have two jobs running in jenkins both have the following setup 
the global settings are

when they run they use the commands
Executing Maven: -B -f /u01/jenkins/jobs/job_1/workspace/pom.xml -Dmaven.repo.local=/u01/jenkins/maven-repositories/0 clean install
Executing Maven: -B -f /u01/jenkins/jobs/job_2/workspace/pom.xml -Dmaven.repo.local=/u01/jenkins/maven-repositories/1 clean install
Why do they use different repositories?
job 2 is dependent on an artifact produced by job 1.
When local maven repository is set to Local to the executer then the 1 in -Dmaven.repo.local=/u01/jenkins/maven-repositories/1 refers to the executer the job is running in. So if the job is running in executer n then the argument will be -Dmaven.repo.local=/u01/jenkins/maven-repositories/n.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With