Fix: Unable to resolve parent pom that is a snapshot. Added policies from config during build. Also fixed bug in ArtifactPolicySnapshots, allowed override of default policies with a null value.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@728090 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Britton Isbell 2008-12-19 18:21:37 +00:00
parent 30dbc6db99
commit 807bb6ddc7
2 changed files with 19 additions and 11 deletions

View File

@ -82,12 +82,16 @@ public class ArtifactRepositoryPolicy
public void setUpdatePolicy( String updatePolicy )
{
this.updatePolicy = updatePolicy;
if(updatePolicy != null) {
this.updatePolicy = updatePolicy;
}
}
public void setChecksumPolicy( String checksumPolicy )
{
this.checksumPolicy = checksumPolicy;
if(checksumPolicy != null) {
this.checksumPolicy = checksumPolicy;
}
}
public boolean isEnabled()

View File

@ -120,13 +120,18 @@ public class DefaultMavenProjectBuilder
public MavenProject build( File projectDescriptor, ProjectBuilderConfiguration config )
throws ProjectBuildingException
{
List repositories = mavenTools.buildArtifactRepositories( projectBuilder.getSuperModel() );
{
List<ArtifactRepository> artifactRepositories = new ArrayList<ArtifactRepository>( );
artifactRepositories.addAll( mavenTools.buildArtifactRepositories( projectBuilder.getSuperModel() ) );
if(config.getRemoteRepositories() != null)
{
artifactRepositories.addAll(config.getRemoteRepositories());
}
MavenProject project = readModelFromLocalPath( "unknown",
projectDescriptor,
new DefaultPomArtifactResolver( config.getLocalRepository(),
repositories, artifactResolver ), config );
artifactRepositories, artifactResolver ), config );
project.setFile( projectDescriptor );
@ -178,14 +183,13 @@ public class DefaultMavenProjectBuilder
{
return project;
}
File f = (artifact.getFile() != null) ? artifact.getFile() : new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) );
mavenTools.findModelFromRepository( artifact, remoteArtifactRepositories, localRepository );
ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration().setLocalRepository( localRepository );
List<ArtifactRepository> artifactRepositories = new ArrayList<ArtifactRepository>( remoteArtifactRepositories );
artifactRepositories.addAll( mavenTools.buildArtifactRepositories( projectBuilder.getSuperModel() ) );
File f = (artifact.getFile() != null) ? artifact.getFile() : new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) );
mavenTools.findModelFromRepository( artifact, artifactRepositories, localRepository );
ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration().setLocalRepository( localRepository );
project = readModelFromLocalPath( "unknown", artifact.getFile(), new DefaultPomArtifactResolver( config.getLocalRepository(), artifactRepositories, artifactResolver ), config );
project = buildWithProfiles( project.getModel(), config, artifact.getFile(), project.getParentFile(), false );