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 <n...@breun.nl> wrote:

> Rimvydas Vaidelis <rimvydas.vaide...@gmail.com> 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:
>
> ----
> <dependencyManagement>
>   <dependencies>
>     <dependency>
>       <groupId>com.example</groupId>
>       <artifactId>example-bom</artifactId>
>       <version>1.0.0</version>
>       <type>pom</type>
>       <scope>import</scope>
>     </dependency>
>     <dependency>
>       <groupId>com.example</groupId>
>       <artifactId>example-artifact-from-bom-i-want-to-override</artifactId>
>       <version>1.1.0-SNAPSHOT</version><!-- Overrides version from
> example-bom for this artifact -->
>     </dependency>
>   </dependencies>
> </dependencyManagement>
>
> <dependencies>
>   <dependency>
>     <groupId>com.example</groupId>
>     <artifactId>example-artifact-managed-by-bom</artifactId>
>   </dependency>
>   <dependency>
>     <groupId>com.example</groupId>
>     <artifactId>example-artifact-from-bom-i-want-to-override</artifactId>
>   </dependency>
> </dependencies>
> ----
>
> Nils.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to