Search code examples
mavendependencies

scope not updated to compile to a dependency with scope compile in child pom


I have a parent-pom with a dependency

<dependency>
        <groupId>xxx</groupId>
        <artifactId>abc</artifactId>
        <scope>provided</scope>
</dependency>

And in child pom I am using the same dependency with the scope as compile (snippet below)

<dependency>
    <groupId>xxx</groupId>
    <artifactId>abc</artifactId>
    <scope>compile</scope>
</dependency>

The dependency tree of child pom for dependency abc looks like below:

xxx:abc:jar:1.0.1:provided (scope not updated to compile)

How do I get dependency abc under scope compile in child pom ?


Solution

  • You cannot just override dependencies. You need to change the parent POM or use a different parent POM.

    This is why dependencies in parent POMs are often a bad idea.