You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2018/01/06 15:51:06 UTC

[maven-enforcer] branch MENFORCER-268-ci-friendly updated (d052c05 -> f0e88b2)

This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a change to branch MENFORCER-268-ci-friendly
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git.


 discard d052c05  Added Invoker test to prove requirePluginVersions is working.
 discard 3dff25a  Added invoker IT's to check ci friendly setup.
 discard d755fbb  Removed integration tests which are already done via UT.
 discard dc9bc35  Another step better.
 discard 81c6210  Added plugin Repository
 discard 77830cc  [MENFORCER-268] Usage of CI friendly version placeholders does not work  o Changed the implementation to use the Maven 3    based reading instead of hand made reading of pom files.
     new f0e88b2  [MENFORCER-268] Usage of CI friendly version placeholders does not work  o Changed the implementation to use the Maven 3    access to the pom files in a Maven project instead    of hand made reading of pom files.  o Added Invoker test to prove requirePluginVersions is working.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (d052c05)
            \
             N -- N -- N   refs/heads/MENFORCER-268-ci-friendly (f0e88b2)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:

-- 
To stop receiving notification emails like this one, please contact
['"commits@maven.apache.org" <co...@maven.apache.org>'].

[maven-enforcer] 01/01: [MENFORCER-268] Usage of CI friendly version placeholders does not work o Changed the implementation to use the Maven 3 access to the pom files in a Maven project instead of hand made reading of pom files. o Added Invoker test to prove requirePluginVersions is working.

Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch MENFORCER-268-ci-friendly
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git

commit f0e88b23f0eaa038462a81f9dfc11a790a3da928
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Mon Jan 1 12:20:19 2018 +0100

    [MENFORCER-268] Usage of CI friendly version placeholders does not work
     o Changed the implementation to use the Maven 3
       access to the pom files in a Maven project instead
       of hand made reading of pom files.
     o Added Invoker test to prove requirePluginVersions is working.
---
 .../plugins/enforcer/RequireNoRepositories.java    |  53 ++-
 .../enforcer/TestRequireNoRepositories.java        | 364 ++++++++++++++-------
 .../no-repositories/child/pom.xml                  |  29 --
 .../requireNoRepositories/no-repositories/pom.xml  |  25 --
 .../snapshot-plugin-repositories/child/pom.xml     |  29 --
 .../snapshot-plugin-repositories/pom.xml           |  37 ---
 .../snapshot-repositories/child/pom.xml            |  29 --
 .../snapshot-repositories/pom.xml                  |  37 ---
 .../with-plugin-repositories/child/pom.xml         |  29 --
 .../with-plugin-repositories/pom.xml               |  31 --
 .../with-repositories/child/pom.xml                |  29 --
 .../with-repositories/pom.xml                      |  31 --
 .../invoker.properties                             |  18 +
 .../pom.xml                                        |  70 ++++
 .../verify.groovy                                  |  22 ++
 .../invoker.properties                             |  18 +
 .../require-no-repositories-allow-repo/pom.xml     |  70 ++++
 .../verify.groovy                                  |  22 ++
 .../it/projects/require-no-repositories/pom.xml    |   1 +
 .../invoker.properties                             |  18 +
 .../pom.xml                                        |  70 ++++
 .../verify.groovy                                  |  22 ++
 .../invoker.properties                             |  18 +
 .../pom.xml                                        | 114 +++----
 .../verify.groovy                                  |  22 ++
 .../invoker.properties                             |  18 +
 .../pom.xml                                        |  70 ++++
 .../verify.groovy                                  |  22 ++
 .../child}/pom.xml                                 |  34 +-
 .../pom.xml                                        |   5 +
 .../child}/pom.xml                                 |  34 +-
 .../invoker.properties                             |  18 +
 .../pom.xml                                        |  10 +-
 .../child}/pom.xml                                 |  34 +-
 .../require-plugin-versions-ci/invoker.properties  |  19 ++
 .../pom.xml                                        |  14 +-
 .../require-plugin-versions-ci/verify.groovy       |  21 ++
 37 files changed, 916 insertions(+), 591 deletions(-)

diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireNoRepositories.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireNoRepositories.java
index cc5073d..6419b73 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireNoRepositories.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireNoRepositories.java
@@ -19,23 +19,19 @@ package org.apache.maven.plugins.enforcer;
  * under the License.
  */
 
-import java.io.File;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
 import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Repository;
