[MNG-4231] Snapshots are not checked for updates

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@799592 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-07-31 12:49:40 +00:00
parent ce5af70026
commit 899e37629b
5 changed files with 8 additions and 26 deletions

View File

@ -155,12 +155,7 @@ public class MavenArtifactRepository
// We need to set the file here or the resolver will fail with an NPE, not fully equipped to deal
// with multiple local repository implementations yet.
artifact.setFile( artifactFile );
if( artifactFile.exists() )
{
artifact.setResolved( true );
}
return artifact;
}

View File

@ -140,20 +140,13 @@ public class DefaultArtifactResolver
{
return;
}
if ( artifact.isSnapshot() && artifact.isResolved() )
{
return;
}
transformationManager.transformForResolve( artifact, remoteRepositories, localRepository );
boolean localCopy = isLocalCopy( artifact );
destination = artifact.getFile();
boolean resolved = false;
if ( force || !destination.exists() || ( artifact.isSnapshot() && !localCopy ) )
{
try
@ -182,8 +175,6 @@ public class DefaultArtifactResolver
{
throw new ArtifactResolutionException( e.getMessage(), artifact, remoteRepositories, e );
}
resolved = true;
}
if ( destination.exists() )
@ -193,7 +184,7 @@ public class DefaultArtifactResolver
// 1.0-SNAPSHOT
//
// 1) pom = 1.0-SoNAPSHOT
// 1) pom = 1.0-SNAPSHOT
// 2) pom = 1.0-yyyymmdd.hhmmss
// 3) baseVersion = 1.0-SNAPSHOT
if ( artifact.isSnapshot() && !artifact.getBaseVersion().equals( artifact.getVersion() ) )
@ -209,7 +200,8 @@ public class DefaultArtifactResolver
// if the timestamped version was resolved or the copy doesn't exist then copy a version
// of the file like 1.0-SNAPSHOT. Even if there is a timestamped version the non-timestamped
// version will be created.
if ( resolved || !copy.exists() )
if ( !copy.exists() || copy.lastModified() != destination.lastModified()
|| copy.length() != destination.length() )
{
// recopy file if it was reresolved, or doesn't exist.
try
@ -227,7 +219,7 @@ public class DefaultArtifactResolver
// We are only going to use the 1.0-SNAPSHOT version
artifact.setFile( copy );
// Set the version to the 1.0-SNAPSHOT version
// Set the version to the 1.0-yyyymmdd.hhmmss version
artifact.selectVersion( version );
}
}

View File

@ -20,7 +20,6 @@ package org.apache.maven.repository;
*/
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.MavenArtifactRepository;
public abstract class LocalArtifactRepository

View File

@ -44,12 +44,7 @@ public class UserLocalArtifactRepository
// We need to set the file here or the resolver will fail with an NPE, not fully equipped to deal
// with multiple local repository implementations yet.
artifact.setFile( artifactFile );
if( artifactFile.exists() )
{
artifact.setResolved( true );
}
return artifact;
}

View File

@ -27,6 +27,7 @@ public class TestIdeWorkspaceRepository
{
artifact.setFile( ARTIFACT_FILE );
artifact.setResolved( true );
artifact.setFromAuthoritativeRepository( true );
}
return artifact;
}