gpt4 book ai didi

maven - Jenkins 在 Jenkins Home 之外找不到 maven setting.xml 文件

转载 作者:行者123 更新时间:2023-12-05 05:21:52 25 4
gpt4 key购买 nike

我让 Jenkins 在 CentOS 服务器上运行,我正在尝试设置一个在 git 项目上运行 mvn clean install 的作业。由于我想为我的整个服务器使用一个全局 maven 存储库,我正在设置我的项目以使用 Jenkins 主目录之外的路径中的设置文件运行 maven:

enter image description here

运行构建时,Jenkins 找不到那个 settings.xml 文件:

...
[workspace] $ /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.0.4/bin/mvn -f firma-digital-service/pom.xml -s /home/dcalderon/.m2/repository/settings.xml -X clean package
Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven home: /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.0.4
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-123.4.2.el7.x86_64", arch: "amd64", family: "unix"
[INFO] Error stacktraces are turned on.
[ERROR] Error executing Maven.
java.io.FileNotFoundException: The specified user settings file does not exist: /home/dcalderon/.m2/repository/settings.xml
at org.apache.maven.cli.MavenCli.settings(MavenCli.java:681)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:193)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE

当 Jenkins 通过命令行运行完全相同的命令时,一切正常,这表明该文件确实存在于服务器中。我究竟做错了什么?是关于用户限制的问题吗?

最佳答案

作为扩展答案,当没有对配置进行特定更改时,我们也可以说在 Jenkins 配置中使用 maven 的默认设置,如下所述:

设置文件:使用默认的maven设置全局设置文件:使用默认的maven全局设置

Maven Settings in Jenkins Job Configuration Page

关于maven - Jenkins 在 Jenkins Home 之外找不到 maven setting.xml 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41904326/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com