Require Files Don't Exist
This rule checks that the specified list of files do not exist.
File names are compared case-sensitively, whatever the filesystem reports. On a case-insensitive filesystem, such as the default one on Windows or macOS, an existing file named pom.xml therefore does not make a check for POM.xml fail, so the rule behaves the same on every platform. A symbolic link is matched by its own name rather than by the name of its target.
The following parameters are supported by this rule:
- message - an optional message to the user if the rule fails.
- files - A list of files to check.
- allowNulls - If null files should be allowed. If allowed, they will be treated as if they do not exist. Default is false.
- satisfyAny - Allows that one of files can make the rule pass, instead of all the files. Default is false.
Sample Plugin Configuration:
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.7.0</version>
<executions>
<execution>
<id>enforce-dont-exist</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireFilesDontExist>
<files>
<file>${project.build.outputDirectory}/foo.txt</file>
<file>${project.build.outputDirectory}/foo2.txt</file>
</files>
</requireFilesDontExist>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
[...]
</project>

