o Updated to remove errors reported by Checkstyle. Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/a99a7898 Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/a99a7898 Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/a99a7898
Branch: refs/heads/MNG-5359 Commit: a99a78984c1f20394abf6e76b6167b9e61e6163c Parents: 311fc62 Author: Christian Schulte <schu...@apache.org> Authored: Tue Jun 14 21:26:56 2016 +0200 Committer: Hervé Boutemy <hbout...@apache.org> Committed: Wed Jan 25 08:09:30 2017 +0100 ---------------------------------------------------------------------- .../UnknownRepositoryLayoutException.java | 2 +- .../DefaultArtifactRepositoryFactory.java | 4 +- .../repository/layout/FlatRepositoryLayout.java | 6 +- .../artifact/resolver/ArtifactResolver.java | 62 +++++++------- .../resolver/DefaultArtifactResolver.java | 12 ++- .../profiles/activation/ProfileActivator.java | 4 +- .../org/apache/maven/project/ProjectUtils.java | 15 ++-- .../AbstractStringBasedModelInterpolator.java | 22 +++-- .../StringSearchModelInterpolator.java | 14 ++-- .../project/path/DefaultPathTranslator.java | 10 +-- .../repository/MetadataResolutionResult.java | 8 +- .../repository/legacy/DefaultWagonManager.java | 85 +++++++++++++------- .../legacy/LegacyRepositorySystem.java | 31 ++++--- .../maven/repository/legacy/WagonManager.java | 6 +- .../repository/ArtifactRepositoryFactory.java | 6 +- .../DefaultLegacyArtifactCollector.java | 84 +++++++++++-------- .../resolver/LegacyArtifactCollector.java | 9 ++- .../repository/metadata/MetadataGraph.java | 3 +- .../repository/metadata/MetadataGraphEdge.java | 3 +- .../MetadataGraphTransformationException.java | 4 +- .../usability/plugin/ExpressionDocumenter.java | 18 +++-- 21 files changed, 236 insertions(+), 172 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java b/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java index 5abe110..e23bea9 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java @@ -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 http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java index 658dbda..0f69835 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java @@ -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 ) http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java index 8553a31..58143e0 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java @@ -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 = '.'; http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java index 7b5faa1..d36ebde 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java @@ -39,61 +39,60 @@ 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(); // USED BY SUREFIRE, DEPENDENCY PLUGIN @Deprecated - ArtifactResolutionResult resolveTransitively( - Set<Artifact> artifacts, Artifact originatingArtifact, - ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter ) + ArtifactResolutionResult resolveTransitively( + Set<Artifact> artifacts, Artifact originatingArtifact, + ArtifactRepository localRepository, + List<ArtifactRepository> remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter ) throws ArtifactResolutionException, ArtifactNotFoundException; // USED BY MAVEN ASSEMBLY PLUGIN @Deprecated - ArtifactResolutionResult resolveTransitively( - Set<Artifact> artifacts, Artifact originatingArtifact, - Map<String,Artifact> managedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source ) + ArtifactResolutionResult resolveTransitively( + Set<Artifact> artifacts, Artifact originatingArtifact, + Map<String, Artifact> managedVersions, ArtifactRepository localRepository, + List<ArtifactRepository> remoteRepositories, + ArtifactMetadataSource source ) throws ArtifactResolutionException, ArtifactNotFoundException; // USED BY MAVEN ASSEMBLY PLUGIN @Deprecated - ArtifactResolutionResult resolveTransitively( - Set<Artifact> artifacts, Artifact originatingArtifact, - Map<String,Artifact> managedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter ) + ArtifactResolutionResult resolveTransitively( + Set<Artifact> artifacts, Artifact originatingArtifact, + Map<String, Artifact> managedVersions, ArtifactRepository localRepository, + List<ArtifactRepository> remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter ) throws ArtifactResolutionException, ArtifactNotFoundException; // USED BY INVOKER PLUGIN @Deprecated - ArtifactResolutionResult resolveTransitively( - Set<Artifact> artifacts, Artifact originatingArtifact, - List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository, ArtifactMetadataSource source ) + ArtifactResolutionResult resolveTransitively( + Set<Artifact> artifacts, Artifact originatingArtifact, + List<ArtifactRepository> remoteRepositories, + ArtifactRepository localRepository, ArtifactMetadataSource source ) throws ArtifactResolutionException, ArtifactNotFoundException; @Deprecated - ArtifactResolutionResult resolveTransitively( - Set<Artifact> artifacts, Artifact originatingArtifact, - Map<String,Artifact> managedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter, - List<ResolutionListener> listeners ) + ArtifactResolutionResult resolveTransitively( + Set<Artifact> artifacts, Artifact originatingArtifact, + Map<String, Artifact> managedVersions, ArtifactRepository localRepository, + List<ArtifactRepository> remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter, + List<ResolutionListener> listeners ) throws ArtifactResolutionException, ArtifactNotFoundException; @Deprecated - ArtifactResolutionResult resolveTransitively( - Set<Artifact> artifacts, Artifact originatingArtifact, - List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository, ArtifactMetadataSource source, - List<ResolutionListener> listeners ) + ArtifactResolutionResult resolveTransitively( + Set<Artifact> artifacts, Artifact originatingArtifact, + List<ArtifactRepository> remoteRepositories, + ArtifactRepository localRepository, ArtifactMetadataSource source, + List<ResolutionListener> listeners ) throws ArtifactResolutionException, ArtifactNotFoundException; // USED BY REMOTE RESOURCES PLUGIN, DEPENDENCY PLUGIN, SHADE PLUGIN @@ -112,4 +111,5 @@ public interface ArtifactResolver void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository ) throws ArtifactResolutionException, ArtifactNotFoundException; + } http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java index 5e281c1..6a5f330 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -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() ); http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java index d0a9ecb..2688785 100644 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java +++ b/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java @@ -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; + } http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java b/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java index d15a892..72ea6d1 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java +++ b/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java @@ -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 ); http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java index 568196c..c40b164 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java +++ b/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java @@ -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; @@ -122,8 +123,9 @@ public abstract class AbstractStringBasedModelInterpolator * <br/> * <b>NOTE:</b> This will result in a different instance of Model being returned!!! * - * @param model The inbound Model instance, to serialize and reference for expression resolution + * @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( - PROJECT_PREFIXES, - TRANSLATED_PATH_EXPRESSIONS, - projectDir, - pathTranslator ) ); + return Collections.singletonList( + (InterpolationPostProcessor) new PathTranslatingPostProcessor( + PROJECT_PREFIXES, + TRANSLATED_PATH_EXPRESSIONS, + projectDir, + pathTranslator ) ); + } @SuppressWarnings( "unchecked" ) http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java index 13ceaf7..ecde27f 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java +++ b/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java @@ -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; } http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java b/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java index b4061ec..eb3f24d 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java +++ b/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java @@ -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 ) http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java b/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java index cfdd7f9..bd5436c 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java @@ -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; } http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java index 6fa72ce..b8835b5 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java @@ -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 // @@ -96,14 +104,15 @@ public class DefaultWagonManager if ( !policy.isEnabled() ) { logger.debug( "Skipping disabled repository " + repository.getId() + " for resolution of " - + artifact.getId() ); + + artifact.getId() ); + } else if ( artifact.isSnapshot() || !artifact.getFile().exists() ) { if ( force || updateCheckManager.isUpdateRequired( artifact, repository ) ) { logger.debug( "Trying repository " + repository.getId() + " for resolution of " + artifact.getId() - + " from " + remotePath ); + + " from " + remotePath ); try { @@ -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." ); + } } } @@ -174,7 +187,8 @@ public class DefaultWagonManager // because we want to cycle through them all before squawking. logger.debug( "Unable to find artifact " + artifact.getId() + " in repository " + repository.getId() - + " (" + repository.getUrl() + ")", e ); + + " (" + 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,13 +257,15 @@ 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(); - + headers.put( "User-Agent", ConfigUtils.getString( legacySupport.getRepositorySession(), "Maven", ConfigurationProperties.USER_AGENT ) ); try @@ -269,18 +287,21 @@ public class DefaultWagonManager if ( repository.getProxy() != null && logger.isDebugEnabled() ) { logger.debug( "Using proxy " + repository.getProxy().getHost() + ":" + repository.getProxy().getPort() - + " for " + repository.getUrl() ); + + " 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 @@ -522,7 +542,8 @@ public class DefaultWagonManager catch ( IOException e ) { throw new TransferFailedException( "Error copying temporary file to the final destination: " - + e.getMessage(), e ); + + 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 ); @@ -721,7 +742,7 @@ public class DefaultWagonManager // check for 'ALGO (name) = CHECKSUM' like used by openssl if ( expectedChecksum.regionMatches( true, 0, "MD", 0, 2 ) - || expectedChecksum.regionMatches( true, 0, "SHA", 0, 3 ) ) + || expectedChecksum.regionMatches( true, 0, "SHA", 0, 3 ) ) { int lastSpacePos = expectedChecksum.lastIndexOf( ' ' ); expectedChecksum = expectedChecksum.substring( lastSpacePos + 1 ); @@ -752,7 +773,8 @@ public class DefaultWagonManager else { throw new ChecksumFailedException( "Checksum failed on download: local = '" + actualChecksum - + "'; remote = '" + expectedChecksum + "'" ); + + "'; remote = '" + expectedChecksum + "'" ); + } } catch ( IOException e ) @@ -814,7 +836,8 @@ public class DefaultWagonManager catch ( ComponentLookupException e ) { throw new UnsupportedProtocolException( "Cannot find wagon which supports the requested protocol: " - + protocol, e ); + + protocol, e ); + } return wagon; http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java index 866968b..f8d4531 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java @@ -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 ) { http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java index 73ead26..35fcf42 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java @@ -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 ) http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java index b982f91..aeb5739 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java @@ -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 ); http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java index 77fc705..4601eee 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java @@ -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 ); @@ -314,25 +321,29 @@ public class DefaultLegacyArtifactCollector { resetArtifact.setDependencyTrail( node.getDependencyTrail() ); throw new ArtifactResolutionException( - "Unable to get dependency information: " - + e.getMessage(), resetArtifact, - request.getRemoteRepositories(), e ); + "Unable to get dependency information: " + + 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 ); } @@ -363,8 +377,9 @@ public class DefaultLegacyArtifactCollector { // TODO: add better exception result.addVersionRangeViolation( new ArtifactResolutionException( - "Conflict resolver returned unknown resolution node: ", - resolved.getArtifact() ) ); + "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, - childRemoteRepositories ); + "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,10 +552,10 @@ public class DefaultLegacyArtifactCollector break; } } - while( !childKey.equals( child.getKey() ) ); + while ( !childKey.equals( child.getKey() ) ); if ( parentArtifact != null && parentArtifact.getDependencyFilter() != null - && !parentArtifact.getDependencyFilter().include( artifact ) ) + && !parentArtifact.getDependencyFilter().include( artifact ) ) { // MNG-3769: the [probably relocated] artifact is excluded. // We could process exclusions on relocated artifact details in the @@ -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,9 +629,8 @@ 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 ) ) + && ( !node.isChildOfRootNode() || node.getArtifact().getVersion() == null ) ) { fireEvent( ResolutionListener.MANAGE_ARTIFACT_VERSION, listeners, node, artifact ); node.getArtifact().setVersion( artifact.getVersion() ); @@ -625,7 +643,7 @@ public class DefaultLegacyArtifactCollector } if ( Artifact.SCOPE_SYSTEM.equals( node.getArtifact().getScope() ) && ( node.getArtifact().getFile() == null ) - && ( artifact.getFile() != null ) ) + && ( artifact.getFile() != null ) ) { fireEvent( ResolutionListener.MANAGE_ARTIFACT_SYSTEM_PATH, listeners, node, artifact ); node.getArtifact().setFile( artifact.getFile() ); @@ -648,15 +666,15 @@ public class DefaultLegacyArtifactCollector /* farthest is runtime and nearest has lower priority, change to runtime */ if ( Artifact.SCOPE_RUNTIME.equals( farthestArtifact.getScope() ) - && ( Artifact.SCOPE_TEST.equals( nearestArtifact.getScope() ) - || Artifact.SCOPE_PROVIDED.equals( nearestArtifact.getScope() ) ) ) + && ( Artifact.SCOPE_TEST.equals( nearestArtifact.getScope() ) + || Artifact.SCOPE_PROVIDED.equals( nearestArtifact.getScope() ) ) ) { updateScope = true; } /* farthest is compile and nearest is not (has lower priority), change to compile */ if ( Artifact.SCOPE_COMPILE.equals( farthestArtifact.getScope() ) - && !Artifact.SCOPE_COMPILE.equals( nearestArtifact.getScope() ) ) + && !Artifact.SCOPE_COMPILE.equals( nearestArtifact.getScope() ) ) { updateScope = true; } @@ -762,7 +780,7 @@ public class DefaultLegacyArtifactCollector break; case ResolutionListener.RESTRICT_RANGE: if ( node.getArtifact().getVersionRange().hasRestrictions() - || replacement.getVersionRange().hasRestrictions() ) + || replacement.getVersionRange().hasRestrictions() ) { listener.restrictRange( node.getArtifact(), replacement, newRange ); } http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java index 133bd58..4045258 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java @@ -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 ); http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java index 3f13888..4bcca4c 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java @@ -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 ) http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java index 5f16df0..5a4c106 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java @@ -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; http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java index 16a34a8..7861b48 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java @@ -21,12 +21,12 @@ package org.apache.maven.repository.metadata; /** * @author <a href="o...@codehaus.org">Oleg Gusakov</a> - * */ public class MetadataGraphTransformationException extends Exception { - private static final long serialVersionUID = -4029897098314019152L; + + private static final long serialVersionUID = -4029897098314019152L; public MetadataGraphTransformationException() { http://git-wip-us.apache.org/repos/asf/maven/blob/a99a7898/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java ---------------------------------------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java b/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java index 65bd9cf..b5e606d 100644 --- a/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java +++ b/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java @@ -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 + } ); } }