maven-dependency-plugin:排除.jar文件

时间:2016-01-17 14:48:51

标签: maven continuous-integration maven-dependency-plugin

我正在使用maven-dependency-plugin。我只需要下载一个ZIP文件并排除所有jar文件。

插件配置看起来如下。

<execution>
    <id>copy-dependencies</id>
    <phase>package</phase>
    <goals>
        <goal>copy-dependencies</goal>
    </goals>
    <configuration>
        <!-- <outputDirectory>${project.build.directory}</outputDirectory> -->
        <overWriteReleases>false</overWriteReleases>
        <overWriteSnapshots>false</overWriteSnapshots>
        <overWriteIfNewer>true</overWriteIfNewer>
        <excludes>**/*.jar</excludes>
        <includes>**/*.zip</includes>
    </configuration>
</execution>

该插件仍会下载所有内容:所有罐子。

1 个答案:

答案 0 :(得分:1)

maven-dependency-plugin的{​​{3}}目标不支持includesexcludes属性。

但是,您可以使用copy-dependencies属性排除特定的excludeTypes

  

逗号分隔要排除的类型列表。空字符串表示不排除任何内容(默认)。

以下内容将排除所有jar依赖项:

<execution>
    <id>copy-dependencies</id>
    <phase>package</phase>
    <goals>
        <goal>copy-dependencies</goal>
    </goals>
    <configuration>
        <!-- <outputDirectory>${project.build.directory}</outputDirectory> -->
        <overWriteReleases>false</overWriteReleases>
        <overWriteSnapshots>false</overWriteSnapshots>
        <overWriteIfNewer>true</overWriteIfNewer>
        <excludeTypes>jar</excludeTypes>
    </configuration>
</execution>