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

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

  •  20-09-2022
  •  | 
  •  

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.

有帮助吗?

解决方案

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>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top