Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set up TeamCity agents to use separate maven local repositories?

I want to set up each TeamCity agent to use a local repository (maven.repo.local) in the agent's working directory (agent.work.dir). Is it possible to configure maven properties to use TeamCity properties in this way?

like image 243
Craig P. Motlin Avatar asked Feb 10 '10 16:02

Craig P. Motlin


2 Answers

Enter -Dmaven.repo.local=%system.agent.work.dir%/.m2 for the setting Runner: Maven2 / JVM command line parameters

like image 167
Craig P. Motlin Avatar answered Oct 23 '22 07:10

Craig P. Motlin


I don't use TeamCity, but Bamboo. The way I do this is for the maven goals, I have this defined:

-Dmaven.repo.local=${bamboo.M2REPOHOME}/${bamboo.buildKey} ...

Then the property M2REPOHOME is defined to be someplace on the filesystem, and bamboo.buildKey is the project name. I keep my m2 repositories all in one spot so I can easily nuke them. You should probably do something similar by setting maven.repo.local to the value of agent.work.dir, or someplace else. Quickly looking at the TeamCity docs, it looks like you would do something like this:

-Dmaven.repo.local=%agent.work.dir%/m2
like image 36
Larry Shatzer Avatar answered Oct 23 '22 07:10

Larry Shatzer