The Duplicated Managed Version warning message is due to the dependency that has been added more than once to the Maven POM.xml. If you open the pom.xml file, you may see the dependency once. But the warning message will be displayed as below.
The Duplicating Managed Edition warning message is popular in the maven project. Most of the times, the developers ignores this warning message. The warning message is fixed in simple steps. This warning message will always appear in the Problems tab in eclipse. Here we’ll see this warning message and how to fix this warning message.
Duplicating managed version 3.9 for commons-lang3
Root Cause
The maven project is a multi-module maven project. There’s going to be a maven main project. Any or more maven modules have been added to the project along with the main project. If a dependency is applied to the project in the maven module, this warning message will be displayed. This warning message is harmless.
Added dependency is already added to any of the Maven POM.xml parent files. When a dependency is applied to the project module, it is identified as a duplicate. This warning message is shown.
How to reproduce this warning
First, build a multi-module maven project by following these steps. Build a master maven project. Then build a project for a maven module. Add a dependency in the < dependencyManagement > section in the maven main project. This tag states that the dependency under < dependencyManagement > is managed in the main project.
Now apply the same dependency to the maven module project. The added dependency is in conflict with the parent dependence, which is shown as a duplicate dependency identification.
In the example below, the “commons-lang3” dependency with version 3.9 appears as a “Duplicated Managed Version.” The parent project is ‘ spring-boot-starter-parent. ‘
pom.xml (child / module)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.yawintutor</groupId>
<artifactId>Spring-Application</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SpringBootJsonbSimple</name>
<description>Spring Boot Project</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
The parent project pom.xml includes the dependency “commons-lang3.” The code below shows that the “commons-lang3” dependency is attached to the parent pom.xml within the dependency management tag. Commons-lang3 is updated to version 3.9.
pom.xml (parent maven project)
<?xml version="1.0" encoding="utf-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.2.5.RELEASE</version>
<relativePath>../../spring-boot-dependencies</relativePath>
</parent>
<properties>
<commons-lang3.version>3.9</commons-lang3.version>
</properties>
<dependencyManagement>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
</dependencyManagement>
...........
...........
<?xm/>
Solution 1
The child pom.xml is an extension to the parent pom.xml file. The dependency specified in the < dependencyManagement > tag is reused in the pom.xml file. Therefore, if any dependency is replicated in the child pom.xml file, no version information needs to be defined in the Child pom.xml file. Delete the tag < version>.
The code below shows the full pom.xml file after the tag has been removed.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.yawintutor</groupId>
<artifactId>Spring-Application</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SpringBootJsonbSimple</name>
<description>Spring Boot Project</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>