mirror of https://github.com/apache/maven.git
[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:
parent
8daea5f1a7
commit
ceef52904f
|
@ -55,10 +55,14 @@ public abstract class AbstractVersionTransformation
|
||||||
@Requirement
|
@Requirement
|
||||||
protected WagonManager wagonManager;
|
protected WagonManager wagonManager;
|
||||||
|
|
||||||
public void transformForResolve( Artifact artifact, RepositoryRequest request )
|
public void transformForResolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
|
||||||
|
ArtifactRepository localRepository )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
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,
|
protected String resolveVersion( Artifact artifact, ArtifactRepository localRepository,
|
||||||
|
|
|
@ -19,10 +19,9 @@ package org.apache.maven.repository.legacy.resolver.transform;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
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.RepositoryMetadataResolutionException;
|
||||||
import org.apache.maven.artifact.repository.metadata.Versioning;
|
import org.apache.maven.artifact.repository.metadata.Versioning;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
||||||
|
@ -33,23 +32,22 @@ import org.codehaus.plexus.component.annotations.Component;
|
||||||
public class LatestArtifactTransformation
|
public class LatestArtifactTransformation
|
||||||
extends AbstractVersionTransformation
|
extends AbstractVersionTransformation
|
||||||
{
|
{
|
||||||
public void transformForResolve( Artifact artifact,
|
|
||||||
List<ArtifactRepository> remoteRepositories,
|
public void transformForResolve( Artifact artifact, RepositoryRequest request )
|
||||||
ArtifactRepository localRepository )
|
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||||
{
|
{
|
||||||
if ( Artifact.LATEST_VERSION.equals( artifact.getVersion() ) )
|
if ( Artifact.LATEST_VERSION.equals( artifact.getVersion() ) )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String version = resolveVersion( artifact, localRepository, remoteRepositories );
|
String version = resolveVersion( artifact, request );
|
||||||
if ( Artifact.LATEST_VERSION.equals( version ) )
|
if ( Artifact.LATEST_VERSION.equals( version ) )
|
||||||
{
|
{
|
||||||
throw new ArtifactNotFoundException( "Unable to determine the latest version", artifact );
|
throw new ArtifactNotFoundException( "Unable to determine the latest version", artifact );
|
||||||
}
|
}
|
||||||
|
|
||||||
artifact.setBaseVersion( version );
|
artifact.setBaseVersion( version );
|
||||||
artifact.updateVersion( version, localRepository );
|
artifact.updateVersion( version, request.getLocalRepository() );
|
||||||
}
|
}
|
||||||
catch ( RepositoryMetadataResolutionException e )
|
catch ( RepositoryMetadataResolutionException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,11 +19,10 @@ package org.apache.maven.repository.legacy.resolver.transform;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
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.ArtifactRepositoryMetadata;
|
||||||
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
|
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
|
||||||
import org.apache.maven.artifact.repository.metadata.Versioning;
|
import org.apache.maven.artifact.repository.metadata.Versioning;
|
||||||
|
@ -41,16 +40,15 @@ import org.codehaus.plexus.component.annotations.Component;
|
||||||
public class ReleaseArtifactTransformation
|
public class ReleaseArtifactTransformation
|
||||||
extends AbstractVersionTransformation
|
extends AbstractVersionTransformation
|
||||||
{
|
{
|
||||||
public void transformForResolve( Artifact artifact,
|
|
||||||
List<ArtifactRepository> remoteRepositories,
|
public void transformForResolve( Artifact artifact, RepositoryRequest request )
|
||||||
ArtifactRepository localRepository )
|
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||||
{
|
{
|
||||||
if ( Artifact.RELEASE_VERSION.equals( artifact.getVersion() ) )
|
if ( Artifact.RELEASE_VERSION.equals( artifact.getVersion() ) )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String version = resolveVersion( artifact, localRepository, remoteRepositories );
|
String version = resolveVersion( artifact, request );
|
||||||
|
|
||||||
if ( Artifact.RELEASE_VERSION.equals( version ) )
|
if ( Artifact.RELEASE_VERSION.equals( version ) )
|
||||||
{
|
{
|
||||||
|
@ -58,7 +56,7 @@ public class ReleaseArtifactTransformation
|
||||||
}
|
}
|
||||||
|
|
||||||
artifact.setBaseVersion( version );
|
artifact.setBaseVersion( version );
|
||||||
artifact.updateVersion( version, localRepository );
|
artifact.updateVersion( version, request.getLocalRepository() );
|
||||||
}
|
}
|
||||||
catch ( RepositoryMetadataResolutionException e )
|
catch ( RepositoryMetadataResolutionException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,13 +22,11 @@ package org.apache.maven.repository.legacy.resolver.transform;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
|
import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
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.RepositoryRequest;
|
||||||
import org.apache.maven.artifact.repository.metadata.Metadata;
|
import org.apache.maven.artifact.repository.metadata.Metadata;
|
||||||
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
|
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.Snapshot;
|
||||||
import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
|
import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
|
||||||
import org.apache.maven.artifact.repository.metadata.Versioning;
|
import org.apache.maven.artifact.repository.metadata.Versioning;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
@ -56,16 +53,6 @@ public class SnapshotTransformation
|
||||||
|
|
||||||
private static final String UTC_TIMESTAMP_PATTERN = "yyyyMMdd.HHmmss";
|
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 )
|
public void transformForResolve( Artifact artifact, RepositoryRequest request )
|
||||||
throws ArtifactResolutionException
|
throws ArtifactResolutionException
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue