Mathias
Mathias

Reputation: 344

Maven Version range: how to set upper limit if breaking changes are not in sight?

We are developing multiple dependencies for our applications, one shared project containing code for all applications and one adapter per application for easier (and clearly defined) access from another application. The adapters also have the shared project as dependency. When setting the version of the shared dependency in the adapters, I want to use Maven version ranges, so Maven knows that using a newer version of shared (as the application commands) is no problem.

The problem is, how do I set the upper version limit of the shared dependency? I cannot know when a certain adapter needs to change, so I cannot set the correct upper limit in the moment I deploy the adapter. Deploying an updated artifact the moment I know the upper limit would be bad practice (and not work, as only snapshots get updated) because a released version should not change.

I guess the clean solution would mean that the minor version in the shared project tells that the adapters need to change, so I should set the upper limit to the next minor version. However if there is a slight change in the shared project which affects only one adapter, all the other adapters need an update (newer bug version) with an adjusted upper limit, and all applications need to update all adapters (so Maven does not wrongly resolve the dependency conflict). This would mean a lot of work.

Am I missing a clear solution? Or do I have a flawed understanding of Maven version ranges?

Upvotes: 0

Views: 443

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35903

Avoid version ranges.

Use <dependencyManagement> to fix versions of transitive dependencies.

Upvotes: 1

Related Questions