2

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

Antonio Petricca
  • 8,891
  • 5
  • 36
  • 74
Jeevan
  • 447
  • 2
  • 8
  • 19
  • Try this: http://stackoverflow.com/a/25428339/3790806 – hzpz Aug 12 '15 at 10:20
  • I am using Maven 3.3.1, why isn't include tag not working? – Jeevan Aug 12 '15 at 10:36
  • the include option did not work for me, where can I add false ? – Jeevan Aug 12 '15 at 10:44
  • I have found a solution, instead of copying those files, I have zipped it and copied it and from maven I have then unzipped using http://stackoverflow.com/questions/3264064/unpack-zip-in-zip-with-maven – Jeevan Aug 12 '15 at 11:26
  • 1
    Great! If this solved your problem, please create an answer and accept it. – hzpz Aug 13 '15 at 13:33
  • I can't post answers, it says "We are no longer accepting answers from this account. See the Help Center to learn more." - can you help on this, and I shall do it? – Jeevan Aug 14 '15 at 09:43
  • You obviously have a "significant number of heavily down-voted, zero-voted, or deleted posts". Follow the link to the [Help Center](http://stackoverflow.com/help/answer-bans) and fix your posts. – hzpz Aug 14 '15 at 10:02
  • As you can see here: http://stackoverflow.com/users/4432757/jeevan?tab=answers I have not answered any. There are no answers available currently which belongs to me. – Jeevan Aug 14 '15 at 11:05
  • The Help Center is talking about **posts**, not just answers. Your questions count as well. – hzpz Aug 14 '15 at 11:18

2 Answers2

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

MariuszS
  • 30,646
  • 12
  • 114
  • 155
0

In my case ".file" was in target/[unpacked folder] but was missing in final .jar. I achieved this adding maven-antrun-plugin.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.7</version>
    <executions>
        <execution>
            <id>unpack</id>
            <phase>package</phase>
            <configuration>
                <target>
                    <echo message="repackaging" />
                    <jar destfile="${project.build.directory}/${project.build.finalName}.jar" basedir="${project.build.directory}/${project.artifactId}" />
                </target>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>