简体   繁体   中英

jenkins is not using local maven repository

I have few jars which I have installed in my local maven repo(in windows under user/.m2). While building the project from command-line it's perfectly downloading the jars and packaging it.

Now I have created a Jenkins job (mvn clean package) to do so, but while running the jobs it's not picking up those jars from local repo instead trying to download it from central repo.

I tried all possible solutions available in Internet but still no luck. Can you please how I can configure Jenkins so that it should download those jars from my local repo ?

I also tried :- 1. offline mode 2. gave local repo path in settings.xml 3. use of nexus/artifactory in not an option for me

Seems maven executed by Jenkins not used the settings.xml in your local

you can try to change the maven command/goal in Jenkins job configuration with one more option:
-f <your local settings.xml path>

you can copy the settings.xml to your source code folder for debug purpose, after prove it work, then consider how to prepare the settings.xml for jenkins job with below options:

Option 1 use Config file provider plugin
在此处输入图片说明

Click Config Files -> Add a New Config -> Maven settings.xml

Change name and set your xml into content field:

在此处输入图片说明

In your job configuration, click the Advance... button in Build Section, choose your added settings.xml as below:

在此处输入图片说明

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