0

I am using mvn clean install command for building a WAR file. I have a bunch if empty directories in my resources folder which I need it to be copied during WAR generation. However Maven by default was ignoring empty directories. So I referred to this answer and used maven resources plugin, but this adds the empty directories only to target/classes location and not in WEB-INF/classes. Can someone please point me what I am doing wrong? This is the pom snippet:

    <build>
    <plugins>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.4</version>
            <configuration>
              <includeEmptyDirectories>true</includeEmptyDirectories> 
            </configuration>
          </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <includeEmptyDirs>true</includeEmptyDirs>
            </configuration>
        </plugin>
    </plugins>
</build>
Krishna Prashatt
  • 631
  • 9
  • 18
  • Why do you need empty directories in the resulting war file? Furthermore why are you using such old versions of the plugins (https://maven.apache.org/plugins/) – khmarbaise Mar 03 '21 at 09:20
  • @khmarbaise Those directories are needed for my project wherein additional files will be created in those folders and as for the plugin version I just took it from the linked answer – Krishna Prashatt Mar 03 '21 at 10:02
  • If you have those directories in the war they can't be written into because they are inside the server and not on the file system... and what kind of supplemental files will be created? And more important: when? – khmarbaise Mar 03 '21 at 10:07
  • @khmarbaise It is one among the many modules we have in our application, so when the request is passed from the front end, our container will copy the entire file set present in resources to a destination and write the files – Krishna Prashatt Mar 03 '21 at 12:12
  • Then your container could just create all the directories it needs. – J Fabian Meier Mar 03 '21 at 16:20

0 Answers0