-import org.apache.maven.plugins.enforcer.utils.EnforcerRuleUtils;
+import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
 import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 /**
  * This rule checks that this pom or its parents don't define a repository.
@@ -45,6 +41,8 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 public class RequireNoRepositories
     extends AbstractNonCacheableEnforcerRule
 {
+    private static final String VERSION = " version:";
+
     /**
      * Whether to ban non-plugin repositories. By default they are banned.
      * 
@@ -117,23 +115,32 @@ public class RequireNoRepositories
         this.allowSnapshotPluginRepositories = allowSnapshotPluginRepositories;
     }
     
+    private Log logger;
+
     @Override
     public void execute( EnforcerRuleHelper helper )
         throws EnforcerRuleException
     {
-        EnforcerRuleUtils utils = new EnforcerRuleUtils( helper );
+        logger = helper.getLog();
 
-        MavenProject project;
+        MavenSession session;
         try
         {
-            project = (MavenProject) helper.evaluate( "${project}" );
+            session = (MavenSession) helper.evaluate( "${session}" );
+
+            List<MavenProject> sortedProjects = session.getProjectDependencyGraph().getSortedProjects();
 
-            List<Model> models =
-                utils.getModelsRecursively( project.getGroupId(), project.getArtifactId(), project.getVersion(),
-                                            new File( project.getBasedir(), "pom.xml" ) );
+            List<Model> models = new ArrayList<Model>();
+            for ( MavenProject mavenProject : sortedProjects )
+            {
+                logger.debug( "Scanning project: " + mavenProject.getGroupId() + ":" + mavenProject.getArtifactId()
+                    + VERSION + mavenProject.getVersion() );
+                models.add( mavenProject.getOriginalModel() );
+            }
+            
             List<Model> badModels = new ArrayList<Model>();
 
-            StringBuffer newMsg = new StringBuffer();
+            StringBuilder newMsg = new StringBuilder();
             newMsg.append( "Some poms have repositories defined:\n" );
 
             for ( Model model : models )
@@ -149,7 +156,7 @@ public class RequireNoRepositories
                         {
                             badModels.add( model );
                             newMsg.append(
-                                model.getGroupId() + ":" + model.getArtifactId() + " version:" + model.getVersion()
+                                model.getGroupId() + ":" + model.getArtifactId() + VERSION + model.getVersion()
                                     + " has repositories " + bannedRepos );
                         }
                     }
@@ -165,7 +172,7 @@ public class RequireNoRepositories
                         {
                             badModels.add( model );
                             newMsg.append(
-                                model.getGroupId() + ":" + model.getArtifactId() + " version:" + model.getVersion()
+                                model.getGroupId() + ":" + model.getArtifactId() + VERSION + model.getVersion()
                                     + " has plugin repositories " + bannedRepos );
                         }
                     }
@@ -190,22 +197,6 @@ public class RequireNoRepositories
         {
             throw new EnforcerRuleException( e.getLocalizedMessage() );
         }
-        catch ( ArtifactResolutionException e )
-        {
-            throw new EnforcerRuleException( e.getLocalizedMessage() );
-        }
-        catch ( ArtifactNotFoundException e )
-        {
-            throw new EnforcerRuleException( e.getLocalizedMessage() );
-        }
-        catch ( IOException e )
-        {
-            throw new EnforcerRuleException( e.getLocalizedMessage() );
-        }
-        catch ( XmlPullParserException e )
-        {
-            throw new EnforcerRuleException( e.getLocalizedMessage() );
-        }
     }
 
     /**
diff --git a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireNoRepositories.java b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireNoRepositories.java
index 9b6ac8b..0da2d64 100644
--- a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireNoRepositories.java
+++ b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireNoRepositories.java
@@ -1,5 +1,10 @@
 package org.apache.maven.plugins.enforcer;
 
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -20,236 +25,373 @@ package org.apache.maven.plugins.enforcer;
  */
 
 import java.util.Collections;
+import java.util.List;
 
 import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
 import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.ProjectDependencyGraph;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Repository;
+import org.apache.maven.model.RepositoryPolicy;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Test the "require no repositories" rule.
  * 
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @author <a href="mailto:khmarbaise@apache.org">Karl Heinz Marbaise</a>
  */
 public class TestRequireNoRepositories
