Search code examples
linuxwindowsmavennetbeansnotepad++

Remove Duplicate Dependencies in Maven Pom


I would like to remove duplicate dependencies in maven pom.xml.

I would like answers to multiple tools Linux, Notepad++, Netbeans, Intellij ...even...VIM,etc.

example (I can obvious delete but I would like a search replace answer)

  `<dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-server</artifactId>
        <version>2.7</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet-core</artifactId>
        <version>2.7</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-jetty-http</artifactId>
        <version>2.7</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-moxy</artifactId>
        <version>2.7</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-jetty-http</artifactId>
        <version>2.7</version>
    </dependency>`  

Please write the answer locally links can be frustrating if removed. Thanks.


Solution

  • Run mvn clean It will tell you your duplicate dependencies. Then delete them.