简体   繁体   中英

Exclude folder from dependency in maven

Is it possible to define the directory exclusion for the dependency in maven?

I have a dependency defined in pom.xml. When compiled, this dependency is added into META-INF/lib. The problem is, the library contains about 40 MB of XML files I do not need, so I want to get rid of them.

Something like this:

<dependency>
  <groupId></groupId>
  <artifactId></artifactId>
  <version></version>
  <scope>test</scope>
  <exclusions>
    <exclusion>
      <exclude>**/xml/*</exclude>
    </exclusion>
    ...

This is what I want to use as a dependency: Jira Func Tests

The folder with XMLs is in the compiled jar in META-INF/lib/jira-func-tests-6.4.6.jar/XML Before compilation, the XML folder is in resources folder of the jira-func-tests I guess?

those XML files have to be "attached to something". Here is an example what usualy works and should work even in maven-2. So finding connections between those XML files and groupIDs and artifactIDs.

<dependency>
  <groupId>log4j</groupId>
  <artifactId>log4j</artifactId>
  <version>1.2.15</version>
  <scope>provided</scope>
  <exclusions>
    <exclusion>
      <groupId>javax.mail</groupId>
      <artifactId>mail</artifactId>
    </exclusion>
    <exclusion>
      <groupId>javax.jms</groupId>
      <artifactId>jms</artifactId>
    </exclusion>
    <exclusion>
      <groupId>com.sun.jdmk</groupId>
      <artifactId>jmxtools</artifactId>
    </exclusion>
    <exclusion>
      <groupId>com.sun.jmx</groupId>
      <artifactId>jmxri</artifactId>
    </exclusion>
  </exclusions>
</dependency>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM