Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide inherited dependencies in Versions Maven Plugin?

I'm trying to use Versions Maven Plugin, together with spring-boot.

Problem: when running versions:display-dependency-updates to autoecheck for latest dependencies, I'm not only getting the updates defined in my pom.xml, but also all inherited dependencies from spring-boot-starter-parent.

Question: how can I prevent inheritance and just show the self-defined dependencies?

<project>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.RELEASE</version>
    </parent>


    <properties>
    <cxf.version>3.0.0</cxf.version>
    </properties>

    <dependencies>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>${cxf.version}</version>
    </dependency>
    </dependencies>
</project>

At best, the plugin would inform me of updates similar to:

spring-boot-starter-parent.....2.0.0 -> 2.0.3
cxf-rt-frontend-jaxws..........3.0.0 -> 3.2.6

But instead, I'm getting output an all dependencies inherited from the spring parent.

like image 215
membersound Avatar asked Sep 10 '18 14:09

membersound


1 Answers

You can use the versions:display-property-updates goal instead. This goal only considers the dependency versions that are given as properties, so it will not show the transitive dependencies. You'll have to add a few more version properties to your pom, but that's not a bad thing in general.

The documentation for the versions:display-dependency-updates goal does not include a flag to exclude transitive dependencies. So I assume it's not possible using that goal. I couldn't find any relevant open issues on issues.apache.org either, so it doesn't seem to be on the roadmap.

like image 145
gjoranv Avatar answered Nov 09 '22 23:11

gjoranv