-    extends PlexusTestCase
 {
     private EnforcerRuleHelper helper;
 
     private RequireNoRepositories rule;
 
-    private MockProject project;
+    private MavenSession session;
 
-    public void setUp()
-        throws Exception
+    @Before
+    public void before()
+        throws ExpressionEvaluationException
     {
-        super.setUp();
+        session = mock( MavenSession.class );
+        helper = mock( EnforcerRuleHelper.class );
+
+        when( helper.evaluate( "${session}" ) ).thenReturn( session );
+
+        Log log = mock( Log.class );
+        when( helper.getLog() ).thenReturn( log );
 
         rule = new RequireNoRepositories();
         rule.setMessage( "my message" );
+    }
+
+    private MavenProject createMavenProject()
+    {
+        MavenProject mp = mock( MavenProject.class );
+        when( mp.getGroupId() ).thenReturn( "org.apache.maven.plugins.enforcer.test" );
+        when( mp.getArtifactId() ).thenReturn( "no-repositories-child" );
+        when( mp.getVersion() ).thenReturn( "1.0-SNAPSHOT" );
+
+        return mp;
+    }
+
+    private Model createOriginalModel()
+    {
+        Model m = mock( Model.class );
+        when( m.getGroupId() ).thenReturn( "org.apache.maven.plugins.enforcer.test" );
+        when( m.getArtifactId() ).thenReturn( "no-repositories" );
+        when( m.getVersion() ).thenReturn( "1.0-SNAPSHOT" );
+        return m;
+    }
+
+    private MavenProject createStandAloneProject()
+    {
+        MavenProject mp = createMavenProject();
+        Model originalModel = createOriginalModel();
+        // This means the interpolated model is the same
+        // as the non interpolated.
+        when( mp.getModel() ).thenReturn( originalModel );
+        when( mp.getOriginalModel() ).thenReturn( originalModel );
+        return mp;
+    }
 
-        project = new MockProject();
-        project.setGroupId( "org.apache.maven.plugins.enforcer.test" );
-        project.setVersion( "1.0-SNAPSHOT" );
+    private void setupSortedProjects( List<MavenProject> projectList )
+    {
+        ProjectDependencyGraph pdg = mock( ProjectDependencyGraph.class );
+        when( session.getProjectDependencyGraph() ).thenReturn( pdg );
+        when( pdg.getSortedProjects() ).thenReturn( projectList );
+    }
 
-        helper = EnforcerTestUtils.getHelper( project );
+    private Repository createRepository( String id, String url )
+    {
+        Repository r = new Repository();
+        r.setId( id );
+        r.setUrl( url );
+        RepositoryPolicy snapshotPolicy = new RepositoryPolicy();
+        snapshotPolicy.setEnabled( false );
+        snapshotPolicy.setUpdatePolicy( "daily" );
+        r.setSnapshots( snapshotPolicy );
+
+        RepositoryPolicy releasePolicy = new RepositoryPolicy();
+        releasePolicy.setEnabled( true );
+        releasePolicy.setUpdatePolicy( "never" );
+        r.setReleases( releasePolicy );
+
+        return r;
     }
 
+    private Repository createSnapshotRepository( String id, String url )
+    {
+        Repository r = new Repository();
+        r.setId( id );
+        r.setUrl( url );
+
+        RepositoryPolicy snapshotPolicy = new RepositoryPolicy();
+        snapshotPolicy.setEnabled( true );
+        snapshotPolicy.setUpdatePolicy( "daily" );
+        r.setSnapshots( snapshotPolicy );
+
+        RepositoryPolicy releasePolicy = new RepositoryPolicy();
+        releasePolicy.setEnabled( false );
+        r.setReleases( releasePolicy );
+
+        return r;
+    }
+
+    private MavenProject addRepository( MavenProject project, Repository r )
+    {
+        Model originalModel = project.getOriginalModel();
+        List<Repository> repositories = new ArrayList<Repository>();
+        repositories.add( r );
+        when( originalModel.getRepositories() ).thenReturn( repositories );
+        return project;
+    }
+
+    private MavenProject addEmptyRepository( MavenProject project )
+    {
+        Model originalModel = project.getOriginalModel();
+        List<Repository> repositories = new ArrayList<Repository>();
+        when( originalModel.getRepositories() ).thenReturn( repositories );
+        return project;
+    }
+
+    private MavenProject addPluginRepository( MavenProject project, Repository r )
+    {
+        Model originalModel = project.getOriginalModel();
+        List<Repository> repositories = new ArrayList<Repository>();
+        repositories.add( r );
+        when( originalModel.getPluginRepositories() ).thenReturn( repositories );
+        return project;
+    }
+
+    private MavenProject addEmptyPluginRepository( MavenProject project )
+    {
+        Model originalModel = project.getOriginalModel();
+        List<Repository> repositories = new ArrayList<Repository>();
+        when( originalModel.getPluginRepositories() ).thenReturn( repositories );
+        return project;
+    }
+
+    /**
+     * This model contains a single module maven project without any repository.
+     */
+    @Test
     public void testAllBannedNoRepositories()
         throws EnforcerRuleException
     {
-        project.setArtifactId( "no-repositories-child" );
-        project.setBaseDir( getTestFile( "target/test-classes/requireNoRepositories/no-repositories/child" ) );
+        MavenProject baseProject = createStandAloneProject();
+        setupSortedProjects( Collections.singletonList( baseProject ) );
 
         rule.execute( helper );
     }
 
-    public void testAllBannedWithRepositories()
+    /**
+     * The model contains a single repository which is is not allowed by the default rules.
+     */
+    @Test( expected = EnforcerRuleException.class )
+    public void testAllBannedWithRepository()
         throws EnforcerRuleException
     {
-        project.setArtifactId( "with-repositories-child" );
-        project.setBaseDir( getTestFile( "target/test-classes/requireNoRepositories/with-repositories/child" ) );
+        MavenProject baseProject = createStandAloneProject();
+        addRepository( baseProject, createRepository( "repo", "http://example.com/repo" ) );
+        setupSortedProjects( Collections.singletonList( baseProject ) );
 
-        try
-        {
-            rule.execute( helper );
-            fail( "Should have exception" );
-        }
-        catch ( EnforcerRuleException e )
-        {
-            assertTrue( true );
-        }
+        rule.execute( helper );
     }
 
-    public void testAllBannedWithAllowedRepositories()
+    /**
+     * The model contains a single plugin repository which is is not allowed by the default rules.
+     */
+    @Test( expected = EnforcerRuleException.class )
+    public void testAllBannedWithPluginRepository()
         throws EnforcerRuleException
     {
-        rule.setAllowedRepositories( Collections.singletonList( "repo" ) );
-
-        project.setArtifactId( "with-repositories-child" );
-        project.setBaseDir( getTestFile( "target/test-classes/requireNoRepositories/with-repositories/child" ) );
+        MavenProject baseProject = createStandAloneProject();
+        addPluginRepository( baseProject, createRepository( "repo", "http://example.com/repo" ) );
+        setupSortedProjects( Collections.singletonList( baseProject ) );
 
         rule.execute( helper );
     }
 
-    public void testAllBannedWithAllowedPluginRepositories()
+    /**
+     * The model contains a single repository which is allowed by setting allowedRepositories to the id.
+     */
+    @Test
+    public void testAllBannedWithAllowedRepositories()
         throws EnforcerRuleException
     {
-        rule.setAllowedPluginRepositories( Collections.singletonList( "repo" ) );
+        final String repositoryId = "repo";
+        rule.setAllowedRepositories( Collections.singletonList( repositoryId ) );
 
-        project.setArtifactId( "with-plugin-repositories-child" );
-        project.setBaseDir( getTestFile( "target/test-classes/requireNoRepositories/with-plugin-repositories/child" ) );
+        MavenProject baseProject = createStandAloneProject();
+        addRepository( baseProject, createRepository( repositoryId, "http://example.com/repo" ) );
+        setupSortedProjects( Collections.singletonList( baseProject ) );
 
         rule.execute( helper );
     }
 
-    public void testReposNotBannedNoRepositories()
+    /**
+     * The model contains a single repository. Turned off ban repositories.
+     */
+    @Test
+    public void testRepositoriesNotBannedWithSingleRepository()
         throws EnforcerRuleException
     {
+        final String repositoryId = "repo";
+
         rule.setBanRepositories( false );
 
-        project.setArtifactId( "no-repositories-child" );
-        project.setBaseDir( getTestFile( "target/test-classes/requireNoRepositories/no-repositories/child" ) );
+        MavenProject baseProject = createStandAloneProject();
+        addRepository( baseProject, createRepository( repositoryId, "http://example.com/repo" ) );
+        setupSortedProjects( Collections.singletonList( baseProject ) );
 
         rule.execute( helper );
     }
 
-    public void testReposNotBannedWithRepositories()
+    /**
+     * The model contains no repository at all. Turned off ban repositories.
+     */
+    @Test
+    public void testRepositoriesNotBannedWithOutAnyRepository()
         throws EnforcerRuleException
     {
         rule.setBanRepositories( false );
 
-        project.setArtifactId( "with-repositories-child" );
-        project.setBaseDir( getTestFile( "target/test-classes/requireNoRepositories/with-repositories/child" ) );
+        MavenProject baseProject = createStandAloneProject();
+        setupSortedProjects( Collections.singletonList( baseProject ) );
 
         rule.execute( helper );
     }
 
-    public void testReposNotBannedWithPluginRepositories()
+    /**
+     * This model contains a single plugin repository. The given plugin repository is added to the list of allowed
+     * plugin repositories.
+     */
+    @Test
+    public void testAllBannedWithAllowedPluginRepositories()
         throws EnforcerRuleException
     {
-        rule.setBanRepositories( false );
+        final String repositoryId = "repo";
+        rule.setAllowedPluginRepositories( Collections.singletonList( repositoryId ) );
 
-        project.setArtifactId( "with-plugin-repositories-child" );
-        project.setBaseDir( getTestFile( "target/test-classes/requireNoRepositories/with-plugin-repositories/child" ) );
+        MavenProject baseProject = createStandAloneProject();
+        addPluginRepository( baseProject, createRepository( repositoryId, "http://example.com/repo" ) );
+        setupSortedProjects( Collections.singletonList( baseProject ) );
 
-        try
-        {
-            rule.execute( helper );
-            fail( "Should have exception" );
-        }
-        catch ( EnforcerRuleException e )
-        {
-            assertTrue( true );
-        }
+        rule.execute( helper );
     }
 
-    public void testPluginReposNotBannedNoRepositories()
+    /**
+     * The model contains a single plugin repository. Turned off ban plugin repositories.
+     */
+    @Test
+    public void testPluginRepositoriesNotBannedWithSinglePluginRepository()
         throws EnforcerRuleException
     {
+        final String repositoryId = "repo";
+
         rule.setBanPluginRepositories( false );
 
-        project.setArtifactId( "no-repositories-child" );
-        project.setBaseDir( getTestFile( "target/test-classes/requireNoRepositories/no-repositories/child" ) );
+        MavenProject baseProject = createStandAloneProject();
+        addPluginRepository( baseProject, createRepository( repositoryId, "http://example.com/repo" ) );
+        setupSortedProjects( Collections.singletonList( baseProject ) );
 
         rule.execute( helper );
     }
 
-    public void testPluginReposNotBannedWithRepositories()
+    /**
+     * The model contains no repository at all. Turned off ban plugin repositories.
+     */
+    @Test
+    public void testPluginRepositoriesNotBannedWithOutAnyRepository()
         throws EnforcerRuleException
     {
         rule.setBanPluginRepositories( false );
 
-        project.setArtifactId( "with-repositories-child" );
-        project.setBaseDir( getTestFile( "target/test-classes/requireNoRepositories/with-repositories/child" ) );
+        MavenProject baseProject = createStandAloneProject();
+        setupSortedProjects( Collections.singletonList( baseProject ) );
 
-        try
-        {
-            rule.execute( helper );
-            fail( "Should have exception" );
-        }
-        catch ( EnforcerRuleException e )
-        {
-            assertTrue( true );
-        }
+        rule.execute( helper );
     }
 
-    public void testPluginReposNotBannedWithPluginRepositories()
+    @Test( expected = EnforcerRuleException.class )
+    public void testAllBannedWithSnapshotRepository()
         throws EnforcerRuleException
     {
-        rule.setBanPluginRepositories( false );
-
-        project.setArtifactId( "with-plugin-repositories-child" );
-        project.setBaseDir( getTestFile( "target/test-classes/requireNoRepositories/with-plugin-repositories/child" ) );
+        MavenProject baseProject = createStandAloneProject();
+        addRepository( baseProject, createSnapshotRepository( "repo", "http://example.com/repo" ) );
+        setupSortedProjects( Collections.singletonList( baseProject ) );
 
         rule.execute( helper );
     }
 
-    public void testReposNotAllowedWithSnapshotRepositories()
+    @Test
+    public void testAllBannedWithSnapshotRepositoryAllowedRepositories()
         throws EnforcerRuleException
     {
-        rule.setAllowSnapshotRepositories( true );
+        final String repositoryId = "repo";
+        rule.setAllowedRepositories( Collections.singletonList( repositoryId ) );
 
-        project.setArtifactId( "snapshot-plugin-repositories-child" );
-        project.setBaseDir( getTestFile( "target/test-classes/requireNoRepositories/snapshot-plugin-repositories/child" ) );
+        MavenProject baseProject = createStandAloneProject();
+        addRepository( baseProject, createSnapshotRepository( repositoryId, "http://example.com/repo" ) );
+        setupSortedProjects( Collections.singletonList( baseProject ) );
 
-        try
-        {
-            rule.execute( helper );
-            fail( "Should have exception" );
-        }
-        catch ( EnforcerRuleException e )
-        {
-            assertTrue( true );
-        }
+        rule.execute( helper );
     }
 
-    public void testReposAllowedWithSnapshotRepositories()
+    @Test
+    public void testAllBannedWithSnapshotRepositoryAndSetAllowSnapshotRepositories()
         throws EnforcerRuleException
     {
+        final String repositoryId = "repo";
         rule.setAllowSnapshotRepositories( true );
 
-        project.setArtifactId( "snapshot-repositories-child" );
-        project.setBaseDir( getTestFile( "target/test-classes/requireNoRepositories/snapshot-repositories/child" ) );
+        MavenProject baseProject = createStandAloneProject();
+        addRepository( baseProject, createSnapshotRepository( repositoryId, "http://example.com/repo" ) );
+        setupSortedProjects( Collections.singletonList( baseProject ) );
 
         rule.execute( helper );
     }
 
-    public void testPluginReposNotAllowedWithSnapshotRepositories()
+    @Test
+    public void testAllBannedWithSnapshotPluginRepositoryAndSetAllowSnapshotPluginRepositories()
         throws EnforcerRuleException
     {
+        final String repositoryId = "repo";
         rule.setAllowSnapshotPluginRepositories( true );
 
-        project.setArtifactId( "snapshot-repositories-child" );
-        project.setBaseDir( getTestFile( "target/test-classes/requireNoRepositories/snapshot-repositories/child" ) );
+        MavenProject baseProject = createStandAloneProject();
+        addPluginRepository( baseProject, createSnapshotRepository( repositoryId, "http://example.com/repo" ) );
+        setupSortedProjects( Collections.singletonList( baseProject ) );
 
-        try
-        {
-            rule.execute( helper );
-            fail( "Should have exception" );
-        }
-        catch ( EnforcerRuleException e )
-        {
-            assertTrue( true );
-        }
+        rule.execute( helper );
     }
 
-    public void testPluginReposAllowedWithSnapshotPluginRepositories()
+    @Test
+    public void testAllBannedWithEmptyRepository()
         throws EnforcerRuleException
     {
-        rule.setAllowSnapshotPluginRepositories( true );
-
-        project.setArtifactId( "snapshot-plugin-repositories-child" );
-        project.setBaseDir( getTestFile( "target/test-classes/requireNoRepositories/snapshot-plugin-repositories/child" ) );
+        MavenProject baseProject = createStandAloneProject();
+        addEmptyRepository( baseProject );
+        setupSortedProjects( Collections.singletonList( baseProject ) );
 
         rule.execute( helper );
     }
 
-    /**
-     * Test id.
-     */
-    public void testId()
+    @Test
+    public void testAllBannedWithEmptyPluginRepository()
+        throws EnforcerRuleException
     {
-        RequireNoRepositories rule = new RequireNoRepositories();
-        rule.getCacheId();
+        MavenProject baseProject = createStandAloneProject();
+        addEmptyPluginRepository( baseProject );
+        setupSortedProjects( Collections.singletonList( baseProject ) );
+
+        rule.execute( helper );
     }
+
 }
