mirror of https://github.com/apache/maven.git
PR: MNG-1127
ensure file is set to the snapshot version git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@307219 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4011fd5b20
commit
2bbd09083f
|
@ -90,7 +90,6 @@ public class DefaultArtifactResolver
|
||||||
artifact.setResolved( true );
|
artifact.setResolved( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// skip artifacts with a file - they are already resolved
|
|
||||||
else if ( !artifact.isResolved() )
|
else if ( !artifact.isResolved() )
|
||||||
{
|
{
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
@ -113,6 +112,7 @@ public class DefaultArtifactResolver
|
||||||
}
|
}
|
||||||
|
|
||||||
File destination = artifact.getFile();
|
File destination = artifact.getFile();
|
||||||
|
boolean resolved = false;
|
||||||
if ( !destination.exists() || force )
|
if ( !destination.exists() || force )
|
||||||
{
|
{
|
||||||
if ( !wagonManager.isOnline() )
|
if ( !wagonManager.isOnline() )
|
||||||
|
@ -150,11 +150,22 @@ public class DefaultArtifactResolver
|
||||||
throw new ArtifactResolutionException( e.getMessage(), artifact, remoteRepositories, e );
|
throw new ArtifactResolutionException( e.getMessage(), artifact, remoteRepositories, e );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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() ) )
|
if ( artifact.isSnapshot() && !artifact.getBaseVersion().equals( artifact.getVersion() ) )
|
||||||
{
|
{
|
||||||
String version = artifact.getVersion();
|
String version = artifact.getVersion();
|
||||||
artifact.selectVersion( artifact.getBaseVersion() );
|
artifact.selectVersion( artifact.getBaseVersion() );
|
||||||
File copy = new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) );
|
File copy = new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) );
|
||||||
|
if ( resolved || !copy.exists() )
|
||||||
|
{
|
||||||
|
// recopy file if it was reresolved, or doesn't exist.
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FileUtils.copyFile( destination, copy );
|
FileUtils.copyFile( destination, copy );
|
||||||
|
@ -164,15 +175,11 @@ public class DefaultArtifactResolver
|
||||||
throw new ArtifactResolutionException( "Unable to copy resolved artifact for local use",
|
throw new ArtifactResolutionException( "Unable to copy resolved artifact for local use",
|
||||||
artifact, remoteRepositories, e );
|
artifact, remoteRepositories, e );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
artifact.setFile( copy );
|
||||||
artifact.selectVersion( version );
|
artifact.selectVersion( version );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( destination.exists() )
|
|
||||||
{
|
|
||||||
// locally resolved...no need to hit the remote repo.
|
|
||||||
artifact.setResolved( true );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue