Specify Maven Repository Location

Hey all, I have TeamCity set up on a small Windows server, and I'm using Maven to build my projects. I am still fairly new to Maven and TeamCity, but so far I'm really enjoying how they work together. I do have one issue that I would like to resolve though: I would like to move my default maven repository. The server I am using has a fairly small C: Drive and a very large (and empty) D: Drive, so I would like to move the Maven repository to D:\\.m2 in order to save some space on the C: drive. I can't find an option to do this through the TeamCity UI anywhere, and the only config file I found that has the location specified cannot be edited while the service is running (and dissappears when the service is stopped). How can I specify the location of the Maven repository?

2 comments
Comment actions Permalink

Hello Brandon,

In case you only have one agent on the same server with Teamcity, the simpliest way to achieve this is to configure Maven. You will need to edit file %M2_HOME%/conf/settings.xml and add localRepository element, that points to desired location. See this and this pages for more details about maven and Teamcity.

You may also want to move Agent's working directory to your empy drive. See this documentation for instructions.

0
Comment actions Permalink

I couldn't get TeamCity to recognize the edited config file from my M2_HOME/conf directory, but I uploaded that file to TeamCity as a user config file and now it is using the new repository location. Thanks!

0

Please sign in to leave a comment.