Maven Copy Files and Folders Plugin not copeying l

2019-07-12 12:32发布

问题:

I have a maven code

    <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
            <execution>
                <id>copy-resources-from-parent</id>
                <phase>initialize</phase>
                <goals>
                    <goal>copy-resources</goal>
                </goals>
                <configuration>
                    <outputDirectory>./target/aut-ws</outputDirectory>
                    <resources>
                        <resource>
                            <directory>/prj//workspace-Fm-aut-Testing/</directory>
                        </resource>
                    </resources>
                </configuration>
            </execution>
        </executions>
    </plugin>

This is working fine, but it is not copying .* linux files which are hidden. In normal linux we would use a parameter -a. How to use this here?

Thanks Jeevan

回答1:

To disable this behaviour set addDefaultExcludes to false.

<plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <version>3.1.0</version>
    <configuration>
        <addDefaultExcludes>false</addDefaultExcludes>
    </configuration>
</plugin>

By default files like .gitignore, .cvsignore etc. are excluded which means they will not being copied. If you need them for a particular reason you can do that by settings this to false.

Documentation: https://maven.apache.org/plugins/maven-resources-plugin/copy-resources-mojo.html#addDefaultExcludes