According to this ticket MRESOURCES-36, there should be a <includeEmptyDirs>
element, but only for Maven Resources Plugin 2.3.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.3</version>
<configuration>
<includeEmptyDirs>true</includeEmptyDirs>
</configuration>
</plugin>
For Maven versions which included an older version of the Resources plugin:
Until this issue is fixed, here is a workaround I’ve been using successfully.
Add this plugin element intoproject/build/plugins
in yourpom.xml
, and change the dir in the mkdir task.You can have multiple
<mkdir>
elements for multiple directories. Themkdir
task does nothing if the directory has already been copied by the resources plugin.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>create-empty-directory</id>
<phase>process-classes</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<mkdir dir="${basedir}/target/classes/empty" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
This originally came from the openejb-standalone pom.xml
in the openejb project.