diff --git a/enforcer-rules/src/test/resources/requireNoRepositories/no-repositories/child/pom.xml b/enforcer-rules/src/test/resources/requireNoRepositories/no-repositories/child/pom.xml
deleted file mode 100644
index c7f5303..0000000
--- a/enforcer-rules/src/test/resources/requireNoRepositories/no-repositories/child/pom.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing,
-  * software distributed under the License is distributed on an
-  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  * KIND, either express or implied.  See the License for the
-  * specific language governing permissions and limitations
-  * under the License. 
-  *
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <parent>
-    <groupId>org.apache.maven.plugins.enforcer.test
-    </groupId>
-    <artifactId>no-repositories</artifactId>
-    <version>1.0-SNAPSHOT</version>
-  </parent>
-  <artifactId>no-repositories-child</artifactId>
-</project>
\ No newline at end of file
diff --git a/enforcer-rules/src/test/resources/requireNoRepositories/no-repositories/pom.xml b/enforcer-rules/src/test/resources/requireNoRepositories/no-repositories/pom.xml
deleted file mode 100644
index d56435e..0000000
--- a/enforcer-rules/src/test/resources/requireNoRepositories/no-repositories/pom.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing,
-  * software distributed under the License is distributed on an
-  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  * KIND, either express or implied.  See the License for the
-  * specific language governing permissions and limitations
-  * under the License. 
-  *
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <groupId>org.apache.maven.plugins.enforcer.test</groupId>
-  <artifactId>no-repositories</artifactId>
-  <version>1.0-SNAPSHOT</version>
-</project>
\ No newline at end of file
diff --git a/enforcer-rules/src/test/resources/requireNoRepositories/snapshot-plugin-repositories/child/pom.xml b/enforcer-rules/src/test/resources/requireNoRepositories/snapshot-plugin-repositories/child/pom.xml
deleted file mode 100644
index 3737768..0000000
--- a/enforcer-rules/src/test/resources/requireNoRepositories/snapshot-plugin-repositories/child/pom.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing,
-  * software distributed under the License is distributed on an
-  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  * KIND, either express or implied.  See the License for the
-  * specific language governing permissions and limitations
-  * under the License. 
-  *
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <parent>
-    <groupId>org.apache.maven.plugins.enforcer.test
-    </groupId>
-    <artifactId>snapshot-plugin-repositories</artifactId>
-    <version>1.0-SNAPSHOT</version>
-  </parent>
-  <artifactId>snapshot-plugin-repositories-child</artifactId>
-</project>
\ No newline at end of file
diff --git a/enforcer-rules/src/test/resources/requireNoRepositories/snapshot-plugin-repositories/pom.xml b/enforcer-rules/src/test/resources/requireNoRepositories/snapshot-plugin-repositories/pom.xml
deleted file mode 100644
index 8cf8efb..0000000
--- a/enforcer-rules/src/test/resources/requireNoRepositories/snapshot-plugin-repositories/pom.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing,
-  * software distributed under the License is distributed on an
-  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  * KIND, either express or implied.  See the License for the
-  * specific language governing permissions and limitations
-  * under the License. 
-  *
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <groupId>org.apache.maven.plugins.enforcer.test</groupId>
-  <artifactId>snapshot-plugin-repositories</artifactId>
-  <version>1.0-SNAPSHOT</version>
-  <pluginRepositories>
-    <pluginRepository>
-      <id>repo</id>
-      <url>http://example.com/repo</url>
-      <releases>
-        <enabled>false</enabled>
-      </releases>
-      <snapshots>
-        <enabled>true</enabled>
-      </snapshots>
-    </pluginRepository>
-  </pluginRepositories>
-</project>
\ No newline at end of file
diff --git a/enforcer-rules/src/test/resources/requireNoRepositories/snapshot-repositories/child/pom.xml b/enforcer-rules/src/test/resources/requireNoRepositories/snapshot-repositories/child/pom.xml
deleted file mode 100644
index 45bc16f..0000000
--- a/enforcer-rules/src/test/resources/requireNoRepositories/snapshot-repositories/child/pom.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing,
-  * software distributed under the License is distributed on an
-  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  * KIND, either express or implied.  See the License for the
-  * specific language governing permissions and limitations
-  * under the License. 
-  *
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <parent>
-    <groupId>org.apache.maven.plugins.enforcer.test
-    </groupId>
-    <artifactId>snapshot-repositories</artifactId>
-    <version>1.0-SNAPSHOT</version>
-  </parent>
-  <artifactId>snapshot-repositories-child</artifactId>
-</project>
\ No newline at end of file
diff --git a/enforcer-rules/src/test/resources/requireNoRepositories/snapshot-repositories/pom.xml b/enforcer-rules/src/test/resources/requireNoRepositories/snapshot-repositories/pom.xml
deleted file mode 100644
index 32872f5..0000000
--- a/enforcer-rules/src/test/resources/requireNoRepositories/snapshot-repositories/pom.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing,
-  * software distributed under the License is distributed on an
-  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  * KIND, either express or implied.  See the License for the
-  * specific language governing permissions and limitations
-  * under the License. 
-  *
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <groupId>org.apache.maven.plugins.enforcer.test</groupId>
-  <artifactId>snapshot-repositories</artifactId>
-  <version>1.0-SNAPSHOT</version>
-  <repositories>
-    <repository>
-      <id>repo</id>
-      <url>http://example.com/repo</url>
-      <releases>
-        <enabled>false</enabled>
-      </releases>
-      <snapshots>
-        <enabled>true</enabled>
-      </snapshots>
-    </repository>
-  </repositories>
-</project>
\ No newline at end of file
diff --git a/enforcer-rules/src/test/resources/requireNoRepositories/with-plugin-repositories/child/pom.xml b/enforcer-rules/src/test/resources/requireNoRepositories/with-plugin-repositories/child/pom.xml
deleted file mode 100644
index 73e4e04..0000000
--- a/enforcer-rules/src/test/resources/requireNoRepositories/with-plugin-repositories/child/pom.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing,
-  * software distributed under the License is distributed on an
-  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  * KIND, either express or implied.  See the License for the
-  * specific language governing permissions and limitations
-  * under the License. 
-  *
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <parent>
-    <groupId>org.apache.maven.plugins.enforcer.test
-    </groupId>
-    <artifactId>with-plugin-repositories</artifactId>
-    <version>1.0-SNAPSHOT</version>
-  </parent>
-  <artifactId>with-plugin-repositories-child</artifactId>
-</project>
\ No newline at end of file
diff --git a/enforcer-rules/src/test/resources/requireNoRepositories/with-plugin-repositories/pom.xml b/enforcer-rules/src/test/resources/requireNoRepositories/with-plugin-repositories/pom.xml
deleted file mode 100644
index 771f86b..0000000
--- a/enforcer-rules/src/test/resources/requireNoRepositories/with-plugin-repositories/pom.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing,
-  * software distributed under the License is distributed on an
-  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  * KIND, either express or implied.  See the License for the
-  * specific language governing permissions and limitations
-  * under the License. 
-  *
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <groupId>org.apache.maven.plugins.enforcer.test</groupId>
-  <artifactId>with-plugin-repositories</artifactId>
-  <version>1.0-SNAPSHOT</version>
-  <pluginRepositories>
-    <pluginRepository>
-      <id>repo</id>
-      <url>http://example.com/repo</url>
-    </pluginRepository>
-  </pluginRepositories>
-</project>
\ No newline at end of file
diff --git a/enforcer-rules/src/test/resources/requireNoRepositories/with-repositories/child/pom.xml b/enforcer-rules/src/test/resources/requireNoRepositories/with-repositories/child/pom.xml
deleted file mode 100644
index e388c48..0000000
--- a/enforcer-rules/src/test/resources/requireNoRepositories/with-repositories/child/pom.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing,
-  * software distributed under the License is distributed on an
-  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  * KIND, either express or implied.  See the License for the
-  * specific language governing permissions and limitations
-  * under the License. 
-  *
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <parent>
-    <groupId>org.apache.maven.plugins.enforcer.test
-    </groupId>
-    <artifactId>with-repositories</artifactId>
-    <version>1.0-SNAPSHOT</version>
-  </parent>
-  <artifactId>with-repositories-child</artifactId>
-</project>
\ No newline at end of file
diff --git a/enforcer-rules/src/test/resources/requireNoRepositories/with-repositories/pom.xml b/enforcer-rules/src/test/resources/requireNoRepositories/with-repositories/pom.xml
deleted file mode 100644
index 32f94f0..0000000
--- a/enforcer-rules/src/test/resources/requireNoRepositories/with-repositories/pom.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing,
-  * software distributed under the License is distributed on an
-  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  * KIND, either express or implied.  See the License for the
-  * specific language governing permissions and limitations
-  * under the License. 
-  *
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <groupId>org.apache.maven.plugins.enforcer.test</groupId>
-  <artifactId>with-repositories</artifactId>
-  <version>1.0-SNAPSHOT</version>
-  <repositories>
-    <repository>
-      <id>repo</id>
-      <url>http://example.com/repo</url>
-    </repository>
-  </repositories>
-</project>
\ No newline at end of file
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-plugin-repo/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-plugin-repo/invoker.properties
new file mode 100644
index 0000000..c98ac4c
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-plugin-repo/invoker.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.buildResult=failure
\ No newline at end of file
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-plugin-repo/pom.xml b/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-plugin-repo/pom.xml
new file mode 100644
index 0000000..ba8a6a7
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-plugin-repo/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.enforcer</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+
+  <description>This IT makes sure to prevent having pluginRepositories inside the pom.</description>
+
+  <pluginRepositories>
+    <pluginRepository>
+      <id>plugin-repo</id>
+      <url>http://example.com/repo</url>
+    </pluginRepository>
+  </pluginRepositories>
+  <repositories>
+    <repository>
+      <id>com.asual.maven.public</id>
+      <name>Asual Public Repository</name>
+      <url>http://localhost</url>
+    </repository>
+  </repositories>
+
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireNoRepositories>
+                  <allowedPluginRepositories>plugin-repo</allowedPluginRepositories>
+                </requireNoRepositories>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-plugin-repo/verify.groovy b/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-plugin-repo/verify.groovy
new file mode 100644
index 0000000..c065765
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-plugin-repo/verify.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.text.contains( '[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireNoRepositories failed with message:' )
+assert buildLog.text.contains( 'Some poms have repositories defined:' )
+assert buildLog.text.contains( 'org.apache.maven.its.enforcer:test version:1.0 has repositories [com.asual.maven.public]' )
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-repo/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-repo/invoker.properties
new file mode 100644
index 0000000..c98ac4c
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-repo/invoker.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.buildResult=failure
\ No newline at end of file
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-repo/pom.xml b/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-repo/pom.xml
new file mode 100644
index 0000000..c0af0cc
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-repo/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.enforcer</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+
+  <description>This IT makes sure to prevent having pluginRepositories inside the pom.</description>
+
+  <pluginRepositories>
+    <pluginRepository>
+      <id>plugin-repo</id>
+      <url>http://example.com/repo</url>
+    </pluginRepository>
+  </pluginRepositories>
+  <repositories>
+    <repository>
+      <id>com.asual.maven.public</id>
+      <name>Asual Public Repository</name>
+      <url>http://localhost</url>
+    </repository>
+  </repositories>
+
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireNoRepositories>
+                  <allowedRepositories>com.asual.maven.public</allowedRepositories>
+                </requireNoRepositories>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-repo/verify.groovy b/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-repo/verify.groovy
new file mode 100644
index 0000000..b9538f3
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories-allow-repo/verify.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.text.contains( '[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireNoRepositories failed with message:' )
+assert buildLog.text.contains( 'Some poms have repositories defined:' )
+assert buildLog.text.contains( 'org.apache.maven.its.enforcer:test version:1.0 has plugin repositories [plugin-repo]' )
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml b/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
index c66de18..bf5d7f9 100644
--- a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
@@ -27,6 +27,7 @@ under the License.
   <version>1.0</version>
 
   <description>
