o Improved validation messages

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@934853 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-04-16 12:50:18 +00:00
parent 4bddf292f5
commit d8a1cb1b9a
2 changed files with 8 additions and 6 deletions

View File

@ -196,11 +196,12 @@ public class DefaultModelValidator
+ "' is invalid. Aggregator projects " + "require 'pom' as packaging." );
}
for ( String module : model.getModules() )
for ( int i = 0, n = model.getModules().size(); i < n; i++ )
{
String module = model.getModules().get( i );
if ( StringUtils.isBlank( module ) )
{
addViolation( problems, Severity.WARNING, "modules.module", null,
addViolation( problems, Severity.WARNING, "modules.module[" + i + "]", null,
"has been specified without a path to the project directory." );
}
}
@ -221,12 +222,13 @@ public class DefaultModelValidator
if ( request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 )
{
Set<String> modules = new HashSet<String>();
for ( String module : model.getModules() )
for ( int i = 0, n = model.getModules().size(); i < n; i++ )
{
String module = model.getModules().get( i );
if ( !modules.add( module ) )
{
addViolation( problems, Severity.ERROR, "modules.module", null, "specifies duplicate child module "
+ module );
addViolation( problems, Severity.ERROR, "modules.module[" + i + "]", null,
"specifies duplicate child module " + module );
}
}

View File

@ -420,7 +420,7 @@ public class DefaultModelValidatorTest
assertViolations( result, 0, 0, 1 );
assertTrue( result.getWarnings().get( 0 ).contains( "'modules.module' has been specified without a path" ) );
assertTrue( result.getWarnings().get( 0 ).contains( "'modules.module[0]' has been specified without a path" ) );
}
public void testDuplicatePlugin()