[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
This commit is contained in:
Benjamin Bentmann 2010-11-21 15:20:54 +00:00
parent 7e57e9ea83
commit a702225a31
2 changed files with 20 additions and 1 deletions

View File

@ -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 );

View File

@ -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 );