Require Files Don't Exist

This rule checks that the specified list of files do not exist.

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:

  1. <project>
  2. [...]
  3. <build>
  4. <plugins>
  5. <plugin>
  6. <groupId>org.apache.maven.plugins</groupId>
  7. <artifactId>maven-enforcer-plugin</artifactId>
  8. <version>3.5.0</version>
  9. <executions>
  10. <execution>
  11. <id>enforce-dont-exist</id>
  12. <goals>
  13. <goal>enforce</goal>
  14. </goals>
  15. <configuration>
  16. <rules>
  17. <requireFilesDontExist>
  18. <files>
  19. <file>${project.build.outputDirectory}/foo.txt</file>
  20. <file>${project.build.outputDirectory}/foo2.txt</file>
  21. </files>
  22. </requireFilesDontExist>
  23. </rules>
  24. <fail>true</fail>
  25. </configuration>
  26. </execution>
  27. </executions>
  28. </plugin>
  29. </plugins>
  30. </build>
  31. [...]
  32. </project>