How can I set pom.xml to get latest library version?

As I asked, How can I set pom.xml to get latest library version?

There is a project (assume this A project) which contains another project ( assume this B project) .

If B project built and deployed version 1.1 then A project should have B-1.1.jar.

I want to make this without modify A project's pom.xml everytime after B project deployed.

Is this possible?


Comment actions Permalink

Hello SungHoon

The ability to produce repeatable builds is one of the key concept of Maven. This generally guarantees you will have the same build results for the same POM even if new versions of dependencies have been deployed since the latest build.
This means that if you want to upgrade to another version of the library, you should manually change the dependency.

TeamCity doesn't make any influence on this process since we believe this concept is quite consistent.

However, there are exceptions serving for some specific cases, which you may consider

1. SNAPSHOT dependencies.

If project B is under development and you want project A to integrate with the latest development version of B you can assign B a snapshot version (say 1.1-SNAPSHOT) and make B refer to it.
This will force Maven to take the latest available snapshot version every time project B is being built

2. version ranges

You may specify a certain range of dependency versions your project can accept. For example B can accept any version of A from 1.0 to 2.0. I'm not sure which version Maven prefers when multiple acceptable versions are available in the repository, but following the common sense I think it should take the latest acceptable.

Please refer to

Hope this helps

Comment actions Permalink

Thanks Sergey, it helps a lot.


Please sign in to leave a comment.