问题
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