You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2010/03/25 13:17:53 UTC

svn commit: r927364 - in /maven/maven-3/trunk/maven-model-builder/src: main/java/org/apache/maven/model/validation/ test/java/org/apache/maven/model/validation/ test/resources/poms/validation/

Author: bentmann
Date: Thu Mar 25 12:17:53 2010
New Revision: 927364

URL: http://svn.apache.org/viewvc?rev=927364&view=rev
Log:
o Restored warning for empty <module>

Added:
    maven/maven-3/trunk/maven-model-builder/src/test/resources/poms/validation/empty-module.xml   (with props)
Modified:
    maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
    maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java

Modified: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java?rev=927364&r1=927363&r2=927364&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java (original)
+++ maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java Thu Mar 25 12:17:53 2010
@@ -134,10 +134,22 @@ public class DefaultModelValidator
 
         validateStringNotEmpty( "packaging", problems, Severity.ERROR, model.getPackaging() );
 
-        if ( !model.getModules().isEmpty() && !"pom".equals( model.getPackaging() ) )
+        if ( !model.getModules().isEmpty() )
         {
-            addViolation( problems, Severity.ERROR, "Packaging '" + model.getPackaging()
-                + "' is invalid. Aggregator projects " + "require 'pom' as packaging." );
+            if ( !"pom".equals( model.getPackaging() ) )
+            {
+                addViolation( problems, Severity.ERROR, "Packaging '" + model.getPackaging()
+                    + "' is invalid. Aggregator projects " + "require 'pom' as packaging." );
+            }
+
+            for ( String module : model.getModules() )
+            {
+                if ( StringUtils.isBlank( module ) )
+                {
+                    addViolation( problems, Severity.WARNING,
+                                  "Child module has been specified without path to its project directory." );
+                }
+            }
         }
 
         validateStringNotEmpty( "version", problems, Severity.ERROR, model.getVersion() );

Modified: maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java?rev=927364&r1=927363&r2=927364&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java (original)
+++ maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java Thu Mar 25 12:17:53 2010
@@ -426,4 +426,14 @@ public class DefaultModelValidatorTest
         assertTrue( result.getWarnings().get( 0 ).contains( "test:a:jar" ) );
     }
 
+    public void testEmptyModule()
+        throws Exception
+    {
+        SimpleProblemCollector result = validate( "empty-module.xml" );
+
+        assertViolations( result, 0, 0, 1 );
+
+        assertTrue( result.getWarnings().get( 0 ).contains( "Child module has been specified without path" ) );
+    }
+
 }

Added: maven/maven-3/trunk/maven-model-builder/src/test/resources/poms/validation/empty-module.xml
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/test/resources/poms/validation/empty-module.xml?rev=927364&view=auto
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/test/resources/poms/validation/empty-module.xml (added)
+++ maven/maven-3/trunk/maven-model-builder/src/test/resources/poms/validation/empty-module.xml Thu Mar 25 12:17:53 2010
@@ -0,0 +1,30 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>aid</artifactId>
+  <groupId>gid</groupId>
+  <version>0.1</version>
+  <packaging>pom</packaging>
+
+  <modules>
+    <module> </module>
+  </modules>
+</project>

Propchange: maven/maven-3/trunk/maven-model-builder/src/test/resources/poms/validation/empty-module.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/maven-3/trunk/maven-model-builder/src/test/resources/poms/validation/empty-module.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision