java - Copy empty directory from test resources in Maven -


based on comment trying copy empty directory test resources folder in maven based project test build output no luck. have been using maven-resource-plugin copying basic resources tried add execution part test resources 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 tried define in build section this:

<testresources>     <testresource>         <directory>src/test/resources</directory>     </testresource> </testresources> 

but didn't help.

all files , non-empty directories gets correctly copied single empty directory doesn't.

thanks or advice.

finally solved it!

the problem element <includeemptydirs> in wrong place in plugin section. should part of plugin configuration, not part of execution configuration.

also changed goal of copy-test-resource testresources , outputdirectory ${project.build.testoutputdirectory}

so correct plugin section following:

<plugin>     <artifactid>maven-resources-plugin</artifactid>     <version>2.7</version>     <configuration>         <includeemptydirs>true</includeemptydirs>     </configuration>     <executions>         <execution>             <id>copy-resource</id>             <phase>package</phase>             <goals>                 <goal>copy-resources</goal>             </goals>             <configuration>                 <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>testresources</goal>             </goals>             <configuration>                 <outputdirectory>${project.build.testoutputdirectory}</outputdirectory>                 <resources>                     <resource>                         <directory>src/test/resources</directory>                     </resource>                 </resources>             </configuration>         </execution>     </executions> </plugin> 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -