maven-dependency-plugin <includes>标记不起作用

时间:2015-07-13 07:40:42

标签: java maven maven-3 maven-dependency-plugin

&lt; includes&gt;下面的maven-dependency-plugin条目中的标记似乎不起作用。

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

上述条目检索到的test-others.tar的内容包含以下内容

common/a.sh  
common/b.sh  
common/common_test.sh

我希望在构建期间将唯一的common / common_test.sh提取到目标目录。但是,所有文件实际都是提取到目标目录。由于光盘上的空间限制,不会提取不需要的文件。

如何才能正确选择要提取的所需文件?

更新:似乎这是版本2.8的错误。它适用于插件的2.10版本。

2 个答案:

答案 0 :(得分:0)

您还必须使用排除,因为如果您将看到包含说明的文档, (component code = return isIncluded(name)AND!isExcluded(name);)

所以也要使用,这样可以正常使用。

您可以使用以下链接作为参考。 https://maven.apache.org/plugins/maven-dependency-plugin/unpack-dependencies-mojo.html

答案 1 :(得分:0)

使用版本2.10或更高版本的maven-dependency-plugin。版本2.8和2.9不处理包含,正确排除。