Rimvydas Vaidelis <[email protected]> wrote:

> Thank you for the answer. I know that I can override the dependency version
> in pom that imports the bom module. I wanted to avoid duplicating of the
> dependency overriding in my library and in another project. However now I
> see that it is the only way to implement what I want.

What exactly do you need to duplicate? You could also specify the override 
version on the dependency directly, without putting it in dependencyManagement, 
but I personally only manage versions in dependencyManagement, because I often 
work on multi-module projects and consider that a good practice.

Another way to override a specific dependency would be to have a dedicated 
Maven property for it, so you’d only have to override that one.

I’m also kind of wondering why you have this use case. Generally when I import 
a BOM and need a new version of some dependency I just change the version of 
the whole BOM import, because that is supposed to be a consistent set of 
modules. Couldn’t you do that instead of overriding only one version from the 
BOM?

> Actually it was
> strange to me that maven does not respect active profiles on dependency
> import request. Maybe there is a reason why it is like that. It would be
> good if somebody could comment that. Is it by design or it is just
> implemented in this way?

When you use <scope>import</scope> you’re only importing <dependencyManagement> 
as far as I know, so if there are <profiles> in the BOM those will not be 
imported.

Nils.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to