简体   繁体   English

在Maven中从依赖项中排除文件夹

[英]Exclude folder from dependency in maven

Is it possible to define the directory exclusion for the dependency in maven? 是否可以为Maven中的依赖项定义目录排除?

I have a dependency defined in pom.xml. 我在pom.xml中定义了一个依赖项。 When compiled, this dependency is added into META-INF/lib. 编译时,此依赖项将添加到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. 问题是,该库包含约40 MB不需要的XML文件,因此我想摆脱它们。

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 这就是我想用作依赖项的内容: Jira Func测试

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? 带有XML的文件夹位于META-INF / lib / jira-func-tests-6.4.6.jar / XML的已编译jar中。在编译之前,XML文件夹位于jira-func-tests的resources文件夹中?

those XML files have to be "attached to something". 这些XML文件必须“附加到某物”。 Here is an example what usualy works and should work even in maven-2. 这是一个示例,即使在maven-2中也可以正常工作。 So finding connections between those XML files and groupIDs and artifactIDs. 因此,在这些XML文件与groupID和工件ID之间找到连接。

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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