[MNG-6562] WARN if plugins injected by default lifecycle bindings don't have their version locked in pom.xml or parent
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 45f1d38..2a475fc 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,8 @@
// Tests that don't run stable and need to be fixed
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+
+ suite.addTestSuite( MavenITmng6562WarnDefaultBindings.class );
suite.addTestSuite( MavenITmng5868NoDuplicateAttachedArtifacts.class );
suite.addTestSuite( MavenITmng5937MavenWrapper.class );
suite.addTestSuite( MavenITmng4660ResumeFromTest.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6562WarnDefaultBindings.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6562WarnDefaultBindings.java
new file mode 100644
index 0000000..1998038
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6562WarnDefaultBindings.java
@@ -0,0 +1,138 @@
+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;
+import java.util.Arrays;
+
+public class MavenITmng6562WarnDefaultBindings
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng6562WarnDefaultBindings()
+ {
+ super( "[3.7.0,)" );
+ }
+
+ public void testItShouldNotWarn()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" );
+
+ String phase = "validate";
+ Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
+ verifier.setAutoclean( false );
+ verifier.setLogFileName( phase + ".txt" );
+ verifier.setForkJvm( true ); // required due to --fos-on-severity
+ verifier.addCliOption( "-fos=WARN" ); // ALSO NO WARNINGS
+ verifier.executeGoals( Arrays.asList( phase ) );
+ verifier.resetStreams();
+
+ verifier.verifyErrorFreeLog();
+ }
+
+
+ public void testItShouldNotWarn2()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" );
+
+ String phase = "process-resources";
+ Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
+ verifier.setAutoclean( false );
+ verifier.setLogFileName( phase + ".txt" );
+ verifier.setForkJvm( true ); // required due to --fos-on-severity
+ verifier.addCliOption( "-fos=WARN" ); // ALSO NO WARNINGS
+ verifier.executeGoals( Arrays.asList( phase ) );
+ verifier.resetStreams();
+
+ verifier.verifyErrorFreeLog();
+ }
+
+ public void testItShouldWarnForCompilerPlugin()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" );
+
+ String phase = "compile";
+ Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
+ verifier.setAutoclean( false );
+ verifier.setLogFileName( phase +".txt" );
+ verifier.executeGoals( Arrays.asList( phase ) );
+ verifier.resetStreams();
+
+ verifier.verifyTextInLog( "Version not locked for default bindings plugins [maven-compiler-plugin]"
+ + ", you should define versions in pluginManagement section of your pom.xml or parent" );
+ }
+
+ public void testItShouldWarnForCompilerPlugin2()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" );
+
+ String phase = "process-test-resources";
+ Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
+ verifier.setAutoclean( false );
+ verifier.setLogFileName( phase +".txt" );
+ verifier.executeGoals( Arrays.asList( phase ) );
+ verifier.resetStreams();
+ verifier.verifyErrorFreeLog();
+
+ verifier.verifyTextInLog( "Version not locked for default bindings plugins [maven-compiler-plugin]"
+ + ", you should define versions in pluginManagement section of your pom.xml or parent" );
+ }
+
+ public void testItShouldWarnForCompilerPlugin3()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" );
+
+ String phase = "test-compile";
+ Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
+ verifier.setAutoclean( false );
+ verifier.setLogFileName( phase +".txt" );
+ verifier.executeGoals( Arrays.asList( phase ) );
+ verifier.resetStreams();
+ verifier.verifyErrorFreeLog();
+
+ verifier.verifyTextInLog( "Version not locked for default bindings plugins [maven-compiler-plugin]"
+ + ", you should define versions in pluginManagement section of your pom.xml or parent" );
+ }
+
+ public void testItShouldWarnForCompilerPluginAndSurefirePlugin()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" );
+
+ String phase = "test";
+ Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
+ verifier.setAutoclean( false );
+ verifier.setLogFileName( phase +".txt" );
+ verifier.executeGoals( Arrays.asList( phase ) );
+ verifier.resetStreams();
+ verifier.verifyErrorFreeLog();
+
+ verifier.verifyTextInLog( "Version not locked for default bindings plugins [maven-compiler-plugin, maven-surefire-plugin]"
+ + ", you should define versions in pluginManagement section of your pom.xml or parent" );
+ }
+
+}
diff --git a/core-it-suite/src/test/resources/mng-6562-default-bindings/pom.xml b/core-it-suite/src/test/resources/mng-6562-default-bindings/pom.xml
new file mode 100644
index 0000000..1384e36
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6562-default-bindings/pom.xml
@@ -0,0 +1,46 @@
+<?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.mng6562</groupId>
+ <artifactId>test</artifactId>
+ <version>0.1</version>
+
+ <name>Maven Integration Test :: MNG-6562</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>0.1-stub-SNAPSHOT</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>