PR: MNG-461

warn, but don't fail, when a POM is not in the repository

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@220250 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-07-22 06:32:06 +00:00
parent ff94d454fa
commit 70f2351610
1 changed files with 15 additions and 6 deletions

View File

@ -255,17 +255,26 @@ public class DefaultMavenProjectBuilder
try
{
artifactResolver.resolve( artifact, remoteArtifactRepositories, localRepository );
File file = artifact.getFile();
model = readModel( file );
}
catch ( ArtifactResolutionException e )
{
// TODO: a not found would be better vs other errors
throw new ProjectBuildingException( "Unable to find the POM in the repository", e );
}
// only not found should have the below behaviour
// throw new ProjectBuildingException( "Unable to find the POM in the repository", e );
// String path = localRepository.pathOfMetadata( new ProjectArtifactMetadata( artifact, null ) );
// File file = new File( localRepository.getBasedir(), path );
File file = artifact.getFile();
model = readModel( file );
getLogger().warn( "\n ***** Using defaults for missing POM " + artifact.getId() + " *****\n" );
model = new Model();
model.setModelVersion( "4.0.0" );
model.setArtifactId( artifact.getArtifactId() );
model.setGroupId( artifact.getGroupId() );
model.setVersion( artifact.getVersion() );
// TOOD: not correct in some instances
model.setPackaging( artifact.getType() );
}
}
// TODO: this is gross. Would like to give it the whole model, but maven-artifact shouldn't depend on that