Re: Dependency version change on dependency import

2022-03-13 Thread Nils Breunese
Rimvydas Vaidelis  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 import you’re only importing  
as far as I know, so if there are  in the BOM those will not be 
imported.

Nils.
-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: Dependency version change on dependency import

2022-03-13 Thread Rimvydas Vaidelis
Hi Nils,

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. 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?

--
Rimvydas

On Sat, Mar 12, 2022 at 2:42 AM Nils Breunese  wrote:

> Rimvydas Vaidelis  wrote:
>
> > I have a multi-module project and I want to create a bill of materials
> > (BOM) module. BOM module contains dependencyManagement. My parent module
> > imports BOM module. BOM module will be used in another project that is
> > going to use my library. In development environment I would like to
> change
> > version of one dependency. I tried to do that using a profile but it
> seems
> > that maven does not activate the profile while performing import. Is it a
> > normal behavior? Maybe you could recommend any other way to implement
> > dependency version change in development environment.
>
> I believe you can add a regular dependency entry for the artifact for
> which you want to override the version, like this:
>
> 
> 
>   
> 
>   com.example
>   example-bom
>   1.0.0
>   pom
>   import
> 
> 
>   com.example
>   example-artifact-from-bom-i-want-to-override
>   1.1.0-SNAPSHOT
> 
>   
> 
>
> 
>   
> com.example
> example-artifact-managed-by-bom
>   
>   
> com.example
> example-artifact-from-bom-i-want-to-override
>   
> 
> 
>
> Nils.
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>


Re: Dependency version change on dependency import

2022-03-11 Thread Nils Breunese
Rimvydas Vaidelis  wrote:

> I have a multi-module project and I want to create a bill of materials
> (BOM) module. BOM module contains dependencyManagement. My parent module
> imports BOM module. BOM module will be used in another project that is
> going to use my library. In development environment I would like to change
> version of one dependency. I tried to do that using a profile but it seems
> that maven does not activate the profile while performing import. Is it a
> normal behavior? Maybe you could recommend any other way to implement
> dependency version change in development environment.

I believe you can add a regular dependency entry for the artifact for which you 
want to override the version, like this:



  

  com.example
  example-bom
  1.0.0
  pom
  import


  com.example
  example-artifact-from-bom-i-want-to-override
  1.1.0-SNAPSHOT

  



  
com.example
example-artifact-managed-by-bom
  
  
com.example
example-artifact-from-bom-i-want-to-override
  



Nils.
-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org