+    This IT demonstrates having no repositories defined at all.
   </description>
 
   <build>
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_allowed-plugin-repo/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_allowed-plugin-repo/invoker.properties
new file mode 100644
index 0000000..c98ac4c
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_allowed-plugin-repo/invoker.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.buildResult=failure
\ No newline at end of file
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_allowed-plugin-repo/pom.xml b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_allowed-plugin-repo/pom.xml
new file mode 100644
index 0000000..4951265
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_allowed-plugin-repo/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.enforcer</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+
+  <description>This IT makes sure to prevent having defined pluginRepository and repository in allowedPluginRepositories</description>
+
+  <pluginRepositories>
+    <pluginRepository>
+      <id>plugin-repo</id>
+      <url>http://example.com/repo</url>
+    </pluginRepository>
+  </pluginRepositories>
+  <repositories>
+    <repository>
+      <id>com.asual.maven.public</id>
+      <name>Asual Public Repository</name>
+      <url>http://localhost</url>
+    </repository>
+  </repositories>
+
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireNoRepositories>
+                  <allowedPluginRepositories>plugin-repo,com.asual.maven.public</allowedPluginRepositories>
+                </requireNoRepositories>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_allowed-plugin-repo/verify.groovy b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_allowed-plugin-repo/verify.groovy
new file mode 100644
index 0000000..c065765
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_allowed-plugin-repo/verify.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.text.contains( '[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireNoRepositories failed with message:' )
+assert buildLog.text.contains( 'Some poms have repositories defined:' )
+assert buildLog.text.contains( 'org.apache.maven.its.enforcer:test version:1.0 has repositories [com.asual.maven.public]' )
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_plugin-repositories/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_plugin-repositories/invoker.properties
new file mode 100644
index 0000000..c98ac4c
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_plugin-repositories/invoker.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.buildResult=failure
\ No newline at end of file
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_plugin-repositories/pom.xml
similarity index 88%
copy from maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
copy to maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_plugin-repositories/pom.xml
index c66de18..0ceb88b 100644
--- a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_plugin-repositories/pom.xml
@@ -1,55 +1,59 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<project>
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>org.apache.maven.its.enforcer</groupId>
-  <artifactId>test</artifactId>
-  <version>1.0</version>
-
-  <description>
-  </description>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-enforcer-plugin</artifactId>
-        <version>@project.version@</version>
-        <executions>
-          <execution>
-            <id>test</id>
-            <goals>
-              <goal>enforce</goal>
-            </goals>
-            <configuration>
-              <rules>
-                <requireNoRepositories>
-                </requireNoRepositories>
-              </rules>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.enforcer</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+
+  <pluginRepositories>
+    <pluginRepository>
+      <id>repo</id>
+      <url>http://example.com/repo</url>
+    </pluginRepository>
+  </pluginRepositories>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireNoRepositories>
+                </requireNoRepositories>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_plugin-repositories/verify.groovy b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_plugin-repositories/verify.groovy
new file mode 100644
index 0000000..b3c2b46
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_plugin-repositories/verify.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.text.contains( '[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireNoRepositories failed with message:' )
+assert buildLog.text.contains( 'Some poms have repositories defined:' )
+assert buildLog.text.contains( 'org.apache.maven.its.enforcer:test version:1.0 has plugin repositories [repo]' )
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_repositories/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_repositories/invoker.properties
new file mode 100644
index 0000000..c98ac4c
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_repositories/invoker.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.buildResult=failure
\ No newline at end of file
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_repositories/pom.xml b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_repositories/pom.xml
new file mode 100644
index 0000000..ba8a6a7
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_repositories/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.enforcer</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+
+  <description>This IT makes sure to prevent having pluginRepositories inside the pom.</description>
+
+  <pluginRepositories>
+    <pluginRepository>
+      <id>plugin-repo</id>
+      <url>http://example.com/repo</url>
+    </pluginRepository>
+  </pluginRepositories>
+  <repositories>
+    <repository>
+      <id>com.asual.maven.public</id>
+      <name>Asual Public Repository</name>
+      <url>http://localhost</url>
+    </repository>
+  </repositories>
+
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireNoRepositories>
+                  <allowedPluginRepositories>plugin-repo</allowedPluginRepositories>
+                </requireNoRepositories>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_repositories/verify.groovy b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_repositories/verify.groovy
new file mode 100644
index 0000000..c065765
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories_failure_repositories/verify.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.text.contains( '[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireNoRepositories failed with message:' )
+assert buildLog.text.contains( 'Some poms have repositories defined:' )
+assert buildLog.text.contains( 'org.apache.maven.its.enforcer:test version:1.0 has repositories [com.asual.maven.public]' )
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml b/maven-enforcer-plugin/src/it/projects/require-no-repositories_mm/child/pom.xml
similarity index 53%
copy from maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
copy to maven-enforcer-plugin/src/it/projects/require-no-repositories_mm/child/pom.xml
index c66de18..b9c3410 100644
--- a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories_mm/child/pom.xml
@@ -22,34 +22,12 @@ under the License.
 <project>
   <modelVersion>4.0.0</modelVersion>
 
