javamavenmaven-clean-plugin

Maven clean not cleaning all directories


Problem: I want to remove /node and /node_modules on clean, but only /node_modules is removed, why?

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.4.1</version>
            <configuration>
                <filesets>
                    <fileset>
                        <directory>src/main/webapp/form-src/node</directory>
                        <includes>
                            <include>**</include>
                            <followSymlinks>false</followSymlinks>
                        </includes>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.4.1</version>
            <configuration>
                <filesets>
                    <fileset>
                        <directory>src/main/webapp/form-src/node_modules</directory>
                        <includes>
                            <include>**</include>
                            <followSymlinks>false</followSymlinks>
                        </includes>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>

enter image description here


Solution

  • you can merge maven plugin configuration, try this:

    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-clean-plugin</artifactId>
    <version>2.4.1</version>
    <configuration>
        <filesets>
            <fileset>
                <directory>src/main/webapp/form-src/node</directory>
                <includes>
                    <include>**</include>
                </includes>
                <followSymlinks>false</followSymlinks>
            </fileset>
            <fileset>
                <directory>src/main/webapp/form-src/node_modules</directory>
                <includes>
                    <include>**</include>
                </includes>
                <followSymlinks>false</followSymlinks>
            </fileset>
        </filesets>
    </configuration>