PR: MNG-764

Submitted by: Edwin Punzalan
validation error if aggregator containing modules is not of the right packaging


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@330003 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-11-01 07:37:57 +00:00
parent 76a0f452c2
commit 87dc3a9e16
2 changed files with 16 additions and 0 deletions

View File

@ -55,6 +55,12 @@ public class DefaultModelValidator
validateStringNotEmpty( "packaging", result, model.getPackaging() );
if ( !model.getModules().isEmpty() && !"pom".equals( model.getPackaging() ) )
{
result.addMessage( "Packaging '" + model.getPackaging() + "' is invalid. Aggregator projects " +
"require 'pom' as packaging." );
}
validateStringNotEmpty( "version", result, model.getVersion() );
for ( Iterator it = model.getDependencies().iterator(); it.hasNext(); )

View File

@ -97,6 +97,16 @@ public class DefaultModelValidatorTest
assertEquals( "'version' is missing.", result.getMessage( 0 ) );
}
public void testInvalidAggregatorPackaging()
throws Exception
{
ModelValidationResult result = validate( "invalid-aggregator-packaging-pom.xml" );
assertEquals( 1, result.getMessageCount() );
assertTrue( result.getMessage( 0 ).indexOf( "Aggregator projects require 'pom' as packaging." ) > -1 );
}
public void testMissingDependencyArtifactId()
throws Exception
{