[MNG-4555] mvn archetype:generate -o (offline) still results in a "checking updates from central"

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@929691 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-03-31 19:50:06 +00:00
parent 8daea5f1a7
commit ceef52904f
4 changed files with 16 additions and 29 deletions

View File

@ -55,10 +55,14 @@ public abstract class AbstractVersionTransformation
@Requirement
protected WagonManager wagonManager;
public void transformForResolve( Artifact artifact, RepositoryRequest request )
public void transformForResolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository )
throws ArtifactResolutionException, ArtifactNotFoundException
{
transformForResolve( artifact, request.getRemoteRepositories(), request.getLocalRepository() );
RepositoryRequest request = new DefaultRepositoryRequest();
request.setLocalRepository( localRepository );
request.setRemoteRepositories( remoteRepositories );
transformForResolve( artifact, request );
}
protected String resolveVersion( Artifact artifact, ArtifactRepository localRepository,

View File

@ -19,10 +19,9 @@ package org.apache.maven.repository.legacy.resolver.transform;
* under the License.
*/
import java.util.List;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.RepositoryRequest;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
import org.apache.maven.artifact.repository.metadata.Versioning;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
@ -33,23 +32,22 @@ import org.codehaus.plexus.component.annotations.Component;
public class LatestArtifactTransformation
extends AbstractVersionTransformation
{
public void transformForResolve( Artifact artifact,
List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository )
public void transformForResolve( Artifact artifact, RepositoryRequest request )
throws ArtifactResolutionException, ArtifactNotFoundException
{
if ( Artifact.LATEST_VERSION.equals( artifact.getVersion() ) )
{
try
{
String version = resolveVersion( artifact, localRepository, remoteRepositories );
String version = resolveVersion( artifact, request );
if ( Artifact.LATEST_VERSION.equals( version ) )
{
throw new ArtifactNotFoundException( "Unable to determine the latest version", artifact );
}
artifact.setBaseVersion( version );
artifact.updateVersion( version, localRepository );
artifact.updateVersion( version, request.getLocalRepository() );
}
catch ( RepositoryMetadataResolutionException e )
{

View File

@ -19,11 +19,10 @@ package org.apache.maven.repository.legacy.resolver.transform;
* under the License.
*/
import java.util.List;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.RepositoryRequest;
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
import org.apache.maven.artifact.repository.metadata.Versioning;
@ -41,16 +40,15 @@ import org.codehaus.plexus.component.annotations.Component;
public class ReleaseArtifactTransformation
extends AbstractVersionTransformation
{
public void transformForResolve( Artifact artifact,
List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository )
public void transformForResolve( Artifact artifact, RepositoryRequest request )
throws ArtifactResolutionException, ArtifactNotFoundException
{
if ( Artifact.RELEASE_VERSION.equals( artifact.getVersion() ) )
{
try
{
String version = resolveVersion( artifact, localRepository, remoteRepositories );
String version = resolveVersion( artifact, request );
if ( Artifact.RELEASE_VERSION.equals( version ) )
{
@ -58,7 +56,7 @@ public class ReleaseArtifactTransformation
}
artifact.setBaseVersion( version );
artifact.updateVersion( version, localRepository );
artifact.updateVersion( version, request.getLocalRepository() );
}
catch ( RepositoryMetadataResolutionException e )
{

View File

@ -22,13 +22,11 @@ package org.apache.maven.repository.legacy.resolver.transform;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.DefaultRepositoryRequest;
import org.apache.maven.artifact.repository.RepositoryRequest;
import org.apache.maven.artifact.repository.metadata.Metadata;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
@ -36,7 +34,6 @@ import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutio
import org.apache.maven.artifact.repository.metadata.Snapshot;
import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
import org.apache.maven.artifact.repository.metadata.Versioning;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.StringUtils;
@ -56,16 +53,6 @@ public class SnapshotTransformation
private static final String UTC_TIMESTAMP_PATTERN = "yyyyMMdd.HHmmss";
public void transformForResolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository )
throws ArtifactResolutionException, ArtifactNotFoundException
{
RepositoryRequest request = new DefaultRepositoryRequest();
request.setLocalRepository( localRepository );
request.setRemoteRepositories( remoteRepositories );
transformForResolve( artifact, request );
}
public void transformForResolve( Artifact artifact, RepositoryRequest request )
throws ArtifactResolutionException
{