Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
fixed a typo
Source Link
Illya Kysil
  • 1.8k
  • 10
  • 18

It looks like that version is not released yet, but there is a workaround.

There is an example of dependencies import at Importing Dependencies with following explanation:

There is an example of dependencies import at Importing Dependencies with following explanation:

It looks like that version is not released yet, but there is a workaround.

There is an example of dependencies import at Importing Dependencies with following explanation:

Source Link
Illya Kysil
  • 1.8k
  • 10
  • 18

There is an example of dependencies import at Importing Dependencies with following explanation:

<project> <modelVersion>4.0.0</modelVersion> <groupId>maven</groupId> <artifactId>Z</artifactId> <packaging>pom</packaging> <name>Z</name> <version>1.0</version> <dependencyManagement> <dependencies> <dependency> <groupId>maven</groupId> <artifactId>X</artifactId> <version>1.0</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>maven</groupId> <artifactId>Y</artifactId> <version>1.0</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> </project> 

In the example above Z imports the managed dependencies from both X and Y. However, both X and Y contain dependency a. Here, version 1.1 of a would be used since X is declared first and a is not declared in Z's dependencyManagement.

Given that description, you should be able to override the version and/or scope of offending dependency if you define it BEFORE imports.

Following the same example, the definition below should use version 2.0 of a:

<project> <modelVersion>4.0.0</modelVersion> <groupId>maven</groupId> <artifactId>Z</artifactId> <packaging>pom</packaging> <name>Z</name> <version>1.0</version> <dependencyManagement> <dependencies> <dependency> <groupId>test</groupId> <artifactId>a</artifactId> <version>2.0</version> </dependency> <dependency> <groupId>maven</groupId> <artifactId>X</artifactId> <version>1.0</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>maven</groupId> <artifactId>Y</artifactId> <version>1.0</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> </project> 

Make sure to check the effective pom!