I'm trying to copy a folder or following structure with maven-resources-plugin:
root
|- .metadata
|- Project
\- .gitignore
Project directory and .gitignore files are copied, but .metadata directory is left out for some reason.
How do I copy all contents of root folder?
Here is configuration I tried:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/aut-ws</outputDirectory>
<useBuildFilters>false</useBuildFilters>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>metadata</nonFilteredFileExtension>
</nonFilteredFileExtensions>
<resources>
<resource>
<directory>H:\rcptt\workspaces\root</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
Just add
addDefaultExcludes
as @Matthew Wise said.Documentation: https://maven.apache.org/plugins/maven-resources-plugin/copy-resources-mojo.html#addDefaultExcludes
You're looking for the configuration parameter
addDefaultExcludes
. See the documentation page.So your configuration section should look like the following:
My first fix attempt would be trying modifying the resources element.
Also, if you comment out the
<nonFilteredFileExtensions>
element, does it work?Edit to show full plugin configuration that works with Maven 3.2.2, Resources plugin 2.7, on both Windows 7 and RedHat Linux. Command for testing is
mvn validate
.If this was relating to the maven-assembly-plugin then I had this problem, and had to use the
useDefaultExcludes
property (recent versions of the plugin only); by default it istrue
and it needs to be set tofalse
to include directories like .metadata. This doesn't seem to be applicable to maven-resources-plugin though, or it might just not be a documented property.