2

This question prompted me to post a follow up question. During a maven build, empty directories are not copied from src/main/webapp, even though I have set the pom.xml to include empty directories:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-resources-plugin</artifactId>
  <version>2.6</version>
  <configuration>
    <includeEmptyDirs>true</includeEmptyDirs>
  </configuration>
</plugin>

How come empty directories are not copied?

Community
  • 1
  • 1
Bizmarck
  • 2,663
  • 2
  • 33
  • 48

2 Answers2

2

I just met the same problem. This worked for me:

<plugin>
  <artifactId>maven-war-plugin</artifactId>
  <version>2.4</version>
  <configuration>
    <includeEmptyDirectories>true</includeEmptyDirectories> <!-- since 2.4 -->
  </configuration>
</plugin>

Your method didn't work because that "src/main/webapp" was not a resource directory.

user2432405
  • 1,406
  • 2
  • 14
  • 29
1

The reason is due to bug MWAR-128 in maven. The solution is to upgrade Maven to r1498124. Alternately, you can include a placeholder file (ex. empty.tmp) and filter it like so:

<plugin>
  <artifactId>maven-war-plugin</artifactId>
  <version>${maven.war.plugin.version}</version>
  <configuration>
    <packagingExcludes>**/empty.tmp</packagingExcludes>
  </configuration>
</plugin>
Bizmarck
  • 2,663
  • 2
  • 33
  • 48