3

I am writing pom.xml newly and i am trying to Delete a folder already existing and create a new folder.Is there a way to do this? I am looking something like this:

<executions>
<execution>
    <configuration>
        <tasks>
           <if><!-- I need to check if the folder exists and delete->
            <delete>
                <fileset dir="target/resources"/>
            </delete>
           </if>
            <mkdir dir="target/resources"/>
        </tasks>
    </configuration>
</execution>

user1770589
  • 375
  • 1
  • 6
  • 19

1 Answers1

0

using maven antrun plugin.

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.8</version>
    <executions>
        <execution>
            <phase>initialize</phase>
            <configuration>
                <target>
                    <mkdir dir="${project.build.directory}/target/resources" />
                </target>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Another option would be to use exec-plugin

Lovelin B
  • 60
  • 3