TeamCity Cloud and local maven repository

Hello. I havea large multi-module project that is built by various build configurations, on various branches. I am using TeamCity Cloud, and I have only cloud agents.

It seems to me that all of the maven dependencies are always downloaded, is if the Maven local repo was always empty. Probably I cannot understand the maven "Local Artifact repository" setting in the Maven build step in my configurations, but I think that at least one of its options should allow the Mave repo to be shared among all the agents and all the build configurations. It seems to me that it is not the current case.

Is there something I am doing wrong? How can I achieve my purpose? This is quite critical, since often builds fail due to dependencies not being downloaded (I'd like them to be already in place from the previous builds), and a lot o f time goes on downloading the same dependencies over and over.


Comment actions Permalink

Hello. I still have this question open. I tried all the three different options, but in all cases the dependencies are downloaded over and over. This is not good both for the build time and for the traffic I generate (that in some cases I need to pay). I found no answers elsewhere.


Comment actions Permalink

Hi Federico,


I'm afraid that on TeamCity Cloud currently regular agents are image based ones, which means that after disconnecting they will be destroyed. The "local maven repo" feature is irrelevant for this type of agents since even if a local repo is set up, it will be discarded anyways.


The main workaround for this would be using self-hosted agents, which you can handle as you please and will not be destroyed unless you do it yourself. Another alternative would be to publish the files as teamcity artifacts that your other builds can request, avoiding the dependency on maven, but that would require to either modify your build scripts or to craft the artifact dependency in a way where maven can pull them directly. Artifact dependencies are pulled at the start of the build before maven kicks in, so you would be able to either download it to a specific location or add a first build step with a script to take care of it.


We have a feature in the works to be able to share build caches between builds, where maven dependencies would be one of the main subjects of interest when we discussed its creation. You can track its progress here:


Please sign in to leave a comment.