From a702225a3185cbd60039196d459b9426a4dc0385 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Sun, 21 Nov 2010 15:20:54 +0000 Subject: [PATCH] [MNG-4907] Wrong error message when relativePath wrong git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1037475 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/model/building/DefaultModelBuilder.java | 9 ++++++++- .../model/validation/DefaultModelValidator.java | 12 ++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) 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 );