override library version defined in parent pom

maven, pom.xml

Solution

In general, it is recommended to have only one version of dependency in your classpath at a given time. Doing in such a way will allow you to know exactly what version of class will be used at runtime.

To avoid version conflicts try to specify your dependency like this:

<dependency>
    <groupId>commons-daemon</groupId>
    <artifactId>commons-daemon</artifactId>
    <version>1.0.1</version>
    <exclusions>
        <exclusion>
            <groupId>some_group</groupId>
            <artifactId>some_artifact</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Where you need to specify the `groupId` and `artifactId` of your conflicting artifact with version 2.5.

Problem

I have defined version 4.3 in the parent pom for a library A , but in the project module specified by the child pom , version 2.5 of A is required. The issue I am facing is that both the versions are being kept and hence I am getting conflicts. Please advise how to resolve the issue.

Original source

Related problems