[MNG-5001] check build failure on configure read-only plugin parameter
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
index 027587f..9eb7fb4 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
@@ -106,6 +106,7 @@
         // Tests that don't run stable and need to be fixed
         // -------------------------------------------------------------------------------------------------------------
         // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+        suite.addTestSuite( MavenITmng5001PluginReadOnlyParameter.class );
         suite.addTestSuite( MavenITmng6957BuildConsumer.class );
         suite.addTestSuite( MavenITmng7045DropUselessAndOutdatedCdiApiTest.class );
         suite.addTestSuite( MavenITmng6566ExecuteAnnotationShouldNotReExecuteGoalsTest.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5001PluginReadOnlyParameter.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5001PluginReadOnlyParameter.java
new file mode 100644
index 0000000..dbfa19f
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5001PluginReadOnlyParameter.java
@@ -0,0 +1,62 @@
+package org.apache.maven.it;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+
+/**
+ * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-5001">MNG-5001</a>:
+ * fail build if a configuring a read-only plugin parameter.
+ */
+public class MavenITmng5001PluginReadOnlyParameter
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng5001PluginReadOnlyParameter()
+    {
+        super( "[2.0.5,3.0-alpha-1),[3.7.0,)" );
+    }
+
+    /**
+     * Verify that a project configuring a read-only plugin parameter just fails at build time.
+     */
+    public void testit()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5001_readonly" );
+
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
+        try
+        {
+            verifier.executeGoal( "validate" );
+            throw new Exception( "configuring a plugin's read-only parameter should fail" );
+        }
+        catch ( VerificationException ve )
+        {
+            // expected failure
+        }
+        verifier.resetStreams();
+    }
+
+}
diff --git a/core-it-suite/src/test/resources/mng-5001_readonly/pom.xml b/core-it-suite/src/test/resources/mng-5001_readonly/pom.xml
new file mode 100644
index 0000000..994ac0e
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5001_readonly/pom.xml
@@ -0,0 +1,63 @@
+<?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">

+  <modelVersion>4.0.0</modelVersion>

+

+  <groupId>org.apache.maven.its.mng5001</groupId>

+  <artifactId>readonlytest</artifactId>

+  <version>0.0.1-SNAPSHOT</version>

+  <packaging>pom</packaging>

+

+  <description>

+    IT for MNG-5001: tries to configure a read-only plugin parameter.

+    This fails with Maven 2 as expected, but is not checked with Maven 3 (up to 3.6.x) then implicitely permitted...

+  </description>

+

+  <properties>

+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

+  </properties>

+

+  <build>

+    <plugins>

+      <plugin>

+        <groupId>org.apache.maven.its.plugins</groupId>

+        <artifactId>maven-it-plugin-configuration</artifactId>

+        <version>2.1-SNAPSHOT</version>

+        <configuration>

+          <propertiesFile>target/config.properties</propertiesFile>

+          <basedir>target</basedir><!-- read-only parameter: configuring should not be permitted -->

+        </configuration>

+        <executions>

+          <execution>

+            <id>test</id>

+            <phase>validate</phase>

+            <goals>

+              <goal>config</goal>

+            </goals>

+          </execution>

+        </executions>

+      </plugin>

+    </plugins>

+  </build>

+

+ </project>