TC 5 EA: Maven 2 dependency triggers not working...

Hi all,

I have just installed TC 5 EA because of the new feature for Maven 2 dependency build triggering. I hope that I understand that correctly, however, I will explain what I expect:

I have project x-api and project x-impl. In the POM file there is a dependency from x-impl to x-api (as x-impl is the implementation of the API defined in x-api). Now when I configure two build configurations, I expect TC to build x-impl when ever x-api is build. Unfortunatelly this does not happen.

When I look into the build configuration details and select the Maven 2 tab, I can see the following:

Build Configurations Dependent Upon

These build configurations produce artifacts which are snapshot dependencies of this Maven projec

Configuration Produced Artifacts
x-api info.test:x-api:0.0.1-SNAPSHOT

This indicates that TC has successfully detected the dependencies in the POM. However, the build of x-impl is not triggered after x-api.

Is it a bug or do I misunderstand it?


Comment actions Permalink

Hello, Adam

Unfortunately the behavior you expected is not implemented yet, although it's planned for future development.
The presence of the link to x-api in Maven2 tab doesn't currently mean that a dependency between these two configurations has been created automatically.
It's now just a hint.

Maven artifact trigger also doesn't rely on any dependencies beetween TeamCity configurations. It rather watches artifact updates in remote Maven repositories available to the project.
It means that your build will be triggered when any artifact of your snapshot dependencies is deployed into the repository.

This would effectively work just as you expected if your "x-api" build configuration deployed its info.test:x-api:0.0.1-SNAPSHOT artifact into the remote repository.

So the full sequence would look like this:

