mirror of https://github.com/apache/maven.git
o Updated to remove errors reported by Checkstyle.
This commit is contained in:
parent
311fc62b7d
commit
a99a78984c
|
@ -23,7 +23,7 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
|
|||
|
||||
/**
|
||||
* Exception which is meant to occur when a layout specified for a particular
|
||||
* repository doesn't have a corresponding {@link ArtifactRepositoryLayout}
|
||||
* repository doesn't have a corresponding {@link org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout}
|
||||
* component in the current container.
|
||||
*
|
||||
* @author jdcasey
|
||||
|
|
|
@ -81,7 +81,9 @@ public class DefaultArtifactRepositoryFactory
|
|||
ArtifactRepositoryPolicy snapshots,
|
||||
ArtifactRepositoryPolicy releases )
|
||||
{
|
||||
return injectSession( factory.createArtifactRepository( id, url, repositoryLayout, snapshots, releases ), true );
|
||||
return injectSession( factory.createArtifactRepository( id, url, repositoryLayout, snapshots, releases ),
|
||||
true );
|
||||
|
||||
}
|
||||
|
||||
public void setGlobalUpdatePolicy( String updatePolicy )
|
||||
|
|
|
@ -25,15 +25,11 @@ import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
|||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
|
||||
/**
|
||||
* The code in this class is taken from DefaultRepositorylayout, located at:
|
||||
* http://svn.apache.org/viewvc/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java
|
||||
*
|
||||
*/
|
||||
@Component( role = ArtifactRepositoryLayout.class, hint = "flat" )
|
||||
public class FlatRepositoryLayout
|
||||
implements ArtifactRepositoryLayout
|
||||
{
|
||||
|
||||
private static final char ARTIFACT_SEPARATOR = '-';
|
||||
|
||||
private static final char GROUP_SEPARATOR = '.';
|
||||
|
|
|
@ -39,7 +39,6 @@ public interface ArtifactResolver
|
|||
ArtifactResolutionResult resolve( ArtifactResolutionRequest request );
|
||||
|
||||
// The rest is deprecated
|
||||
|
||||
// USED BY MAVEN ASSEMBLY PLUGIN 2.2-beta-2
|
||||
@Deprecated
|
||||
String ROLE = ArtifactResolver.class.getName();
|
||||
|
@ -57,7 +56,7 @@ public interface ArtifactResolver
|
|||
@Deprecated
|
||||
ArtifactResolutionResult resolveTransitively(
|
||||
Set<Artifact> artifacts, Artifact originatingArtifact,
|
||||
Map<String,Artifact> managedVersions, ArtifactRepository localRepository,
|
||||
Map<String, Artifact> managedVersions, ArtifactRepository localRepository,
|
||||
List<ArtifactRepository> remoteRepositories,
|
||||
ArtifactMetadataSource source )
|
||||
throws ArtifactResolutionException, ArtifactNotFoundException;
|
||||
|
@ -66,7 +65,7 @@ public interface ArtifactResolver
|
|||
@Deprecated
|
||||
ArtifactResolutionResult resolveTransitively(
|
||||
Set<Artifact> artifacts, Artifact originatingArtifact,
|
||||
Map<String,Artifact> managedVersions, ArtifactRepository localRepository,
|
||||
Map<String, Artifact> managedVersions, ArtifactRepository localRepository,
|
||||
List<ArtifactRepository> remoteRepositories,
|
||||
ArtifactMetadataSource source, ArtifactFilter filter )
|
||||
throws ArtifactResolutionException, ArtifactNotFoundException;
|
||||
|
@ -82,7 +81,7 @@ public interface ArtifactResolver
|
|||
@Deprecated
|
||||
ArtifactResolutionResult resolveTransitively(
|
||||
Set<Artifact> artifacts, Artifact originatingArtifact,
|
||||
Map<String,Artifact> managedVersions, ArtifactRepository localRepository,
|
||||
Map<String, Artifact> managedVersions, ArtifactRepository localRepository,
|
||||
List<ArtifactRepository> remoteRepositories,
|
||||
ArtifactMetadataSource source, ArtifactFilter filter,
|
||||
List<ResolutionListener> listeners )
|
||||
|
@ -112,4 +111,5 @@ public interface ArtifactResolver
|
|||
void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories,
|
||||
ArtifactRepository localRepository )
|
||||
throws ArtifactResolutionException, ArtifactNotFoundException;
|
||||
|
||||
}
|
||||
|
|
|
@ -332,10 +332,16 @@ public class DefaultArtifactResolver
|
|||
throws ArtifactResolutionException,
|
||||
ArtifactNotFoundException
|
||||
{
|
||||
ArtifactResolutionRequest request =
|
||||
new ArtifactResolutionRequest().setArtifact( originatingArtifact ).setResolveRoot( false )
|
||||
ArtifactResolutionRequest request = new ArtifactResolutionRequest().
|
||||
setArtifact( originatingArtifact ).
|
||||
setResolveRoot( false ).
|
||||
// This is required by the surefire plugin
|
||||
.setArtifactDependencies( artifacts ).setManagedVersionMap( managedVersions ).setLocalRepository( localRepository ).setRemoteRepositories( remoteRepositories ).setCollectionFilter( filter ).setListeners( listeners );
|
||||
setArtifactDependencies( artifacts ).
|
||||
setManagedVersionMap( managedVersions ).
|
||||
setLocalRepository( localRepository ).
|
||||
setRemoteRepositories( remoteRepositories ).
|
||||
setCollectionFilter( filter ).
|
||||
setListeners( listeners );
|
||||
|
||||
injectSession2( request, legacySupport.getSession() );
|
||||
|
||||
|
|
|
@ -24,10 +24,12 @@ import org.apache.maven.model.Profile;
|
|||
@Deprecated
|
||||
public interface ProfileActivator
|
||||
{
|
||||
final String ROLE = ProfileActivator.class.getName();
|
||||
|
||||
String ROLE = ProfileActivator.class.getName();
|
||||
|
||||
boolean canDetermineActivation( Profile profile );
|
||||
|
||||
boolean isActive( Profile profile )
|
||||
throws ProfileActivationException;
|
||||
|
||||
}
|
||||
|
|
|
@ -45,9 +45,8 @@ public final class ProjectUtils
|
|||
{
|
||||
}
|
||||
|
||||
public static List<ArtifactRepository> buildArtifactRepositories( List<Repository> repositories,
|
||||
ArtifactRepositoryFactory artifactRepositoryFactory,
|
||||
PlexusContainer c )
|
||||
public static List<ArtifactRepository> buildArtifactRepositories(
|
||||
List<Repository> repositories, ArtifactRepositoryFactory artifactRepositoryFactory, PlexusContainer c )
|
||||
throws InvalidRepositoryException
|
||||
{
|
||||
|
||||
|
@ -61,17 +60,15 @@ public final class ProjectUtils
|
|||
return remoteRepositories;
|
||||
}
|
||||
|
||||
public static ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo,
|
||||
ArtifactRepositoryFactory artifactRepositoryFactory,
|
||||
PlexusContainer c )
|
||||
public static ArtifactRepository buildDeploymentArtifactRepository(
|
||||
DeploymentRepository repo, ArtifactRepositoryFactory artifactRepositoryFactory, PlexusContainer c )
|
||||
throws InvalidRepositoryException
|
||||
{
|
||||
return buildArtifactRepository( repo, artifactRepositoryFactory, c );
|
||||
}
|
||||
|
||||
public static ArtifactRepository buildArtifactRepository( Repository repo,
|
||||
ArtifactRepositoryFactory artifactRepositoryFactory,
|
||||
PlexusContainer c )
|
||||
public static ArtifactRepository buildArtifactRepository(
|
||||
Repository repo, ArtifactRepositoryFactory artifactRepositoryFactory, PlexusContainer c )
|
||||
throws InvalidRepositoryException
|
||||
{
|
||||
RepositorySystem repositorySystem = rs( c );
|
||||
|
|
|
@ -65,6 +65,7 @@ public abstract class AbstractStringBasedModelInterpolator
|
|||
extends AbstractLogEnabled
|
||||
implements ModelInterpolator, Initializable
|
||||
{
|
||||
|
||||
private static final List<String> PROJECT_PREFIXES = Arrays.asList( "pom.", "project." );
|
||||
|
||||
private static final List<String> TRANSLATED_PATH_EXPRESSIONS;
|
||||
|
@ -124,6 +125,7 @@ public abstract class AbstractStringBasedModelInterpolator
|
|||
*
|
||||
* @param model The inbound Model instance, to serialize and reference for expression resolution
|
||||
* @param context The other context map to be used during resolution
|
||||
*
|
||||
* @return The resolved instance of the inbound Model. This is a different instance!
|
||||
*
|
||||
* @deprecated Use {@link ModelInterpolator#interpolate(Model, File, ProjectBuilderConfiguration, boolean)} instead.
|
||||
|
@ -227,6 +229,7 @@ public abstract class AbstractStringBasedModelInterpolator
|
|||
|
||||
ValueSource basedirValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false )
|
||||
{
|
||||
|
||||
public Object getValue( String expression )
|
||||
{
|
||||
if ( projectDir != null && "basedir".equals( expression ) )
|
||||
|
@ -235,9 +238,11 @@ public abstract class AbstractStringBasedModelInterpolator
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}, PROJECT_PREFIXES, true );
|
||||
ValueSource baseUriValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false )
|
||||
{
|
||||
|
||||
public Object getValue( String expression )
|
||||
{
|
||||
if ( projectDir != null && "baseUri".equals( expression ) )
|
||||
|
@ -246,6 +251,7 @@ public abstract class AbstractStringBasedModelInterpolator
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}, PROJECT_PREFIXES, false );
|
||||
|
||||
List<ValueSource> valueSources = new ArrayList<>( 9 );
|
||||
|
@ -260,10 +266,12 @@ public abstract class AbstractStringBasedModelInterpolator
|
|||
valueSources.add( new MapBasedValueSource( config.getExecutionProperties() ) );
|
||||
valueSources.add( new AbstractValueSource( false )
|
||||
{
|
||||
|
||||
public Object getValue( String expression )
|
||||
{
|
||||
return config.getExecutionProperties().getProperty( "env." + expression );
|
||||
}
|
||||
|
||||
} );
|
||||
valueSources.add( modelValueSource2 );
|
||||
|
||||
|
@ -273,11 +281,13 @@ public abstract class AbstractStringBasedModelInterpolator
|
|||
protected List<InterpolationPostProcessor> createPostProcessors( final Model model, final File projectDir,
|
||||
final ProjectBuilderConfiguration config )
|
||||
{
|
||||
return Collections.singletonList( (InterpolationPostProcessor) new PathTranslatingPostProcessor(
|
||||
return Collections.singletonList(
|
||||
(InterpolationPostProcessor) new PathTranslatingPostProcessor(
|
||||
PROJECT_PREFIXES,
|
||||
TRANSLATED_PATH_EXPRESSIONS,
|
||||
projectDir,
|
||||
pathTranslator ) );
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
|
|
|
@ -47,8 +47,8 @@ public class StringSearchModelInterpolator
|
|||
extends AbstractStringBasedModelInterpolator
|
||||
{
|
||||
|
||||
private static final Map<Class<?>, Field[]> fieldsByClass = new WeakHashMap<>();
|
||||
private static final Map<Class<?>, Boolean> fieldIsPrimitiveByClass = new WeakHashMap<>();
|
||||
private static final Map<Class<?>, Field[]> FIELDS_BY_CLASS = new WeakHashMap<>();
|
||||
private static final Map<Class<?>, Boolean> PRIMITIVE_BY_CLASS = new WeakHashMap<>();
|
||||
|
||||
public StringSearchModelInterpolator()
|
||||
{
|
||||
|
@ -161,11 +161,11 @@ public class StringSearchModelInterpolator
|
|||
}
|
||||
else if ( isQualifiedForInterpolation( cls ) )
|
||||
{
|
||||
Field[] fields = fieldsByClass.get( cls );
|
||||
Field[] fields = FIELDS_BY_CLASS.get( cls );
|
||||
if ( fields == null )
|
||||
{
|
||||
fields = cls.getDeclaredFields();
|
||||
fieldsByClass.put( cls, fields );
|
||||
FIELDS_BY_CLASS.put( cls, fields );
|
||||
}
|
||||
|
||||
for ( Field field : fields )
|
||||
|
@ -350,12 +350,12 @@ public class StringSearchModelInterpolator
|
|||
|
||||
private boolean isQualifiedForInterpolation( Field field, Class<?> fieldType )
|
||||
{
|
||||
if ( !fieldIsPrimitiveByClass.containsKey( fieldType ) )
|
||||
if ( !PRIMITIVE_BY_CLASS.containsKey( fieldType ) )
|
||||
{
|
||||
fieldIsPrimitiveByClass.put( fieldType, fieldType.isPrimitive() );
|
||||
PRIMITIVE_BY_CLASS.put( fieldType, fieldType.isPrimitive() );
|
||||
}
|
||||
|
||||
if ( fieldIsPrimitiveByClass.get( fieldType ) )
|
||||
if ( PRIMITIVE_BY_CLASS.get( fieldType ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -125,17 +125,13 @@ public class DefaultPathTranslator
|
|||
if ( s != null )
|
||||
{
|
||||
String basedirExpr = null;
|
||||
for ( String BASEDIR_EXPRESSION : BASEDIR_EXPRESSIONS )
|
||||
for ( String expression : BASEDIR_EXPRESSIONS )
|
||||
{
|
||||
basedirExpr = BASEDIR_EXPRESSION;
|
||||
if ( s.startsWith( basedirExpr ) )
|
||||
if ( s.startsWith( expression ) )
|
||||
{
|
||||
basedirExpr = expression;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
basedirExpr = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ( basedirExpr != null )
|
||||
|
|
|
@ -118,7 +118,7 @@ public class MetadataResolutionResult
|
|||
|
||||
public List<Artifact> getMissingArtifacts()
|
||||
{
|
||||
return missingArtifacts == null ? Collections.<Artifact> emptyList() : missingArtifacts;
|
||||
return missingArtifacts == null ? Collections.<Artifact>emptyList() : missingArtifacts;
|
||||
}
|
||||
|
||||
public MetadataResolutionResult addMissingArtifact( Artifact artifact )
|
||||
|
@ -148,7 +148,7 @@ public class MetadataResolutionResult
|
|||
|
||||
public List<Exception> getExceptions()
|
||||
{
|
||||
return exceptions == null ? Collections.<Exception> emptyList() : exceptions;
|
||||
return exceptions == null ? Collections.<Exception>emptyList() : exceptions;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -185,7 +185,7 @@ public class MetadataResolutionResult
|
|||
|
||||
public List<Exception> getVersionRangeViolations()
|
||||
{
|
||||
return versionRangeViolations == null ? Collections.<Exception> emptyList() : versionRangeViolations;
|
||||
return versionRangeViolations == null ? Collections.<Exception>emptyList() : versionRangeViolations;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -217,7 +217,7 @@ public class MetadataResolutionResult
|
|||
|
||||
public List<ArtifactResolutionException> getMetadataResolutionExceptions()
|
||||
{
|
||||
return metadataResolutionExceptions == null ? Collections.<ArtifactResolutionException> emptyList()
|
||||
return metadataResolutionExceptions == null ? Collections.<ArtifactResolutionException>emptyList()
|
||||
: metadataResolutionExceptions;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,10 +63,19 @@ import org.eclipse.aether.util.ConfigUtils;
|
|||
public class DefaultWagonManager
|
||||
implements WagonManager
|
||||
{
|
||||
private static final String[] CHECKSUM_IDS = { "md5", "sha1" };
|
||||
|
||||
/** have to match the CHECKSUM_IDS */
|
||||
private static final String[] CHECKSUM_ALGORITHMS = { "MD5", "SHA-1" };
|
||||
private static final String[] CHECKSUM_IDS =
|
||||
{
|
||||
"md5", "sha1"
|
||||
};
|
||||
|
||||
/**
|
||||
* have to match the CHECKSUM_IDS
|
||||
*/
|
||||
private static final String[] CHECKSUM_ALGORITHMS =
|
||||
{
|
||||
"MD5", "SHA-1"
|
||||
};
|
||||
|
||||
@Requirement
|
||||
private Logger logger;
|
||||
|
@ -80,7 +89,6 @@ public class DefaultWagonManager
|
|||
@Requirement
|
||||
private LegacySupport legacySupport;
|
||||
|
||||
|
||||
//
|
||||
// Retriever
|
||||
//
|
||||
|
@ -97,6 +105,7 @@ public class DefaultWagonManager
|
|||
{
|
||||
logger.debug( "Skipping disabled repository " + repository.getId() + " for resolution of "
|
||||
+ artifact.getId() );
|
||||
|
||||
}
|
||||
else if ( artifact.isSnapshot() || !artifact.getFile().exists() )
|
||||
{
|
||||
|
@ -133,17 +142,21 @@ public class DefaultWagonManager
|
|||
String error = updateCheckManager.getError( artifact, repository );
|
||||
if ( error != null )
|
||||
{
|
||||
throw new TransferFailedException( "Failure to resolve " + remotePath + " from "
|
||||
+ repository.getUrl() + " was cached in the local repository. "
|
||||
+ "Resolution will not be reattempted until the update interval of " + repository.getId()
|
||||
+ " has elapsed or updates are forced. Original error: " + error );
|
||||
throw new TransferFailedException(
|
||||
"Failure to resolve " + remotePath + " from " + repository.getUrl()
|
||||
+ " was cached in the local repository. "
|
||||
+ "Resolution will not be reattempted until the update interval of "
|
||||
+ repository.getId() + " has elapsed or updates are forced. Original error: " + error );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ResourceDoesNotExistException( "Failure to resolve " + remotePath + " from "
|
||||
+ repository.getUrl() + " was cached in the local repository. "
|
||||
+ "Resolution will not be reattempted until the update interval of " + repository.getId()
|
||||
+ " has elapsed or updates are forced." );
|
||||
throw new ResourceDoesNotExistException(
|
||||
"Failure to resolve " + remotePath + " from " + repository.getUrl()
|
||||
+ " was cached in the local repository. "
|
||||
+ "Resolution will not be reattempted until the update interval of "
|
||||
+ repository.getId() + " has elapsed or updates are forced." );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -175,6 +188,7 @@ public class DefaultWagonManager
|
|||
|
||||
logger.debug( "Unable to find artifact " + artifact.getId() + " in repository " + repository.getId()
|
||||
+ " (" + repository.getUrl() + ")", e );
|
||||
|
||||
}
|
||||
catch ( TransferFailedException e )
|
||||
{
|
||||
|
@ -183,6 +197,7 @@ public class DefaultWagonManager
|
|||
String msg =
|
||||
"Unable to get artifact " + artifact.getId() + " from repository " + repository.getId() + " ("
|
||||
+ repository.getUrl() + "): " + e.getMessage();
|
||||
|
||||
if ( logger.isDebugEnabled() )
|
||||
{
|
||||
logger.warn( msg, e );
|
||||
|
@ -233,6 +248,7 @@ public class DefaultWagonManager
|
|||
*
|
||||
* @param wagon
|
||||
* @param repository
|
||||
*
|
||||
* @throws ConnectionException
|
||||
* @throws AuthenticationException
|
||||
*/
|
||||
|
@ -241,10 +257,12 @@ public class DefaultWagonManager
|
|||
{
|
||||
// MNG-5509
|
||||
// See org.eclipse.aether.connector.wagon.WagonRepositoryConnector.connectWagon(Wagon)
|
||||
if( legacySupport.getRepositorySession() != null )
|
||||
if ( legacySupport.getRepositorySession() != null )
|
||||
{
|
||||
String userAgent = ConfigUtils.getString( legacySupport.getRepositorySession(), null, ConfigurationProperties.USER_AGENT );
|
||||
if( userAgent == null)
|
||||
String userAgent = ConfigUtils.getString( legacySupport.getRepositorySession(), null,
|
||||
ConfigurationProperties.USER_AGENT );
|
||||
|
||||
if ( userAgent == null )
|
||||
{
|
||||
Properties headers = new Properties();
|
||||
|
||||
|
@ -270,17 +288,20 @@ public class DefaultWagonManager
|
|||
{
|
||||
logger.debug( "Using proxy " + repository.getProxy().getHost() + ":" + repository.getProxy().getPort()
|
||||
+ " for " + repository.getUrl() );
|
||||
|
||||
}
|
||||
|
||||
if ( repository.getAuthentication() != null && repository.getProxy() != null )
|
||||
{
|
||||
wagon.connect( new Repository( repository.getId(), repository.getUrl() ), authenticationInfo( repository ),
|
||||
proxyInfo( repository ) );
|
||||
|
||||
}
|
||||
else if ( repository.getAuthentication() != null )
|
||||
{
|
||||
wagon.connect( new Repository( repository.getId(), repository.getUrl() ),
|
||||
authenticationInfo( repository ) );
|
||||
|
||||
}
|
||||
else if ( repository.getProxy() != null )
|
||||
{
|
||||
|
@ -414,10 +435,10 @@ public class DefaultWagonManager
|
|||
}
|
||||
catch ( ChecksumFailedException e )
|
||||
{
|
||||
// if we catch a ChecksumFailedException, it means the transfer/read succeeded, but the checksum
|
||||
// doesn't match. This could be a problem with the server (ibiblio HTTP-200 error page), so we'll
|
||||
// try this up to two times. On the second try, we'll handle it as a bona-fide error, based on the
|
||||
// repository's checksum checking policy.
|
||||
// if we catch a ChecksumFailedException, it means the transfer/read succeeded, but the
|
||||
// checksum doesn't match. This could be a problem with the server (ibiblio HTTP-200 error
|
||||
// page), so we'll try this up to two times. On the second try, we'll handle it as a bona-fide
|
||||
// error, based on the repository's checksum checking policy.
|
||||
if ( firstRun )
|
||||
{
|
||||
logger.warn( "*** CHECKSUM FAILED - " + e.getMessage() + " - RETRYING" );
|
||||
|
@ -507,7 +528,6 @@ public class DefaultWagonManager
|
|||
// File.renameTo operation doesn't really work across file systems.
|
||||
// So we will attempt to do a File.renameTo for efficiency and atomicity, if this fails
|
||||
// then we will use a brute force copy and delete the temporary file.
|
||||
|
||||
if ( !temp.renameTo( destination ) )
|
||||
{
|
||||
try
|
||||
|
@ -523,6 +543,7 @@ public class DefaultWagonManager
|
|||
{
|
||||
throw new TransferFailedException( "Error copying temporary file to the final destination: "
|
||||
+ e.getMessage(), e );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -642,9 +663,9 @@ public class DefaultWagonManager
|
|||
cleanupTemporaryFiles( temporaryFiles );
|
||||
|
||||
// Remove every checksum listener
|
||||
for ( String aCHECKSUM_IDS : CHECKSUM_IDS )
|
||||
for ( String id : CHECKSUM_IDS )
|
||||
{
|
||||
TransferListener checksumListener = checksums.get( aCHECKSUM_IDS );
|
||||
TransferListener checksumListener = checksums.get( id );
|
||||
if ( checksumListener != null )
|
||||
{
|
||||
wagon.removeTransferListener( checksumListener );
|
||||
|
@ -753,6 +774,7 @@ public class DefaultWagonManager
|
|||
{
|
||||
throw new ChecksumFailedException( "Checksum failed on download: local = '" + actualChecksum
|
||||
+ "'; remote = '" + expectedChecksum + "'" );
|
||||
|
||||
}
|
||||
}
|
||||
catch ( IOException e )
|
||||
|
@ -815,6 +837,7 @@ public class DefaultWagonManager
|
|||
{
|
||||
throw new UnsupportedProtocolException( "Cannot find wagon which supports the requested protocol: "
|
||||
+ protocol, e );
|
||||
|
||||
}
|
||||
|
||||
return wagon;
|
||||
|
|
|
@ -353,22 +353,21 @@ public class LegacyRepositorySystem
|
|||
return artifactResolver.resolve( request );
|
||||
}
|
||||
|
||||
/*
|
||||
public void addProxy( String protocol, String host, int port, String username, String password, String nonProxyHosts )
|
||||
{
|
||||
ProxyInfo proxyInfo = new ProxyInfo();
|
||||
proxyInfo.setHost( host );
|
||||
proxyInfo.setType( protocol );
|
||||
proxyInfo.setPort( port );
|
||||
proxyInfo.setNonProxyHosts( nonProxyHosts );
|
||||
proxyInfo.setUserName( username );
|
||||
proxyInfo.setPassword( password );
|
||||
|
||||
proxies.put( protocol, proxyInfo );
|
||||
|
||||
wagonManager.addProxy( protocol, host, port, username, password, nonProxyHosts );
|
||||
}
|
||||
*/
|
||||
// public void addProxy( String protocol, String host, int port, String username, String password,
|
||||
// String nonProxyHosts )
|
||||
// {
|
||||
// ProxyInfo proxyInfo = new ProxyInfo();
|
||||
// proxyInfo.setHost( host );
|
||||
// proxyInfo.setType( protocol );
|
||||
// proxyInfo.setPort( port );
|
||||
// proxyInfo.setNonProxyHosts( nonProxyHosts );
|
||||
// proxyInfo.setUserName( username );
|
||||
// proxyInfo.setPassword( password );
|
||||
//
|
||||
// proxies.put( protocol, proxyInfo );
|
||||
//
|
||||
// wagonManager.addProxy( protocol, host, port, username, password, nonProxyHosts );
|
||||
// }
|
||||
|
||||
public List<ArtifactRepository> getEffectiveRepositories( List<ArtifactRepository> repositories )
|
||||
{
|
||||
|
|
|
@ -45,7 +45,8 @@ public interface WagonManager
|
|||
//
|
||||
// Retriever
|
||||
//
|
||||
void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener transferListener, boolean force )
|
||||
void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener transferListener,
|
||||
boolean force )
|
||||
throws TransferFailedException, ResourceDoesNotExistException;
|
||||
|
||||
void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories,
|
||||
|
@ -71,7 +72,8 @@ public interface WagonManager
|
|||
TransferListener downloadMonitor )
|
||||
throws TransferFailedException;
|
||||
|
||||
void putRemoteFile( ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor )
|
||||
void putRemoteFile( ArtifactRepository repository, File source, String remotePath,
|
||||
TransferListener downloadMonitor )
|
||||
throws TransferFailedException;
|
||||
|
||||
void putArtifactMetadata( File source, ArtifactMetadata artifactMetadata, ArtifactRepository repository )
|
||||
|
|
|
@ -37,7 +37,8 @@ public interface ArtifactRepositoryFactory
|
|||
throws UnknownRepositoryLayoutException;
|
||||
|
||||
@Deprecated
|
||||
ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, boolean uniqueVersion )
|
||||
ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId,
|
||||
boolean uniqueVersion )
|
||||
throws UnknownRepositoryLayoutException;
|
||||
|
||||
ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout,
|
||||
|
@ -48,7 +49,8 @@ public interface ArtifactRepositoryFactory
|
|||
throws UnknownRepositoryLayoutException;
|
||||
|
||||
ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout,
|
||||
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases );
|
||||
ArtifactRepositoryPolicy snapshots,
|
||||
ArtifactRepositoryPolicy releases );
|
||||
|
||||
void setGlobalUpdatePolicy( String snapshotPolicy );
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ import org.codehaus.plexus.logging.Logger;
|
|||
public class DefaultLegacyArtifactCollector
|
||||
implements LegacyArtifactCollector
|
||||
{
|
||||
|
||||
@Requirement( hint = "nearest" )
|
||||
private ConflictResolver defaultConflictResolver;
|
||||
|
||||
|
@ -102,7 +103,8 @@ public class DefaultLegacyArtifactCollector
|
|||
}
|
||||
|
||||
public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
|
||||
Map<String, Artifact> managedVersions, ArtifactResolutionRequest repositoryRequest,
|
||||
Map<String, Artifact> managedVersions,
|
||||
ArtifactResolutionRequest repositoryRequest,
|
||||
ArtifactMetadataSource source, ArtifactFilter filter,
|
||||
List<ResolutionListener> listeners,
|
||||
List<ConflictResolver> conflictResolvers )
|
||||
|
@ -206,7 +208,8 @@ public class DefaultLegacyArtifactCollector
|
|||
* @param originatingArtifact artifact we are processing
|
||||
* @param managedVersions original managed versions
|
||||
*/
|
||||
private ManagedVersionMap getManagedVersionsMap( Artifact originatingArtifact, Map<String,Artifact> managedVersions )
|
||||
private ManagedVersionMap getManagedVersionsMap( Artifact originatingArtifact,
|
||||
Map<String, Artifact> managedVersions )
|
||||
{
|
||||
ManagedVersionMap versionMap;
|
||||
if ( ( managedVersions != null ) && ( managedVersions instanceof ManagedVersionMap ) )
|
||||
|
@ -218,7 +221,7 @@ public class DefaultLegacyArtifactCollector
|
|||
versionMap = new ManagedVersionMap( managedVersions );
|
||||
}
|
||||
|
||||
/* remove the originating artifact if it is also in managed versions to avoid being modified during resolution */
|
||||
// remove the originating artifact if it is also in managed versions to avoid being modified during resolution
|
||||
Artifact managedOriginatingArtifact = versionMap.get( originatingArtifact.getDependencyConflictId() );
|
||||
|
||||
if ( managedOriginatingArtifact != null )
|
||||
|
@ -286,7 +289,10 @@ public class DefaultLegacyArtifactCollector
|
|||
// Select an appropriate available version from the (now restricted) range
|
||||
// Note this version was selected before to get the appropriate POM
|
||||
// But it was reset by the call to setVersionRange on restricting the version
|
||||
ResolutionNode[] resetNodes = { previous, node };
|
||||
ResolutionNode[] resetNodes =
|
||||
{
|
||||
previous, node
|
||||
};
|
||||
for ( int j = 0; j < 2; j++ )
|
||||
{
|
||||
Artifact resetArtifact = resetNodes[j].getArtifact();
|
||||
|
@ -306,6 +312,7 @@ public class DefaultLegacyArtifactCollector
|
|||
{
|
||||
MetadataResolutionRequest metadataRequest =
|
||||
new DefaultMetadataResolutionRequest( request );
|
||||
|
||||
metadataRequest.setArtifact( resetArtifact );
|
||||
versions = source.retrieveAvailableVersions( metadataRequest );
|
||||
resetArtifact.setAvailableVersions( versions );
|
||||
|
@ -315,24 +322,28 @@ public class DefaultLegacyArtifactCollector
|
|||
resetArtifact.setDependencyTrail( node.getDependencyTrail() );
|
||||
throw new ArtifactResolutionException(
|
||||
"Unable to get dependency information: "
|
||||
+ e.getMessage(), resetArtifact,
|
||||
request.getRemoteRepositories(), e );
|
||||
+ e.getMessage(), resetArtifact, request.getRemoteRepositories(),
|
||||
e );
|
||||
|
||||
}
|
||||
}
|
||||
// end hack
|
||||
|
||||
// MNG-2861: match version can return null
|
||||
ArtifactVersion selectedVersion =
|
||||
resetArtifact.getVersionRange().matchVersion( resetArtifact.getAvailableVersions() );
|
||||
ArtifactVersion selectedVersion = resetArtifact.getVersionRange().
|
||||
matchVersion( resetArtifact.getAvailableVersions() );
|
||||
|
||||
if ( selectedVersion != null )
|
||||
{
|
||||
resetArtifact.selectVersion( selectedVersion.toString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new OverConstrainedVersionException( " Unable to find a version in "
|
||||
+ resetArtifact.getAvailableVersions() + " to match the range "
|
||||
+ resetArtifact.getVersionRange(), resetArtifact );
|
||||
throw new OverConstrainedVersionException(
|
||||
"Unable to find a version in " + resetArtifact.getAvailableVersions()
|
||||
+ " to match the range " + resetArtifact.getVersionRange(),
|
||||
resetArtifact );
|
||||
|
||||
}
|
||||
|
||||
fireEvent( ResolutionListener.SELECT_VERSION_FROM_RANGE, listeners, resetNodes[j] );
|
||||
|
@ -342,7 +353,8 @@ public class DefaultLegacyArtifactCollector
|
|||
|
||||
// Conflict Resolution
|
||||
ResolutionNode resolved = null;
|
||||
for ( Iterator<ConflictResolver> j = conflictResolvers.iterator(); ( resolved == null ) && j.hasNext(); )
|
||||
for ( Iterator<ConflictResolver> j = conflictResolvers.iterator();
|
||||
resolved == null && j.hasNext(); )
|
||||
{
|
||||
ConflictResolver conflictResolver = j.next();
|
||||
|
||||
|
@ -354,8 +366,10 @@ public class DefaultLegacyArtifactCollector
|
|||
// TODO: add better exception that can detail the two conflicting artifacts
|
||||
ArtifactResolutionException are =
|
||||
new ArtifactResolutionException( "Cannot resolve artifact version conflict between "
|
||||
+ previous.getArtifact().getVersion() + " and " + node.getArtifact().getVersion(),
|
||||
+ previous.getArtifact().getVersion() + " and "
|
||||
+ node.getArtifact().getVersion(),
|
||||
previous.getArtifact() );
|
||||
|
||||
result.addVersionRangeViolation( are );
|
||||
}
|
||||
|
||||
|
@ -365,6 +379,7 @@ public class DefaultLegacyArtifactCollector
|
|||
result.addVersionRangeViolation( new ArtifactResolutionException(
|
||||
"Conflict resolver returned unknown resolution node: ",
|
||||
resolved.getArtifact() ) );
|
||||
|
||||
}
|
||||
|
||||
// TODO: should this be part of mediation?
|
||||
|
@ -509,15 +524,16 @@ public class DefaultLegacyArtifactCollector
|
|||
if ( versions.isEmpty() )
|
||||
{
|
||||
throw new OverConstrainedVersionException(
|
||||
"No versions are present in the repository for the artifact with a range "
|
||||
+ versionRange,
|
||||
artifact,
|
||||
"No versions are present in the repository for the artifact"
|
||||
+ " with a range " + versionRange, artifact,
|
||||
childRemoteRepositories );
|
||||
|
||||
}
|
||||
|
||||
throw new OverConstrainedVersionException( "Couldn't find a version in "
|
||||
+ versions + " to match range " + versionRange, artifact,
|
||||
childRemoteRepositories );
|
||||
throw new OverConstrainedVersionException(
|
||||
"Couldn't find a version in " + versions + " to match range "
|
||||
+ versionRange, artifact, childRemoteRepositories );
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -536,7 +552,7 @@ public class DefaultLegacyArtifactCollector
|
|||
break;
|
||||
}
|
||||
}
|
||||
while( !childKey.equals( child.getKey() ) );
|
||||
while ( !childKey.equals( child.getKey() ) );
|
||||
|
||||
if ( parentArtifact != null && parentArtifact.getDependencyFilter() != null
|
||||
&& !parentArtifact.getDependencyFilter().include( artifact ) )
|
||||
|
@ -574,7 +590,9 @@ public class DefaultLegacyArtifactCollector
|
|||
artifact.setDependencyTrail( node.getDependencyTrail() );
|
||||
|
||||
throw new ArtifactResolutionException( "Unable to get dependency information for "
|
||||
+ artifact.getId() + ": " + e.getMessage(), artifact, childRemoteRepositories, e );
|
||||
+ artifact.getId() + ": " + e.getMessage(),
|
||||
artifact, childRemoteRepositories, e );
|
||||
|
||||
}
|
||||
|
||||
ArtifactResolutionRequest subRequest = new ArtifactResolutionRequest( metadataRequest );
|
||||
|
@ -583,6 +601,7 @@ public class DefaultLegacyArtifactCollector
|
|||
subRequest.setProxies( request.getProxies() );
|
||||
recurse( result, child, resolvedArtifacts, managedVersions, subRequest, source, filter,
|
||||
listeners, conflictResolvers );
|
||||
|
||||
}
|
||||
}
|
||||
catch ( OverConstrainedVersionException e )
|
||||
|
@ -610,7 +629,6 @@ public class DefaultLegacyArtifactCollector
|
|||
// explicit child override depMgmt (viz. depMgmt should only
|
||||
// provide defaults to children, but should override transitives).
|
||||
// We can do this by calling isChildOfRootNode on the current node.
|
||||
|
||||
if ( ( artifact.getVersion() != null )
|
||||
&& ( !node.isChildOfRootNode() || node.getArtifact().getVersion() == null ) )
|
||||
{
|
||||
|
|
|
@ -42,19 +42,22 @@ import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver;
|
|||
public interface LegacyArtifactCollector
|
||||
{
|
||||
|
||||
ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, Map<String, Artifact> managedVersions,
|
||||
ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
|
||||
Map<String, Artifact> managedVersions,
|
||||
ArtifactResolutionRequest repositoryRequest, ArtifactMetadataSource source,
|
||||
ArtifactFilter filter, List<ResolutionListener> listeners,
|
||||
List<ConflictResolver> conflictResolvers );
|
||||
|
||||
ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, Map<String, Artifact> managedVersions,
|
||||
ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
|
||||
Map<String, Artifact> managedVersions,
|
||||
ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
|
||||
ArtifactMetadataSource source, ArtifactFilter filter,
|
||||
List<ResolutionListener> listeners, List<ConflictResolver> conflictResolvers );
|
||||
|
||||
// used by maven-dependency-tree and maven-dependency-plugin
|
||||
@Deprecated
|
||||
ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, Map<String, Artifact> managedVersions,
|
||||
ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
|
||||
Map<String, Artifact> managedVersions,
|
||||
ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
|
||||
ArtifactMetadataSource source, ArtifactFilter filter,
|
||||
List<ResolutionListener> listeners );
|
||||
|
|
|
@ -104,7 +104,8 @@ public class MetadataGraph
|
|||
*
|
||||
* @param tree "dirty" tree root
|
||||
* @param versionedVertices true if graph nodes should be versioned (different versions -> different nodes)
|
||||
* @param scopedVertices true if graph nodes should be versioned and scoped (different versions and/or scopes -> different nodes)
|
||||
* @param scopedVertices true if graph nodes should be versioned and scoped
|
||||
* (different versions and/or scopes -> different nodes)
|
||||
*
|
||||
*/
|
||||
public MetadataGraph( MetadataTreeNode tree, boolean versionedVertices, boolean scopedVertices )
|
||||
|
|
|
@ -88,7 +88,8 @@ public class MetadataGraphEdge
|
|||
MetadataGraphEdge e = (MetadataGraphEdge) o;
|
||||
|
||||
return objectsEqual( version, e.version )
|
||||
&& ArtifactScopeEnum.checkScope( scope ).getScope().equals( ArtifactScopeEnum.checkScope( e.scope ).getScope() )
|
||||
&& ArtifactScopeEnum.checkScope( scope ).getScope().
|
||||
equals( ArtifactScopeEnum.checkScope( e.scope ).getScope() )
|
||||
&& depth == e.depth;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -21,11 +21,11 @@ package org.apache.maven.repository.metadata;
|
|||
|
||||
/**
|
||||
* @author <a href="oleg@codehaus.org">Oleg Gusakov</a>
|
||||
*
|
||||
*/
|
||||
public class MetadataGraphTransformationException
|
||||
extends Exception
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -4029897098314019152L;
|
||||
|
||||
public MetadataGraphTransformationException()
|
||||
|
|
|
@ -38,7 +38,10 @@ import java.util.Map;
|
|||
public class ExpressionDocumenter
|
||||
{
|
||||
|
||||
private static final String[] EXPRESSION_ROOTS = { "project", "settings", "session", "plugin", "rootless" };
|
||||
private static final String[] EXPRESSION_ROOTS =
|
||||
{
|
||||
"project", "settings", "session", "plugin", "rootless"
|
||||
};
|
||||
|
||||
private static final String EXPRESSION_DOCO_ROOTPATH = "META-INF/maven/plugin-expressions/";
|
||||
|
||||
|
@ -53,10 +56,10 @@ public class ExpressionDocumenter
|
|||
|
||||
ClassLoader docLoader = initializeDocLoader();
|
||||
|
||||
for ( String EXPRESSION_ROOT : EXPRESSION_ROOTS )
|
||||
for ( String root : EXPRESSION_ROOTS )
|
||||
{
|
||||
try ( InputStream docStream = docLoader.getResourceAsStream(
|
||||
EXPRESSION_DOCO_ROOTPATH + EXPRESSION_ROOT + ".paramdoc.xml" ) )
|
||||
EXPRESSION_DOCO_ROOTPATH + root + ".paramdoc.xml" ) )
|
||||
{
|
||||
if ( docStream != null )
|
||||
{
|
||||
|
@ -68,12 +71,12 @@ public class ExpressionDocumenter
|
|||
catch ( IOException e )
|
||||
{
|
||||
throw new ExpressionDocumentationException(
|
||||
"Failed to read documentation for expression root: " + EXPRESSION_ROOT, e );
|
||||
"Failed to read documentation for expression root: " + root, e );
|
||||
}
|
||||
catch ( XmlPullParserException e )
|
||||
{
|
||||
throw new ExpressionDocumentationException(
|
||||
"Failed to parse documentation for expression root: " + EXPRESSION_ROOT, e );
|
||||
"Failed to parse documentation for expression root: " + root, e );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -161,7 +164,10 @@ public class ExpressionDocumenter
|
|||
"Cannot construct expression documentation classpath" + " resource base.", e );
|
||||
}
|
||||
|
||||
return new URLClassLoader( new URL[]{ docResource } );
|
||||
return new URLClassLoader( new URL[]
|
||||
{
|
||||
docResource
|
||||
} );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue