diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java index 6757c425fb..63f7842342 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java @@ -833,7 +833,14 @@ public class DefaultModelBuilder buffer.append( ": " ).append( e.getMessage() ); if ( childModel.getProjectDirectory() != null ) { - buffer.append( " and 'parent.relativePath' points at wrong local POM" ); + if ( parent.getRelativePath() == null || parent.getRelativePath().length() <= 0 ) + { + buffer.append( " and 'parent.relativePath' points at no local POM" ); + } + else + { + buffer.append( " and 'parent.relativePath' points at wrong local POM" ); + } } problems.add( Severity.FATAL, buffer.toString(), parent.getLocation( "" ), e ); 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 4654189d9b..ca89ce3b30 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 @@ -92,9 +92,21 @@ public class DefaultModelValidator Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 ); validateEnum( "modelVersion", problems, Severity.ERROR, model.getModelVersion(), null, model, "4.0.0" ); + validateStringNoExpression( "groupId", problems, Severity.WARNING, model.getGroupId(), model ); + if ( parent == null ) + { + validateStringNotEmpty( "groupId", problems, Severity.FATAL, model.getGroupId(), model ); + } + validateStringNoExpression( "artifactId", problems, Severity.WARNING, model.getArtifactId(), model ); + validateStringNotEmpty( "artifactId", problems, Severity.FATAL, model.getArtifactId(), model ); + validateStringNoExpression( "version", problems, Severity.WARNING, model.getVersion(), model ); + if ( parent == null ) + { + validateStringNotEmpty( "version", problems, Severity.FATAL, model.getVersion(), model ); + } validateRawDependencies( problems, model.getDependencies(), "dependencies.dependency", request );