o Restored warning for empty <module>

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@927364 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-03-25 12:17:53 +00:00
parent dfd067b3ed
commit 8fe6c6d551
3 changed files with 55 additions and 3 deletions

View File

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

View File

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

View File

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