-  <groupId>org.apache.maven.its.enforcer</groupId>
-  <artifactId>test</artifactId>
-  <version>1.0</version>
+  <parent>
+    <groupId>org.apache.maven.its.enforcer</groupId>
+    <artifactId>test</artifactId>
+    <version>1.0</version>
+  </parent>
 
-  <description>
-  </description>
+  <artifactId>child</artifactId>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-enforcer-plugin</artifactId>
-        <version>@project.version@</version>
-        <executions>
-          <execution>
-            <id>test</id>
-            <goals>
-              <goal>enforce</goal>
-            </goals>
-            <configuration>
-              <rules>
-                <requireNoRepositories>
-                </requireNoRepositories>
-              </rules>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
 </project>
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml b/maven-enforcer-plugin/src/it/projects/require-no-repositories_mm/pom.xml
similarity index 91%
copy from maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
copy to maven-enforcer-plugin/src/it/projects/require-no-repositories_mm/pom.xml
index c66de18..e2651ac 100644
--- a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories_mm/pom.xml
@@ -25,8 +25,13 @@ under the License.
   <groupId>org.apache.maven.its.enforcer</groupId>
   <artifactId>test</artifactId>
   <version>1.0</version>
+  <packaging>pom</packaging>
 
+  <modules>
+    <module>child</module>
+  </modules>
   <description>
