diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
index 9299b4377d..f0acb1fe87 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
@@ -105,6 +105,13 @@ public void validateRawModel( Model m, ModelBuildingRequest request, ModelProble
+ ", the parent element cannot have the same groupId:artifactId as the project.",
parent );
}
+
+ if ( equals( "LATEST", parent.getVersion() ) || equals( "RELEASE", parent.getVersion() ) )
+ {
+ addViolation( problems, Severity.WARNING, Version.BASE, "parent.version", null,
+ "is either LATEST or RELEASE (both of them are being deprecated)", parent );
+ }
+
}
if ( request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 )
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
index 0bb3bd4fb0..b02e0d90b3 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
@@ -781,4 +781,19 @@ public void testCiFriendlyBadSha1Plus2()
assertEquals( "'version' contains an expression but should be a constant.", result.getWarnings().get( 0 ) );
}
+ public void testParentVersionLATEST()
+ throws Exception
+ {
+ SimpleProblemCollector result = validateRaw( "raw-model/bad-parent-version-latest.xml" );
+ assertViolations( result, 0, 0, 1 );
+ assertEquals( "'parent.version' is either LATEST or RELEASE (both of them are being deprecated)", result.getWarnings().get( 0 ) );
+ }
+
+ public void testParentVersionRELEASE()
+ throws Exception
+ {
+ SimpleProblemCollector result = validateRaw( "raw-model/bad-parent-version-release.xml" );
+ assertViolations( result, 0, 0, 1 );
+ assertEquals( "'parent.version' is either LATEST or RELEASE (both of them are being deprecated)", result.getWarnings().get( 0 ) );
+ }
}
diff --git a/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-parent-version-latest.xml b/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-parent-version-latest.xml
new file mode 100644
index 0000000000..7ed30ad1df
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-parent-version-latest.xml
@@ -0,0 +1,37 @@
+
+
+
+ 4.0.0
+
+
+ com.example.group
+ com-parent
+ LATEST
+
+ com.example.group
+ valid-version-wrong
+ 1.0
+
+
+ This will test if the validation for the parent version
+ is working correct in case of usage of LATEST
+
+
\ No newline at end of file
diff --git a/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-parent-version-release.xml b/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-parent-version-release.xml
new file mode 100644
index 0000000000..65fcc2671e
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-parent-version-release.xml
@@ -0,0 +1,37 @@
+
+
+
+ 4.0.0
+
+
+ com.example.group
+ com-parent
+ RELEASE
+
+ com.example.group
+ valid-version-wrong
+ 1.0
+
+
+ This will test if the validation for the parent version
+ is working correct in case of usage of RELEASE
+
+
\ No newline at end of file