Vamshi
Vamshi

Reputation: 11

How to include empty directories while building using spring maven plugin?

my project has an empty folder 'static' under src/main/resources and while using mvn spring-boot:repackage 'static' folder hasn't copied to 'target' folder, but whenever 'static' folder contains any file like 'src/main/resources/static/images/asb.jpg' then the file and it's parent directories are copied to 'target'. i've gone through spring-boot-maven-plugin docs but didn't found any solution.

I've noticed that maven-build-plugin has a configuration like below, that can copy empty foldes to target. but didn't find any solution for spring-boot-maven-plugin.

  <configuration>
    <includeEmptyDirectories>true</includeEmptyDirectories> 
  </configuration>

Upvotes: 1

Views: 1031

Answers (1)

lainatnavi
lainatnavi

Reputation: 1613

It seems not possible with just spring-boot-maven-plugin. But you can include in your pom.xml the Maven Resources Plugin and use its includeEmptyDirs configuration property:

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

Upvotes: 0

Related Questions