You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2005/10/08 01:38:30 UTC
svn commit: r307219 -
/maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
Author: brett
Date: Fri Oct 7 16:38:25 2005
New Revision: 307219
URL: http://svn.apache.org/viewcvs?rev=307219&view=rev
Log:
PR: MNG-1127
ensure file is set to the snapshot version
Modified:
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
Modified: maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java?rev=307219&r1=307218&r2=307219&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java (original)
+++ maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java Fri Oct 7 16:38:25 2005
@@ -90,7 +90,6 @@
artifact.setResolved( true );
}
}
- // skip artifacts with a file - they are already resolved
else if ( !artifact.isResolved() )
{
// ----------------------------------------------------------------------
@@ -113,6 +112,7 @@
}
File destination = artifact.getFile();
+ boolean resolved = false;
if ( !destination.exists() || force )
{
if ( !wagonManager.isOnline() )
@@ -150,11 +150,22 @@
throw new ArtifactResolutionException( e.getMessage(), artifact, remoteRepositories, e );
}
- if ( artifact.isSnapshot() && !artifact.getBaseVersion().equals( artifact.getVersion() ) )
+ resolved = true;
+ }
+ else if ( destination.exists() )
+ {
+ // locally resolved...no need to hit the remote repo.
+ artifact.setResolved( true );
+ }
+
+ if ( artifact.isSnapshot() && !artifact.getBaseVersion().equals( artifact.getVersion() ) )
+ {
+ String version = artifact.getVersion();
+ artifact.selectVersion( artifact.getBaseVersion() );
+ File copy = new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) );
+ if ( resolved || !copy.exists() )
{
- String version = artifact.getVersion();
- artifact.selectVersion( artifact.getBaseVersion() );
- File copy = new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) );
+ // recopy file if it was reresolved, or doesn't exist.
try
{
FileUtils.copyFile( destination, copy );
@@ -164,13 +175,9 @@
throw new ArtifactResolutionException( "Unable to copy resolved artifact for local use",
artifact, remoteRepositories, e );
}
- artifact.selectVersion( version );
}
- }
- else if ( destination.exists() )
- {
- // locally resolved...no need to hit the remote repo.
- artifact.setResolved( true );
+ artifact.setFile( copy );
+ artifact.selectVersion( version );
}
}
}