本文介绍了maven-dependency-plugin:排除.jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using maven-dependency-plugin. I need to download only a ZIP file and exclude all jar files.

插件配置采用以下方式.

Plugin configuration looks the following way.

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

该插件仍会下载所有内容:所有jar.

The plugin still downloads everything: all jars.

推荐答案

maven-dependency-plugin 的="nofollow"> copy-dependencies 目标不支持 includes excludes属性.

The copy-dependencies goal of the maven-dependency-plugin does not support includes and excludes attributes.

但是,您可以使用 excludeTypes 属性以排除特定的依赖项类型.

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

The following will exclude all the jar dependencies:

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

这篇关于maven-dependency-plugin:排除.jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 05:01