Search code examples
mavenrepositoryjenkins

jenkins maven repository configuration


I am new to maven and Jenkins, I am trying to build a maven 3 project. I have maven in c drive and I moved the repository to d drive. But when I configure a build in Jenkins, it is creating its own repository(I think so) Now How to configure jenkis, so that it can use my repository in D drive.

Hope I made sense.


Solution

  • you need to adjust the settings.xml to point out which repository to use.

    <localRepository>C:\\USER_LOCAL_DIR\.m2\m2repository</localRepository>
    

    where USER_LOCAL_DIR is your user directory (e.g. Users\your_user_name).

    Further more you should make sure which settings.xml the maven is using, if you dont have any specific user settings.xml the maven will start using the settings.xml which is at maven configuration directory, which will be M2_HOME/conf/settings.xml (M2_HOME being the Maven home directory). The hierarchy for settings.xml is first the user .m2 directory and if it could not find that, it will try to find the one in M2_HOME/conf/settings.xml.

    Hope this helps.