Config maven setting in Jenkins

╄→гoц情女王★ 提交于 2019-12-29 07:53:07

问题


My project has 3 maven module and they are built by nodejs script.

Now I want to integrate with Jenkin and Nexus. My Jenkin build config look like this:

I also add my maven settings.xml in Provide configuration files build step in Build section but it didn't work. Maven still fail and could not resolve dependencies in my Nexus repo.

In my local maven settings.xml I have added some config for Nexus repository and another repository.

Can you enlight me this case. I'm new to Jenkin.

Thanks in advance.


回答1:


I just find a way to work around by adding mvn-settings.xml directly to my folder and edit the run command like:

mvn clean install -s mvn-settings.xml



回答2:


I also add my maven settings.xml in Provide configuration files

Wait... you never have to do that: Any maven command would look for the settings.xml file in $HOME/.m2/settings.xml: you only need to make sure the user running the Jenkins slave (where the job is actually executed) does has that file in that specific folder.
Then make sure the user can use mvn clean install on a local maven project first. Once that is working, you can try your Jenkins build.



来源:https://stackoverflow.com/questions/43796428/config-maven-setting-in-jenkins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!