jenkins Slave 使用哪个 settings.xml?

发布于 2024-12-10 13:15:52 字数 1869 浏览 0 评论 0原文

我有一个 Jenkins 主服务器(在小型 Linux 机器上运行)和一个 Jenkins 从服务器(在“正确的”XP 机器上运行)。

我已将所有 jib 配置为在 Windows XP 从属设备上运行。

不幸的是,每次在该从站上运行构建时,构建都会因以下错误而失败:

ERROR: Ignore Problem expanding maven opts macros org.jenkinsci.plugins.tokenmacro.TokenMacro
Found mavenVersion 3.0.3 from file jar:file:/E:/java-ext/apache-maven-3.0.3/lib/maven-core-3.0.3.jar!/META-INF/maven/org.apache.maven/maven-core/pom.properties
Parsing POMs
ERROR: Echec à la lecture des POMs
hudson.util.IOException2: remote file operation failed: C:\hudson\workspace\Autocat at hudson.remoting.Channel@ee5bc4:ndx-PC-winXP
    at hudson.FilePath.act(FilePath.java:752)
    at hudson.FilePath.act(FilePath.java:738)
    at hudson.maven.MavenModuleSetBuild$RunnerImpl.parsePoms(MavenModuleSetBuild.java:817)
    at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:617)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:429)
    at hudson.model.Run.run(Run.java:1374)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:467)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:145)
Caused by: hudson.remoting.ProxyException: hudson.maven.MavenModuleSetBuild$MavenExecutionException: org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM: Failure to find fr.perigee.java:java-parent:pom:0.0.6 in http://tinkerpop.com/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of tinkerpop has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 3, column 10

我知道此错误是由于包含这些工件的存储库的定义错误造成的,因为使用的存储库是在 settings.xml 中定义的。所以,我的问题非常简单:如何定义 Jenkins 从属设备使用哪个 settings.xml 文件?

I have a Jenkins master (running on a small Linux box) and a Jenkins slave (running on a "correct" XP machine).

I have configured both for all jibs to be run on the Windows XP slave.

Unfortunatly, each time a build is run on that slave, the build fails due to the following error :

ERROR: Ignore Problem expanding maven opts macros org.jenkinsci.plugins.tokenmacro.TokenMacro
Found mavenVersion 3.0.3 from file jar:file:/E:/java-ext/apache-maven-3.0.3/lib/maven-core-3.0.3.jar!/META-INF/maven/org.apache.maven/maven-core/pom.properties
Parsing POMs
ERROR: Echec à la lecture des POMs
hudson.util.IOException2: remote file operation failed: C:\hudson\workspace\Autocat at hudson.remoting.Channel@ee5bc4:ndx-PC-winXP
    at hudson.FilePath.act(FilePath.java:752)
    at hudson.FilePath.act(FilePath.java:738)
    at hudson.maven.MavenModuleSetBuild$RunnerImpl.parsePoms(MavenModuleSetBuild.java:817)
    at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:617)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:429)
    at hudson.model.Run.run(Run.java:1374)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:467)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:145)
Caused by: hudson.remoting.ProxyException: hudson.maven.MavenModuleSetBuild$MavenExecutionException: org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM: Failure to find fr.perigee.java:java-parent:pom:0.0.6 in http://tinkerpop.com/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of tinkerpop has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 3, column 10

I know this error is due to the bad definition of repository containing those artifacts, because used repository is defined in settings.xml. So, my question is quite simple : how can I define which settings.xml file is used by a Jenkins slave ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不疑不惑不回忆 2024-12-17 13:15:52

Maven 使用全局设置和用户设置文件。如果用户设置文件存在,它将覆盖全局设置文件。

全局的位于 %M2_HOME%\conf\ 中,而用户的位于 %HOME%\.m2\ 中。这里 %HOME% 表示运行 Jenkins 从设备的任何用户的主目录。

因此,假设您的情况可行,最简单的解决方案是将正确的 settings.xml 文件复制到 Jenkins 从机上的 %HOME%\.m2\ 目录中。

或者,您可以使用 --settings 选项在 mvn 命令行上指定自定义 settings.xml 文件,这样您就可以将该文件放在已知位置(例如 C:\),然后告诉 Jenkins 将设置传递给 Maven,例如 --settings C:\settings.xml

顺便说一句,创建一个新的 Windows 用户来运行 Jenkins 从属服务器通常很有用,这样您就可以轻松知道它将在哪里搜索配置文件。

Maven uses a global settings and a user settings file. If the user settings file exists, it overrides the global one.

The global one is found in %M2_HOME%\conf\, while the user one is in %HOME%\.m2\. Here %HOME% means the home directory of whatever user is running the Jenkins slave.

So the easiest solution, assuming it is possible in your situation, is to just copy the correct settings.xml file to the %HOME%\.m2\ directory on the Jenkins slave machine.

Alternatively, you can specify a custom settings.xml file on the mvn command line using the --settings option, so you could put the file in a known location (e.g. C:\) and then tell Jenkins to pass the setting to Maven, something like --settings C:\settings.xml.

As an aside, it's often useful to create a new Windows user to run the Jenkins slave, so that you can easily tell where it will search for configuration files.

谁与争疯 2024-12-17 13:15:52

像往常一样,解决方案比我想象的要简单。

Jenkins Slave 配置为由系统用户运行。
因此,为了让它使用我的settings.xml,我所要做的就是更改其关联的用户,问题就消失了!

Like always, solution was simpler than I was thinking it could.

Jenkins slave is configured to be run by the System User.
As a consequence, for it to use my settings.xml, all I had to do was changing its associated user, and problem disappeared !

洒一地阳光 2024-12-17 13:15:52

对我来说,让它发挥作用的是使用 -Duser.home 变量。

我确实让这个工作了!然而,代替
将其输入 MAVEN_OPTS,在配置 jenkins 屏幕中,我将其作为 JVM 级别变量输入到我的 Web 服务器。

对我来说,我在 WinTell 上使用 glassfish,而不是 tomcat。 Glassfish 最初是
窗口服务。基本输入:

JVM变量名:user.home
JVM 值: /data/maven-2.2/jenkins

然后,在此目录 /data/maven-2.2/jenkins 中确保您有一个副本
正确输入代理信息的有效 settings.xml。这样做可以让我
为我的 jenkins 服务构建隔离单独的 settings.xml v. 登录
交互地。

埃里克

For me what got this to work was using the -Duser.home variable.

I did get this to work! However, instead of
entering it into the MAVEN_OPTS, in the configure jenkins screens, I entered it as a JVM level variable to my web server.

For me I'm using glassfish on WinTell, instead of tomcat. Glassfish starts as a
windows service. Basically entered:

JVM variable name: user.home
JVM value: /data/maven-2.2/jenkins

Then, in this directory /data/maven-2.2/jenkins make sure you have a copy of
a valid settings.xml with the proxy info entered correctly. Doing so allows me
to isolate a separate settings.xml for my jenkins services builds v. logging on
interactively.

Eric

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文