From b8dcb08731ce7e43399320ce7c7579c4a24481c9 Mon Sep 17 00:00:00 2001 From: Joseph Walton Date: Sat, 21 Feb 2015 17:33:01 +1100 Subject: [PATCH] MNG-5734: Fail, rather than just warning, on empty '' entries. An incorrect non-blank module is currently treated as an error. Behave the same way for a blank module, rather than simply warning about the mistake. Signed-off-by: Jason van Zyl --- .../apache/maven/model/validation/DefaultModelValidator.java | 2 +- .../maven/model/validation/DefaultModelValidatorTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 def9c13668..dd7bd4e24e 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 @@ -312,7 +312,7 @@ public class DefaultModelValidator String module = m.getModules().get( i ); if ( StringUtils.isBlank( module ) ) { - addViolation( problems, Severity.WARNING, Version.BASE, "modules.module[" + i + "]", null, + addViolation( problems, Severity.ERROR, Version.BASE, "modules.module[" + i + "]", null, "has been specified without a path to the project directory.", m.getLocation( "modules" ) ); } 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 791a31893d..dde532d870 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 @@ -430,9 +430,9 @@ public class DefaultModelValidatorTest { SimpleProblemCollector result = validate( "empty-module.xml" ); - assertViolations( result, 0, 0, 1 ); + assertViolations( result, 0, 1, 0 ); - assertTrue( result.getWarnings().get( 0 ).contains( "'modules.module[0]' has been specified without a path" ) ); + assertTrue( result.getErrors().get( 0 ).contains( "'modules.module[0]' has been specified without a path" ) ); } public void testDuplicatePlugin()