Maven-dependency-plugin <includes> tag not working

The <includes> tag in the maven-dependency-plugin entry below does not work.

            <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 resulting test-others.tar content contains the following elements

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

I expect only the common / common_test.sh to be extracted to the target directory at build time. However, all files are actually extracted to the target directory. Due to disk space limitations, unwanted files are not retrieved.

How do I correctly select only the files I need to extract?

UPDATE: This seems to be a version 2.8 bug. It works in version 2.10 of the plugin.

+3


source to share


2 answers


You should also use an exception, because if you see the documentation that includes (component code = return isIncluded (name) AND! IsExcluded (name);)

So use and well and it will work fine.



You can use the link below for reference. https://maven.apache.org/plugins/maven-dependency-plugin/unpack-dependencies-mojo.html

0


source


Use version 2.10 or later of the maven-dependency-plugin module. Versions 2.8 and 2.9 are not processed, excludes correctness.



0


source







All Articles