mercredi 3 juin 2015

Copy empty directory from test resources in Maven

Based on this comment I am trying to copy an empty directory from test resources folder in Maven based project to the test build output but with no luck. I have already been successfully using maven-resource-plugin for copying basic resources so I tried to add another execution part for test resources like this to my pom.xml:

<plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.7</version>
    <executions>
        <execution>
            <id>copy-resource</id>
            <phase>package</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <includeEmptyDirs>true</includeEmptyDirs>
                <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                    </resource>
                </resources>
            </configuration>
        </execution>
        <execution>
            <id>copy-test-resource</id>
            <phase>package</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <includeEmptyDirs>true</includeEmptyDirs>
                <outputDirectory>${project.build.testSourceDirectory}</outputDirectory>
                <resources>
                    <resource>
                        <directory>src/test/resources</directory>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>

I also tried to define it in build section like this:

<testResources>
    <testResource>
        <directory>src/test/resources</directory>
    </testResource>
</testResources>

but it also didn't help.

All files and non-empty directories gets correctly copied but the single empty directory doesn't.

Thanks for any help or advice.

Aucun commentaire:

Enregistrer un commentaire