简体   繁体   English

从Jenkins在Ant构建中查找Maven settings.xml

[英]Finding Maven settings.xml in an Ant build from Jenkins

I am new in Jenkins. 我是詹金斯的新人。 I configured a job, which gets the source from SVN, then calls an Ant build file. 我配置了一个作业,该作业从SVN获取源代码,然后调用一个Ant构建文件。 Inside the And build, there is a Maven call, done by the Maven Ant Tasks plugin. 在And内部,有一个Maven调用,由Maven Ant Tasks插件完成。 Additionally I have a changed settings.xml for maven, where I have configured a repository other than the default maven central repo. 另外,我为maven更改了settings.xml,在其中配置了除默认maven中央存储库以外的存储库。 If I call the Ant build from the command line, it works fine. 如果我从命令行调用Ant构建,则可以正常工作。 It finds the correct settings.xml at my user home (.m2/settings.xml). 它在我的用户主目录(.m2 / settings.xml)中找到正确的settings.xml。 But the same script doesn't work from Jenkins. 但是,詹金斯无法使用相同的脚本。 The log shows that it tries to get things from the maven central repo, so not my custom settings.xml is used. 日志显示它尝试从Maven中央存储库获取内容,因此未使用我的自定义settings.xml。 I created a .m2 directory with my custom settings.xml to several places, but it still doesn't find it. 我使用自定义settings.xml创建了一个.m2目录,该目录位于多个位置,但是仍然找不到。 Also I have added the Config File Provider Plugin to Jenkins and added my custom settings.xml. 另外,我已经将配置文件提供程序插件添加到Jenkins并添加了自定义settings.xml。 How should I get this working? 我应该如何工作?

Thanks! 谢谢!

The answer is: It depends on how your Jenkins is installed. 答案是:这取决于您的Jenkins的安装方式。

For home development purposes, I installed Jenkins by just putting the jenkins.war file into a running Jetty web server. 出于家庭开发目的,我通过将jenkins.war文件放入正在运行的Jetty Web服务器中来安装Jenkins。 This web server is automatically started (via services) using another (!) account. 此Web服务器使用另一个(!)帐户自动启动(通过服务)。 The home directory of this other account must contain the .m2 directory with the settings.xml. 此其他帐户的主目录必须包含带有settings.xml的.m2目录。

So, find out, under which account you Jenkins is started. 因此,找出詹金斯是从哪个帐户开始的。 Then put the settings file under a .m2 directory into this account's home direcory. 然后将设置文件放在.m2目录下,放入该帐户的目录中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM