[英]maven-dependency-plugin <includes> tag doesn't work
The <includes> tag in the maven-dependency-plugin entry give below doesn't seem to work. 下面给出的maven-dependency-plugin条目中的<includes>标签似乎不起作用。
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.test</groupId>
<artifactId>test-build-common</artifactId>
<version>${project.version}</version>
<classifier>others</classifier>
<type>tar</type>
<outputDirectory>target</outputDirectory>
<includes>**/common_test.sh</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
The contents of the test-others.tar retrieved by the above entry containts the following items 由上述条目检索的test-others.tar的内容包含以下项目
common/a.sh common/b.sh common/common_test.sh
I expect the only common/common_test.sh to be extracted to the target directory during build. 我希望在构建期间将唯一的common / common_test.sh提取到目标目录。 However, all files are actually extracted to the target directory. 但是,所有文件实际都是提取到目标目录。 Due to space constraints on the disc, unwanted files are not be extracted. 由于光盘上的空间限制,不会提取不需要的文件。
How can I properly pick only the required files to be extracted? 如何才能正确选择要提取的所需文件?
UPDATE: Seems this is bug is version 2.8. 更新:似乎这是bug版本2.8。 It works in version 2.10 of the plugin. 它适用于插件的2.10版本。
You have to use exclude as well because if you will see the documentation the includes says , (component code = return isIncluded( name ) AND !isExcluded( name );) 您还必须使用exclude,因为如果您将看到包含的文档,(组件代码= return isIncluded(name)AND!isExcluded(name);)
So use as well and that will work fine. 所以也要使用,这样可以正常使用。
You can use the link below for your reference. 您可以使用以下链接供您参考。 https://maven.apache.org/plugins/maven-dependency-plugin/unpack-dependencies-mojo.html https://maven.apache.org/plugins/maven-dependency-plugin/unpack-dependencies-mojo.html
Use version 2.10 or later of maven-dependency-plugin. 使用maven-dependency-plugin的2.10或更高版本。 Versions 2.8 and 2.9 do not process includes,excludes correctly. 版本2.8和2.9不处理包含,正确排除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.