Require No Repositories

This rule checks that this pom or its parents don't define a repository.

The following parameters are supported by this rule:

  • banRepositories - Whether to ban non-plugin repositories. By default they are banned (true).
  • banPluginRepositories - Whether to ban plugin repositories. By default they are banned (true).
  • allowedRepositories - Specify explicitly allowed non-plugin repositories. This is a list of ids.
  • allowedPluginRepositories - Specify explicitly allowed plugin repositories. This is a list of ids.
  • allowSnapshotRepositories - Whether to allow repositories which only resolve snapshots. By default they are banned (false).
  • allowSnapshotPluginRepositories - Whether to allow plugin repositories which only resolve snapshots. By default they are banned (false).
  • message - an optional message to the user if the rule fails.

Sample Plugin Configuration (showing some defaults, defaults can be skipped):

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.4.1</version>
        <executions>
          <execution>
            <id>enforce-no-repositories</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireNoRepositories>
                  <message>Best Practice is to never define repositories in pom.xml (use a repository manager instead)</message>
                </requireNoRepositories>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  [...]
</project>