Require Files Exist

This rule checks that the specified list of files 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 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.4.1</version>
        <executions>
          <execution>
            <id>enforce-files-exist</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireFilesExist>
                  <files>
                   <file>${project.build.outputDirectory}/foo.txt</file>
                   <file>${project.build.outputDirectory}/foo2.txt</file>
                  </files>
                </requireFilesExist>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  [...]
</project>