PR: MNG-1276

Submitted By: Edwin Punzalan
Reviewed By: John Casey

Applied patch, with some modifications. Specifically, changed the validation message when <modelVersion>4.0.0</modelVersion> is not found, added reason to the warning line (no newlines here, just a hint at why it's wrong), and reformatted the debug output to be a bit more terse.

Thanks, Edwin.


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@345081 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-11-16 18:09:34 +00:00
parent 7e6eefa883
commit b8b8e02e2b
2 changed files with 7 additions and 5 deletions

View File

@ -1080,7 +1080,7 @@ public class DefaultMavenProjectBuilder
if ( modelSource.indexOf( "<modelVersion>4.0.0" ) < 0 ) if ( modelSource.indexOf( "<modelVersion>4.0.0" ) < 0 )
{ {
throw new InvalidProjectModelException( projectId, pomLocation, "Invalid POM (not v4.0.0 modelVersion)" ); throw new InvalidProjectModelException( projectId, pomLocation, "Not a v4.0.0 POM." );
} }
StringReader sReader = new StringReader( modelSource ); StringReader sReader = new StringReader( modelSource );

View File

@ -104,21 +104,23 @@ public class MavenMetadataSource
} }
catch ( InvalidProjectModelException e ) catch ( InvalidProjectModelException e )
{ {
getLogger().warn( "POM for: \'" + pomArtifact + getLogger().warn( "POM for \'" + pomArtifact +
"\' does not appear to be valid. Its will be ignored for artifact resolution.\n\nReason: " + "\' is invalid. It will be ignored for artifact resolution. Reason: " + e.getMessage() );
e.getMessage() + "\n\n" );
if ( getLogger().isDebugEnabled() ) if ( getLogger().isDebugEnabled() )
{ {
getLogger().debug( "Reason: " + e.getMessage() );
ModelValidationResult validationResult = e.getValidationResult(); ModelValidationResult validationResult = e.getValidationResult();
if ( validationResult != null ) if ( validationResult != null )
{ {
getLogger().debug( "\nValidation Errors:" );
for ( Iterator i = validationResult.getMessages().iterator(); i.hasNext(); ) for ( Iterator i = validationResult.getMessages().iterator(); i.hasNext(); )
{ {
getLogger().debug( i.next().toString() ); getLogger().debug( i.next().toString() );
} }
getLogger().debug( "\n\n" ); getLogger().debug( "\n" );
} }
} }