问题
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>
The plugin still downloads everything: all jars.
回答1:
The copy-dependencies goal of the maven-dependency-plugin
does not support includes
and excludes
attributes.
However, you can use the excludeTypes attributes to exclude specific types of dependencies.
Comma Separated list of Types to exclude. Empty String indicates don't exclude anything (default).
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>
来源:https://stackoverflow.com/questions/34839656/maven-dependency-plugin-exclude-jar-files