1. X-Api build deploys artifact to the repository
2. Maven artifact trigger (which is polling the repository regularly) detects that the artifact is updated
3. It triggers a new build of X-Impl, which takes (on Maven's own) the updated artifact from the repository

Hope this helps

Comment actions Permalink

Hello Sergey,

this is really a pitty. I know this feature from Hudson (which we are using on a different project) and I was looking for that on TC.

Practically this means, that you always have to configure the dependency builds manually, either by project build triggers or maven artifact triggers (watching the maven repo). The latter is a nice feature, however, you also have to configure that manually. We already have many artifacts built by TC and there will be even more. Doing all this manually is error prone and no fun at all.

If you say that this feature is planned for future releases, what do you mean by future? TC 5.1 or 8.0

Thanks anyway for the great support and the super quick answer!


Comment actions Permalink

Well, as far as I know in Hudson you also have to manually select the checkbox to enable triggering.

Of course we know how it's important to lessen the manual configuration. However automatic triggering in TeamCity of any kind is a thing that always requires manual turining on/off bacause it's naturally based on human decisions to avoid undesired load.
You can mitigate this by utilizing a new feature of 5.0 - build configuration templates. Have you looked at this?
Multiple configurations with similar settings may be based on a single template.

We're going to address automatic dependency resolving right after releasing 5.0 and hopefully implement it in 5.5, in worst case in 6.0.

Comment actions Permalink

serganch schrieb:

Well, as far as I know in Hudson you also have to manually select the checkbox to enable triggering.

Actually this is the default setting and you have to deselect the checkbox if you don't want to have this behaviour.

Build Trigger
Build whenever a SNAPSHOT dependency is built
If checked, Hudson will parse the POMs of this project, and see if any of its snapshot dependencies   are built on this Hudson as well. If so, Hudson will set up build dependency relationship so that   whenever the dependency job is built and a new SNAPSHOT jar is created, Hudson will schedule a build   of this project.

This is convenient for automatically performing continuous integration. Hudson will check the snapshot   dependencies from the <dependency> element in the POM, as well as <plugin>s and   <extension>s used in POMs.
If this behavior is problematic, uncheck this option.

I will check the build configuration templates today...

But good to hear that you are aware of that problem and work on it. Do you have a road map or any idea when we can expect 5.5?

Best regards,

Comment actions Permalink

Thank you for clarifying about hudson. We'll be keeping it in mind when elaborating automatic dependency resolution.
BTW, since build configurations are stored in simple XMLs, as a workaround you can develop a small script or program that would populate build configurations with the required options. You don't even have to restart the server. TeamCity automatically rereads modified files.

Currently we have only preliminary sketches about what 5.5 could be. We're going to start working on a detailed roadmap right after 5.0 release.

Also we would appreciate if you give your suggestions about TeamCity functionality especially in respect of Maven since here in JetBrains we don't have much experience in using Maven.

Feel free to add requests into our tracker -

Thank you!

Comment actions Permalink

Probably we could enable triggering by Maven snapshot dependency automatically if build configuration is auto-created from a pom file.

Comment actions Permalink

Hi guys,

I wanted to comment on this because I was also expecting the behaviour to be similar to the origianl poster.  After much struggle I finally settled on the following SVN structure for my Maven projects (not all modules shown for the sake of brevity):

  • projects
    • project-main
    • project-assemblies
    • project-services
    • project-flex-ui
  • assemblies
    • assembly-ear
    • assembly-war
    • assembly-air
  • modules
    • module-domain
    • module-flex-core
    • module-flex-ui
    • module-air-ui
    • module-services-core
    • module-services-java
    • module-services-amf

Using 'modules' as an example, all of the build configurations are identical with the exception of (snapshot) dependencies.  Initially I though I could use TeamCity as follows:

  1. Create a build template named Module (Template).
  2. Define a property that is used as part of the checkout rules.
    • -:.
    • +:modules/>.
    • +:build-runners/maven2-current=>.
  3. Create a configuration for every module based on the template.
  4. Let Maven2 dependency triggers do what the original poster described.

Maybe I'm missing something, but the templating doesn't seem very useful with the way dependencies need to get set up between my modules.  I find myself using a template to save a bit of typing during the initial configuration of a module, but then I have to detach the build configuation so I can set up dependencies and build triggers by hand.  After that I'm in the same position I was with v4.5 and no templates.  If I want to change something (ie: check out a different maven version as a build runner) I have to change every configuartion by hand which is both error prone and a major hassle.

If Maven2 dependency triggering worked the way the original poster is describing I could easily set up a dozen modules in a matter of minutes and maintain all of them via a single template.

I'd also be interested to know how others set up their Maven builds within TeamCity.  I've tried using one build configuration per module and using one big monolithic build configuration.  I prefer one configuration per module because, once dependencies are configured properly, TeamCity will only build modules that have been impacted by changes or updated dependencies.  However, it's considerably more work to set up and maintain (and it eats up 20 build configs very quickly even on a small, independent project).

Comment actions Permalink

Ability to extend dependencies for template based configurations will be in the next public build (EAP or RC). As for triggers - could you please explain how triggers will differ in your configurations? Do you need to set Maven snapshot dependency triggering for some of them and disable for others?

Comment actions Permalink

Hi Ryan,

glad to see that I am not the only one requesting this feature. I think that maven will spread more and more in the next time, also with the next release (Maven 3), which is faster and more modularized making configuration even simpler (quote: "Maven for the people").

Concerning the pom file configuration, there is a second open source CI called Continuum (at Apache -> Here you can configure the whole project build directly from the pom file. I.e., svn location, build dependency, deployment repositories etc. Everything will be configured by parsing the pom file.

I mean, you already parse the pom file, but there is still this small missing link to process it properly.


Comment actions Permalink

I added on Create Maven Build Configuration a checkbox for enabling the snapshot trigger checked by default

Comment actions Permalink

pavel.sher wrote:

Do you need to set Maven snapshot dependency triggering for some of them and disable for others?

No, the dependencies are different for each module.  Assume I have 3 modules and they depend on eachother like this:

  • module-services-amf >> depends on >> module-services-core >> depends on >> module-domain

If module-domain changes then I want module-services-core to re-build.  If module services-core changes I want module-services-amf to rebuild.  However, from what I can tell, there's no easy way for me to get a module to re-build if if one of the Maven dependencies changes.  I can get the desired effect if I configure all the dependencies by hand in TeamCity, but, since that information is already available from the pom files, I was expecting things to be a little bit more automatic.

I'll attach a screenshot of one of my modules.  It's called itma-services-core and has a single direct dependency declared in the pom; itma-domain.  TeamCity already resolves the dependencies and knows there's a build for itma-domain that itma-services-core will depend on.  However, I still need to go and add all of the maven dependencies by hand.  Since all of the necessary information is already there why can't there be a setting I can check that will automatically rebuild a (Maven) module when another (Maven) module on which it depends builds successfully?

I added an example of the type of option I'd like to see in the screenshot.  It's just to illustrate what I mean, so don't read too much into it.  Obviously such an option would fit better in the Triggers section of the build config.  I hope I've explained things well enough.

Comment actions Permalink

Agree, and this option should be selected by default! This is the way you want to build maven projects.

Comment actions Permalink

Hello, Ryan

This exactly what we're going to implement in 5.5 - 6.0. We didn't incude this into 5.0 because it's implementation is a bit more complex than it may look at first glance. For example, let's assume you have multiple itma-domain configurations - a couple for different types of testing, another one for inspections, yet another one for deploying, etc. I think you would hardly want itma-services-core to be built each time ANY of the mentioned builds would finish. So the automatic dependency resolution should be a bit smarter than just determining which configurations produce dependencies.

Comment actions Permalink

Thanks for the reply Sergey.  I understand the complexities.  Being able to extend dependencies as was mentioned earlier in this thread sounds like it'll work fairly well for me for the time being.  I'll watch for the next EAP and give it a try.

Comment actions Permalink

Have you tried the link "Create Maven build configuration" on the project administration page?
This is somewhat similar to Continuum.

Although in the latest EAP you can only create a configuration providing an SCM URL to your pom, in the next EAP/RC it will be enhanced with ability to specify a regular URLs (like http:, ftp:, file: etc) and upload pom.
It also enables by default the snapshot trigger

Comment actions Permalink

It also enables by default the snapshot trigger :)

When you say this do you mean that TeamCity will trigger a build to run whenever a dependent Maven configuration finishes?  I added the two builds I described above (in my screenshot) using the "Create Maven build configuration" and it didn't seem to have any effect on the build triggers.  I'm using build 10574 if that makes a difference.

It's not an issue for me.  I'm only asking out of curiosity, since it sounds like the templates are going to be the ideal solution for me in the next EAP / RC.

Comment actions Permalink

No. A build will be triggered when a SNAPSHOT artifact updates. It just enables SNAPSHOT artfiact trigger.
The EAP you have doesn't contain this yet. I added the checkbox one of these days.
It will look like in the screenshot attached.


Please sign in to leave a comment.