简体   繁体   中英

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. Inside the And build, there is a Maven call, done by the Maven Ant Tasks plugin. Additionally I have a changed settings.xml for maven, where I have configured a repository other than the default maven central repo. If I call the Ant build from the command line, it works fine. It finds the correct settings.xml at my user home (.m2/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. I created a .m2 directory with my custom settings.xml to several places, but it still doesn't find it. Also I have added the Config File Provider Plugin to Jenkins and added my custom settings.xml. How should I get this working?

Thanks!

The answer is: It depends on how your Jenkins is installed.

For home development purposes, I installed Jenkins by just putting the jenkins.war file into a running Jetty web server. This web server is automatically started (via services) using another (!) account. The home directory of this other account must contain the .m2 directory with the settings.xml.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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