Java jenkins 如何确定使用哪个本地存储库?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24111870/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How does jenkins determine which local repository to use?
提问by BevynQ
I have two jobs running in jenkins both have the following setup
我有两个在 jenkins 中运行的作业都具有以下设置
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.
作业 2 依赖于作业 1 生成的工件。
采纳答案by Nancy
Local repositories depend on the settings.xml of maven if you don't specify it seperately. By default it looks like below:
如果不单独指定,本地存储库依赖于 maven 的 settings.xml。默认情况下,它如下所示:
<localRepository>${env.HOME}/.m2/repository</localRepository>
Seems you have different settings.xml on your jenkins slaves.
似乎您在 jenkins 奴隶上有不同的 settings.xml。
回答by aorfevre
by default I assumpe that the repository used for each job is :
默认情况下,我假设用于每个作业的存储库是:
**$HOME**/jobs/**JOB_NAME**/workspace
your pom.xml should be located there.
你的 pom.xml 应该位于那里。
回答by BevynQ
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
.
当本地的仓库设置为Local to the executer
,则1
在-Dmaven.repo.local=/u01/jenkins/maven-repositories/1
指作业中。因此,运行作业是否在执行器运行N,则该参数将是执行者-Dmaven.repo.local=/u01/jenkins/maven-repositories/n
。