Maven remove specific artifacts / artifacts group from dependency:dependency-copy result

StackOverflow https://stackoverflow.com/questions/20708271

  •  20-09-2022
  •  | 
  •  

Frage

I have to copy dependencies of some project excluding some of them. Exclusion is to be transitive. OK, this is the task maven-dependency handles without any problem. So far so good.

Next step I need to remove (filter out) some artifacts from all of this directory content. Only specific artifacts or better artifacts group. No transition. This is why I cannot join this with previous step.

Is it doable based on some popular maven plugin? Used maven is 3.x if it does matter.

War es hilfreich?

Lösung

You can define exclusions to maven dependencies. I hope this is what you are looking for.

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>3.3.1.GA</version>
        <exclusions>
        <exclusion>
            <artifactId>xml-apis</artifactId>
            <groupId>xml-apis</groupId>
        </exclusion>
        </exclusions>
    </dependency>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top