+    This IT demonstrates having no repositories defined at all.
   </description>
 
   <build>
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml b/maven-enforcer-plugin/src/it/projects/require-no-repositories_mm_ci/child/pom.xml
similarity index 53%
copy from maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
copy to maven-enforcer-plugin/src/it/projects/require-no-repositories_mm_ci/child/pom.xml
index c66de18..40ed3e6 100644
--- a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories_mm_ci/child/pom.xml
@@ -22,34 +22,12 @@ under the License.
 <project>
   <modelVersion>4.0.0</modelVersion>
 
-  <groupId>org.apache.maven.its.enforcer</groupId>
-  <artifactId>test</artifactId>
-  <version>1.0</version>
+  <parent>
+    <groupId>org.apache.maven.its.enforcer</groupId>
+    <artifactId>test</artifactId>
+    <version>${revision}</version>
+  </parent>
 
-  <description>
-  </description>
+  <artifactId>child</artifactId>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-enforcer-plugin</artifactId>
-        <version>@project.version@</version>
-        <executions>
-          <execution>
-            <id>test</id>
-            <goals>
-              <goal>enforce</goal>
-            </goals>
-            <configuration>
-              <rules>
-                <requireNoRepositories>
-                </requireNoRepositories>
-              </rules>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
 </project>
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories_mm_ci/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-no-repositories_mm_ci/invoker.properties
new file mode 100644
index 0000000..1c82ab6
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories_mm_ci/invoker.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.maven.version = 3.5.0+
\ No newline at end of file
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml b/maven-enforcer-plugin/src/it/projects/require-no-repositories_mm_ci/pom.xml
similarity index 86%
copy from maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
copy to maven-enforcer-plugin/src/it/projects/require-no-repositories_mm_ci/pom.xml
index c66de18..2ab44fa 100644
--- a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
+++ b/maven-enforcer-plugin/src/it/projects/require-no-repositories_mm_ci/pom.xml
@@ -24,9 +24,17 @@ under the License.
 
   <groupId>org.apache.maven.its.enforcer</groupId>
   <artifactId>test</artifactId>
