mirror of https://github.com/apache/maven.git
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:
parent
76a0f452c2
commit
87dc3a9e16
|
@ -54,6 +54,12 @@ public class DefaultModelValidator
|
||||||
validateId( "artifactId", result, model.getArtifactId() );
|
validateId( "artifactId", result, model.getArtifactId() );
|
||||||
|
|
||||||
validateStringNotEmpty( "packaging", result, model.getPackaging() );
|
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() );
|
validateStringNotEmpty( "version", result, model.getVersion() );
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,16 @@ public class DefaultModelValidatorTest
|
||||||
|
|
||||||
assertEquals( "'version' is missing.", result.getMessage( 0 ) );
|
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()
|
public void testMissingDependencyArtifactId()
|
||||||
throws Exception
|
throws Exception
|
||||||
|
|
Loading…
Reference in New Issue