-  <version>1.0</version>
+  <version>${revision}</version>
+  <packaging>pom</packaging>
 
+  <properties>
+    <revision>1.0-SNAPSHOT</revision>
+  </properties>
+  <modules>
+    <module>child</module>
+  </modules>
   <description>
+    This IT demonstrates the use of properties for the versions.
   </description>
 
   <build>
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/child/pom.xml
similarity index 53%
copy from maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
copy to maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/child/pom.xml
index c66de18..40ed3e6 100644
--- a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
+++ b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/child/pom.xml
@@ -22,34 +22,12 @@ under the License.
 <project>
   <modelVersion>4.0.0</modelVersion>
 
-  <groupId>org.apache.maven.its.enforcer</groupId>
-  <artifactId>test</artifactId>
-  <version>1.0</version>
+  <parent>
+    <groupId>org.apache.maven.its.enforcer</groupId>
+    <artifactId>test</artifactId>
+    <version>${revision}</version>
+  </parent>
 
-  <description>
-  </description>
+  <artifactId>child</artifactId>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-enforcer-plugin</artifactId>
-        <version>@project.version@</version>
-        <executions>
-          <execution>
-            <id>test</id>
-            <goals>
-              <goal>enforce</goal>
-            </goals>
-            <configuration>
-              <rules>
-                <requireNoRepositories>
-                </requireNoRepositories>
-              </rules>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
 </project>
diff --git a/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/invoker.properties
new file mode 100644
index 0000000..adc1614
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/invoker.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.maven.version = 3.5.0+
+invoker.buildResult=failure
\ No newline at end of file
diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/pom.xml
similarity index 80%
copy from maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
copy to maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/pom.xml
index c66de18..dd6501f 100644
--- a/maven-enforcer-plugin/src/it/projects/require-no-repositories/pom.xml
+++ b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/pom.xml
@@ -24,9 +24,17 @@ under the License.
 
   <groupId>org.apache.maven.its.enforcer</groupId>
   <artifactId>test</artifactId>
-  <version>1.0</version>
+  <version>${revision}</version>
+  <packaging>pom</packaging>
 
+  <properties>
+    <revision>1.0-SNAPSHOT</revision>
+  </properties>
+  <modules>
+    <module>child</module>
+  </modules>
   <description>
+    This IT demonstrates the use of properties for the versions for requirePluginVersions.
   </description>
 
   <build>
@@ -43,8 +51,8 @@ under the License.
             </goals>
             <configuration>
               <rules>
-                <requireNoRepositories>
-                </requireNoRepositories>
+                <requirePluginVersions>
+                </requirePluginVersions>
               </rules>
             </configuration>
           </execution>
diff --git a/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/verify.groovy b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/verify.groovy
new file mode 100644
index 0000000..865bfeb
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/verify.groovy
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.text.contains( '[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequirePluginVersions failed with message:' )
+assert buildLog.text.contains( 'Some plugins are missing valid versions:(LATEST RELEASE SNAPSHOT are not allowed )' )

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.