From f82432e6060ac9327c2ddaf5740e529bee68b151 Mon Sep 17 00:00:00 2001 From: Andrzej Jarmoniuk Date: Fri, 25 Nov 2022 15:36:37 +0100 Subject: [PATCH] #704: Remove WagonManager --- pom.xml | 1 - versions-common/pom.xml | 13 - .../versions/api/DefaultVersionsHelper.java | 457 ++++++++++-------- .../mojo/versions/utils/WagonUtils.java | 112 ----- .../api/DefaultVersionsHelperTest.java | 40 +- .../enforcer/MaxDependencyUpdates.java | 11 +- .../markdown/max-dependency-updates.md.vm | 2 +- ...AbstractVersionsDependencyUpdaterMojo.java | 6 +- .../versions/AbstractVersionsDisplayMojo.java | 6 +- .../mojo/versions/AbstractVersionsReport.java | 35 +- .../versions/AbstractVersionsUpdaterMojo.java | 20 +- .../versions/CompareDependenciesMojo.java | 7 +- .../versions/DependencyUpdatesReportMojo.java | 6 +- .../DisplayDependencyUpdatesMojo.java | 6 +- .../versions/DisplayParentUpdatesMojo.java | 6 +- .../versions/DisplayPluginUpdatesMojo.java | 6 +- .../versions/DisplayPropertyUpdatesMojo.java | 6 +- .../mojo/versions/ForceReleasesMojo.java | 6 +- .../mojo/versions/LockSnapshotsMojo.java | 6 +- .../versions/ParentUpdatesReportMojo.java | 7 +- .../versions/PluginUpdatesReportMojo.java | 6 +- .../versions/PropertyUpdatesReportMojo.java | 6 +- .../mojo/versions/ResolveRangesMojo.java | 6 +- .../org/codehaus/mojo/versions/SetMojo.java | 6 +- .../mojo/versions/SetPropertyMojo.java | 6 +- .../codehaus/mojo/versions/SetScmTagMojo.java | 6 +- .../mojo/versions/UnlockSnapshotsMojo.java | 6 +- .../mojo/versions/UpdateChildModulesMojo.java | 6 +- .../mojo/versions/UpdateParentMojo.java | 6 +- .../mojo/versions/UpdatePropertiesMojo.java | 6 +- .../mojo/versions/UpdatePropertyMojo.java | 6 +- .../mojo/versions/UseDepVersionMojo.java | 6 +- .../mojo/versions/UseLatestReleasesMojo.java | 6 +- .../mojo/versions/UseLatestSnapshotsMojo.java | 6 +- .../mojo/versions/UseLatestVersionsMojo.java | 6 +- .../versions/UseLatestVersionsMojoBase.java | 6 +- .../mojo/versions/UseNextReleasesMojo.java | 6 +- .../mojo/versions/UseNextSnapshotsMojo.java | 6 +- .../mojo/versions/UseNextVersionsMojo.java | 6 +- .../mojo/versions/UseReactorMojo.java | 6 +- .../mojo/versions/UseReleasesMojo.java | 6 +- 41 files changed, 423 insertions(+), 462 deletions(-) delete mode 100644 versions-common/src/main/java/org/codehaus/mojo/versions/utils/WagonUtils.java diff --git a/pom.xml b/pom.xml index ae0e574a9a..9ea4a7ea1c 100644 --- a/pom.xml +++ b/pom.xml @@ -127,7 +127,6 @@ ${mojo.java.target} 5.9.1 3.2.5 - 3.5.2 1.11.1 1.11.1 ${project.version} diff --git a/versions-common/pom.xml b/versions-common/pom.xml index 365dba0074..5b791a896b 100644 --- a/versions-common/pom.xml +++ b/versions-common/pom.xml @@ -63,25 +63,12 @@ ${mavenVersion} provided - - org.apache.maven.wagon - wagon-provider-api - ${wagonVersion} - provided - com.fasterxml.woodstox woodstox-core test - - - org.apache.maven.wagon - wagon-file - ${wagonVersion} - test - org.apache.commons commons-lang3 diff --git a/versions-common/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java b/versions-common/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java index c948b7d635..f43a555700 100644 --- a/versions-common/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java +++ b/versions-common/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java @@ -20,11 +20,12 @@ */ import java.io.BufferedInputStream; -import java.io.File; import java.io.IOException; -import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Files; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -35,6 +36,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; @@ -49,7 +51,6 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; @@ -61,14 +62,10 @@ import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; import org.apache.maven.repository.RepositorySystem; -import org.apache.maven.settings.Settings; -import org.apache.maven.wagon.ConnectionException; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.TransferFailedException; -import org.apache.maven.wagon.UnsupportedProtocolException; import org.apache.maven.wagon.Wagon; -import org.apache.maven.wagon.authentication.AuthenticationException; -import org.apache.maven.wagon.authorization.AuthorizationException; +import org.apache.maven.wagon.authentication.AuthenticationInfo; +import org.apache.maven.wagon.observers.Debug; +import org.apache.maven.wagon.proxy.ProxyInfo; import org.codehaus.mojo.versions.model.IgnoreVersion; import org.codehaus.mojo.versions.model.Rule; import org.codehaus.mojo.versions.model.RuleSet; @@ -80,16 +77,21 @@ import org.codehaus.mojo.versions.utils.PluginComparator; import org.codehaus.mojo.versions.utils.RegexUtils; import org.codehaus.mojo.versions.utils.VersionsExpressionEvaluator; -import org.codehaus.mojo.versions.utils.WagonUtils; import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.eclipse.aether.repository.AuthenticationContext; +import org.eclipse.aether.repository.RemoteRepository; import org.eclipse.aether.resolution.ArtifactRequest; import org.eclipse.aether.resolution.ArtifactResult; import org.eclipse.aether.resolution.VersionRangeRequest; import org.eclipse.aether.resolution.VersionRangeResolutionException; +import static java.util.Collections.singletonList; +import static java.util.Optional.empty; +import static java.util.Optional.of; +import static java.util.Optional.ofNullable; import static org.apache.maven.RepositoryUtils.toArtifact; /** @@ -143,7 +145,6 @@ public class DefaultVersionsHelper * @since 2.12 */ private final Map artifactBestFitRule = new HashMap<>(); - /** * Private constructor used by the builder */ @@ -151,43 +152,6 @@ private DefaultVersionsHelper() { } - @Deprecated - private static RuleSet getRuleSet( Wagon wagon, String remoteURI ) - throws IOException, AuthorizationException, TransferFailedException, ResourceDoesNotExistException - { - File tempFile = File.createTempFile( "ruleset", ".xml" ); - try - { - wagon.get( remoteURI, tempFile ); - try ( InputStream is = Files.newInputStream( tempFile.toPath() ) ) - { - return readRulesFromStream( is ); - } - } - finally - { - if ( !tempFile.delete() ) - { - // maybe we can delete this later - tempFile.deleteOnExit(); - } - } - } - - private static RuleSet readRulesFromStream( InputStream stream ) - throws IOException - { - RuleXpp3Reader reader = new RuleXpp3Reader(); - try ( BufferedInputStream bis = new BufferedInputStream( stream ) ) - { - return reader.read( bis ); - } - catch ( XmlPullParserException e ) - { - throw new IOException( e ); - } - } - static boolean exactMatch( String wildcardRule, String value ) { Pattern p = Pattern.compile( RegexUtils.convertWildcardsToRegex( wildcardRule, true ) ); @@ -200,149 +164,6 @@ static boolean match( String wildcardRule, String value ) return p.matcher( value ).matches(); } - /** - *

Creates the enriched version of the ruleSet given as parameter; the ruleSet will contain the - * set of ignored versions passed on top of its own (if defined).

- * - *

If the {@code originalRuleSet} is {@code null}, a new {@linkplain RuleSet} will be created as - * a result.

- * - *

The method does not change the {@code originalRuleSet} object.

- * - * @param ignoredVersions collection of ignored version to enrich the clone of the original rule set - * @param originalRuleSet original rule set - * @return new RuleSet object containing the (if passed) cloned version of the rule set, enriched with - * the given set of ignored versions - */ - @SuppressWarnings( "checkstyle:AvoidNestedBlocks" ) - private static RuleSet enrichRuleSet( Collection ignoredVersions, RuleSet originalRuleSet ) - { - RuleSet ruleSet = new RuleSet(); - if ( originalRuleSet != null ) - { - ruleSet.setComparisonMethod( originalRuleSet.getComparisonMethod() ); - if ( originalRuleSet.getRules() != null ) - { - ruleSet.setRules( new ArrayList<>( originalRuleSet.getRules() ) ); - } - if ( originalRuleSet.getIgnoreVersions() != null ) - { - ruleSet.setIgnoreVersions( new ArrayList<>( originalRuleSet.getIgnoreVersions() ) ); - } - } - - if ( ruleSet.getIgnoreVersions() == null ) - { - ruleSet.setIgnoreVersions( new ArrayList<>() ); - } - ruleSet.getIgnoreVersions().addAll( ignoredVersions.stream().map( v -> - { - IgnoreVersion ignoreVersion = new IgnoreVersion(); - ignoreVersion.setType( TYPE_REGEX ); - ignoreVersion.setVersion( v ); - return ignoreVersion; - } ).collect( Collectors.toList() ) ); - - return ruleSet; - } - - private static RuleSet getRulesFromClasspath( String uri, Log logger ) - throws MojoExecutionException - { - logger.debug( "Going to load rules from \"" + uri + "\"" ); - - String choppedUrl = uri.substring( CLASSPATH_PROTOCOL.length() + 3 ); - - URL url = DefaultVersionsHelper.class.getResource( choppedUrl ); - - if ( null == url ) - { - String message = "Resource \"" + uri + "\" not found in classpath."; - - throw new MojoExecutionException( message ); - } - - try - { - RuleSet rules = readRulesFromStream( url.openStream() ); - logger.debug( "Loaded rules from \"" + uri + "\" successfully" ); - return rules; - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Could not load specified rules from " + uri, e ); - } - } - - private static RuleSet getRulesViaWagon( String rulesUri, Log logger, String serverId, String id, - WagonManager wagonManager, Settings settings ) - throws MojoExecutionException - { - RuleSet loadedRules; - - int split = rulesUri.lastIndexOf( '/' ); - String baseUri = rulesUri; - String fileUri = ""; - - if ( split != -1 ) - { - baseUri = rulesUri.substring( 0, split ) + '/'; - fileUri = split + 1 < rulesUri.length() ? rulesUri.substring( split + 1 ) : ""; - } - - try - { - Wagon wagon = WagonUtils.createWagon( serverId, baseUri, wagonManager, settings, logger ); - try - { - logger.debug( "Trying to load ruleset from file \"" + fileUri + "\" in " + baseUri ); - loadedRules = getRuleSet( wagon, fileUri ); - } - finally - { - logger.debug( "Rule set loaded" ); - - if ( wagon != null ) - { - try - { - wagon.disconnect(); - } - catch ( ConnectionException e ) - { - logger.warn( "Could not disconnect wagon!", e ); - } - } - } - } - catch ( TransferFailedException e ) - { - throw new MojoExecutionException( "Could not transfer rules from " + rulesUri, e ); - } - catch ( AuthorizationException e ) - { - throw new MojoExecutionException( "Authorization failure trying to load rules from " + rulesUri, e ); - } - catch ( ResourceDoesNotExistException | IOException e ) - { - throw new MojoExecutionException( "Could not load specified rules from " + rulesUri, e ); - } - catch ( AuthenticationException e ) - { - throw new MojoExecutionException( "Authentication failure trying to load rules from " + rulesUri, e ); - } - catch ( UnsupportedProtocolException e ) - { - throw new MojoExecutionException( "Unsupported protocol for " + rulesUri, e ); - } - catch ( ConnectionException e ) - { - throw new MojoExecutionException( "Could not establish connection to " + rulesUri, e ); - } - - return loadedRules; - } - static boolean isClasspathUri( String uri ) { return ( uri != null && uri.startsWith( CLASSPATH_PROTOCOL + ":" ) ); @@ -863,18 +684,251 @@ public static class Builder private RepositorySystem repositorySystem; private Collection ignoredVersions; private RuleSet ruleSet; - private WagonManager wagonManager; private String serverId; private String rulesUri; private Log log; private MavenSession mavenSession; private MojoExecution mojoExecution; private org.eclipse.aether.RepositorySystem aetherRepositorySystem; + private Map wagonMap; public Builder() { } + private static RuleSet getRulesFromClasspath( String uri, Log logger ) + throws MojoExecutionException + { + logger.debug( "Going to load rules from \"" + uri + "\"" ); + String choppedUrl = uri.substring( CLASSPATH_PROTOCOL.length() + 3 ); + URL url = DefaultVersionsHelper.class.getResource( choppedUrl ); + if ( url == null ) + { + throw new MojoExecutionException( "Resource \"" + uri + "\" not found in classpath." ); + } + + try ( BufferedInputStream bis = new BufferedInputStream( url.openStream() ) ) + { + RuleSet result = new RuleXpp3Reader().read( bis ); + logger.debug( "Loaded rules from \"" + uri + "\" successfully" ); + return result; + } + catch ( IOException | XmlPullParserException e ) + { + throw new MojoExecutionException( "Could not load specified rules from " + uri, e ); + } + } + + /** + *

Creates the enriched version of the ruleSet given as parameter; the ruleSet will contain the + * set of ignored versions passed on top of its own (if defined).

+ * + *

If the {@code originalRuleSet} is {@code null}, a new {@linkplain RuleSet} will be created as + * a result.

+ * + *

The method does not change the {@code originalRuleSet} object.

+ * + * @param ignoredVersions collection of ignored version to enrich the clone of the original rule set + * @param originalRuleSet original rule set + * @return new RuleSet object containing the (if passed) cloned version of the rule set, enriched with + * the given set of ignored versions + */ + @SuppressWarnings( "checkstyle:AvoidNestedBlocks" ) + private static RuleSet enrichRuleSet( Collection ignoredVersions, RuleSet originalRuleSet ) + { + RuleSet ruleSet = new RuleSet(); + if ( originalRuleSet != null ) + { + ruleSet.setComparisonMethod( originalRuleSet.getComparisonMethod() ); + if ( originalRuleSet.getRules() != null ) + { + ruleSet.setRules( new ArrayList<>( originalRuleSet.getRules() ) ); + } + if ( originalRuleSet.getIgnoreVersions() != null ) + { + ruleSet.setIgnoreVersions( new ArrayList<>( originalRuleSet.getIgnoreVersions() ) ); + } + } + + if ( ruleSet.getIgnoreVersions() == null ) + { + ruleSet.setIgnoreVersions( new ArrayList<>() ); + } + ruleSet.getIgnoreVersions().addAll( ignoredVersions.stream().map( v -> + { + IgnoreVersion ignoreVersion = new IgnoreVersion(); + ignoreVersion.setType( TYPE_REGEX ); + ignoreVersion.setVersion( v ); + return ignoreVersion; + } ).collect( Collectors.toList() ) ); + + return ruleSet; + } + + private static class RulesUri + { + URI baseUri; + String resource; + + private RulesUri( URI baseUri, String resource ) + { + this.baseUri = baseUri; + this.resource = resource; + } + + static RulesUri build( String rulesUri ) throws URISyntaxException + { + int split = rulesUri.lastIndexOf( '/' ); + return split == -1 + ? new RulesUri( new URI( rulesUri ), "" ) + : new RulesUri( new URI( rulesUri.substring( 0, split ) + '/' ), + split + 1 < rulesUri.length() + ? rulesUri.substring( split + 1 ) + : "" ); + } + } + + private RemoteRepository remoteRepository( RulesUri uri ) + { + RemoteRepository prototype = new RemoteRepository.Builder( serverId, uri.baseUri.getScheme(), + uri.baseUri.toString() ).build(); + RemoteRepository.Builder builder = new RemoteRepository.Builder( prototype ); + ofNullable( mavenSession.getRepositorySession().getProxySelector().getProxy( prototype ) ) + .ifPresent( builder::setProxy ); + ofNullable( mavenSession.getRepositorySession().getAuthenticationSelector().getAuthentication( prototype ) ) + .ifPresent( builder::setAuthentication ); + ofNullable( mavenSession.getRepositorySession().getMirrorSelector().getMirror( prototype ) ) + .ifPresent( mirror -> builder.setMirroredRepositories( singletonList( mirror ) ) ); + return builder.build(); + } + + private Optional getProxyInfo( RemoteRepository repository ) + { + return ofNullable( repository.getProxy() ) + .map( proxy -> new ProxyInfo() + {{ + setHost( proxy.getHost() ); + setPort( proxy.getPort() ); + setType( proxy.getType() ); + ofNullable( proxy.getAuthentication() ) + .ifPresent( auth -> + { + try ( AuthenticationContext authCtx = AuthenticationContext + .forProxy( mavenSession.getRepositorySession(), repository ) ) + { + ofNullable( authCtx.get( AuthenticationContext.USERNAME ) ) + .ifPresent( this::setUserName ); + ofNullable( authCtx.get( AuthenticationContext.PASSWORD ) ) + .ifPresent( this::setPassword ); + ofNullable( authCtx.get( AuthenticationContext.NTLM_DOMAIN ) ) + .ifPresent( this::setNtlmDomain ); + ofNullable( authCtx.get( AuthenticationContext + .NTLM_WORKSTATION ) ).ifPresent( this::setNtlmHost ); + } + } ); + }} ); + } + + private Optional getAuthenticationInfo( RemoteRepository repository ) + { + return ofNullable( repository.getAuthentication() ) + .map( authentication -> new AuthenticationInfo() + {{ + try ( AuthenticationContext authCtx = AuthenticationContext + .forProxy( mavenSession.getRepositorySession(), repository ) ) + { + ofNullable( authCtx.get( AuthenticationContext.USERNAME ) ) + .ifPresent( this::setUserName ); + ofNullable( authCtx.get( AuthenticationContext.PASSWORD ) ) + .ifPresent( this::setPassword ); + ofNullable( authCtx.get( AuthenticationContext.PRIVATE_KEY_PASSPHRASE ) ) + .ifPresent( this::setPassphrase ); + ofNullable( authCtx.get( AuthenticationContext.PRIVATE_KEY_PATH ) ) + .ifPresent( this::setPrivateKey ); + } + }} ); + } + + private org.apache.maven.wagon.repository.Repository wagonRepository( RemoteRepository repository ) + { + return new org.apache.maven.wagon.repository.Repository( repository.getId(), repository.getUrl() ); + } + + private RuleSet getRulesUsingWagon() throws MojoExecutionException + { + RulesUri uri; + try + { + uri = RulesUri.build( rulesUri ); + } + catch ( URISyntaxException e ) + { + log.warn( "Invalid rulesUri protocol: " + e.getMessage() ); + return null; + } + + RemoteRepository repository = remoteRepository( uri ); + return ofNullable( wagonMap.get( repository.getProtocol() ) ) + .map( wagon -> + { + if ( log.isDebugEnabled() ) + { + Debug debug = new Debug(); + wagon.addSessionListener( debug ); + wagon.addTransferListener( debug ); + } + + try + { + Optional proxyInfo = getProxyInfo( repository ); + Optional authenticationInfo = getAuthenticationInfo( repository ); + if ( log.isDebugEnabled() ) + { + log.debug( "Connecting to remote repository \"" + repository.getId() + "\"" + + proxyInfo.map( pi -> " using proxy " + pi.getHost() + ":" + + pi.getPort() ).orElse( "" ) + + authenticationInfo.map( ai -> " as " + ai.getUserName() ).orElse( "" ) ); + } + wagon.connect( wagonRepository( repository ), getAuthenticationInfo( repository ) + .orElse( null ), getProxyInfo( repository ).orElse( null ) ); + try + { + Path tempFile = Files.createTempFile( "rules-", ".xml" ); + wagon.get( uri.resource, tempFile.toFile() ); + try ( BufferedInputStream is = new BufferedInputStream( + Files.newInputStream( tempFile ) ) ) + { + return new RuleXpp3Reader().read( is ); + } + finally + { + Files.deleteIfExists( tempFile ); + } + + } + finally + { + wagon.disconnect(); + } + } + catch ( Exception e ) + { + log.warn( e.getMessage() ); + return null; + } + } ) + .orElseThrow( () -> new MojoExecutionException( "Could not load specified rules from " + + rulesUri ) ); + } + + public static Optional protocol( final String url ) + { + int pos = url.indexOf( ":" ); + return pos == -1 + ? empty() + : of( url.substring( 0, pos ).trim() ); + } + public Builder withRepositorySystem( RepositorySystem repositorySystem ) { this.repositorySystem = repositorySystem; @@ -893,12 +947,6 @@ public Builder withRuleSet( RuleSet ruleSet ) return this; } - public Builder withWagonManager( WagonManager wagonManager ) - { - this.wagonManager = wagonManager; - return this; - } - public Builder withServerId( String serverId ) { this.serverId = serverId; @@ -935,10 +983,16 @@ public Builder withAetherRepositorySystem( org.eclipse.aether.RepositorySystem a return this; } + public Builder withWagonMap( Map wagonMap ) + { + this.wagonMap = wagonMap; + return this; + } + /** * Builds the constructed {@linkplain DefaultVersionsHelper} object * @return constructed {@linkplain DefaultVersionsHelper} - * @throws MojoExecutionException should the constructor with the Wagon go wrong + * @throws MojoExecutionException should the constructor with the RuleSet retrieval doesn't succeed */ public DefaultVersionsHelper build() throws MojoExecutionException { @@ -960,8 +1014,7 @@ public DefaultVersionsHelper build() throws MojoExecutionException ? new RuleSet() : isClasspathUri( rulesUri ) ? getRulesFromClasspath( rulesUri, log ) - : getRulesViaWagon( rulesUri, log, serverId, serverId, wagonManager, - mavenSession.getSettings() ); + : getRulesUsingWagon(); } if ( ignoredVersions != null && !ignoredVersions.isEmpty() ) { diff --git a/versions-common/src/main/java/org/codehaus/mojo/versions/utils/WagonUtils.java b/versions-common/src/main/java/org/codehaus/mojo/versions/utils/WagonUtils.java deleted file mode 100644 index 5e02e041b2..0000000000 --- a/versions-common/src/main/java/org/codehaus/mojo/versions/utils/WagonUtils.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.codehaus.mojo.versions.utils; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.maven.artifact.manager.WagonManager; -import org.apache.maven.plugin.logging.Log; -import org.apache.maven.repository.legacy.WagonConfigurationException; -import org.apache.maven.settings.Proxy; -import org.apache.maven.settings.Settings; -import org.apache.maven.wagon.ConnectionException; -import org.apache.maven.wagon.UnsupportedProtocolException; -import org.apache.maven.wagon.Wagon; -import org.apache.maven.wagon.authentication.AuthenticationException; -import org.apache.maven.wagon.observers.Debug; -import org.apache.maven.wagon.proxy.ProxyInfo; -import org.apache.maven.wagon.repository.Repository; - -/** - * Utility methods to help with using {@link Wagon}s. - * - * @author Stephen Connolly - * @since 1.0-alpha-3 - */ -public final class WagonUtils -{ - private WagonUtils() - { - throw new IllegalAccessError( "Utility classes should never be instantiated" ); - } - - /** - * Convenience method to convert the {@link org.apache.maven.settings.Proxy} object from a - * {@link org.apache.maven.settings.Settings} into a {@link org.apache.maven.wagon.proxy.ProxyInfo}. - * - * @param settings The settings to use. - * @return The proxy details from the settings or null if the settings do not define a proxy. - */ - public static ProxyInfo getProxyInfo( Settings settings ) - { - ProxyInfo proxyInfo = null; - if ( settings != null && settings.getActiveProxy() != null ) - { - proxyInfo = new ProxyInfo(); - final Proxy proxy = settings.getActiveProxy(); - proxyInfo.setHost( proxy.getHost() ); - proxyInfo.setType( proxy.getProtocol() ); - proxyInfo.setPort( proxy.getPort() ); - proxyInfo.setNonProxyHosts( proxy.getNonProxyHosts() ); - proxyInfo.setUserName( proxy.getUsername() ); - proxyInfo.setPassword( proxy.getPassword() ); - } - return proxyInfo; - } - - /** - * Convenience method to create a wagon. - * - * @param serverId The serverId to use if the wagonManager needs help. - * @param url The url to create a wagon for. - * @param wagonManager The wgaon manager to use. - * @param settings The settings to use. - * @param logger The logger to use. - * @return The wagon to connect to the url. - * @throws org.apache.maven.wagon.UnsupportedProtocolException if the protocol is not supported. - * @throws org.apache.maven.repository.legacy.WagonConfigurationException if the wagon cannot be configured. - * @throws org.apache.maven.wagon.ConnectionException If the connection cannot be established. - * @throws org.apache.maven.wagon.authentication.AuthenticationException If the connection cannot be authenticated. - */ - public static Wagon createWagon( String serverId, String url, WagonManager wagonManager, Settings settings, - Log logger ) - throws UnsupportedProtocolException, WagonConfigurationException, - ConnectionException, AuthenticationException - { - Repository repository = new Repository( serverId, url ); - Wagon wagon = wagonManager.getWagon( repository ); - - if ( logger.isDebugEnabled() ) - { - Debug debug = new Debug(); - wagon.addSessionListener( debug ); - wagon.addTransferListener( debug ); - } - - ProxyInfo proxyInfo = getProxyInfo( settings ); - if ( proxyInfo != null ) - { - wagon.connect( repository, wagonManager.getAuthenticationInfo( repository.getId() ), proxyInfo ); - } - else - { - wagon.connect( repository, wagonManager.getAuthenticationInfo( repository.getId() ) ); - } - return wagon; - } -} diff --git a/versions-common/src/test/java/org/codehaus/mojo/versions/api/DefaultVersionsHelperTest.java b/versions-common/src/test/java/org/codehaus/mojo/versions/api/DefaultVersionsHelperTest.java index a4ece27ace..47ee52d3ac 100644 --- a/versions-common/src/test/java/org/codehaus/mojo/versions/api/DefaultVersionsHelperTest.java +++ b/versions-common/src/test/java/org/codehaus/mojo/versions/api/DefaultVersionsHelperTest.java @@ -19,6 +19,10 @@ * under the License. */ +import java.io.File; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -27,7 +31,6 @@ import java.util.stream.Collectors; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.MojoExecution; @@ -38,25 +41,39 @@ import org.apache.maven.plugin.testing.stubs.DefaultArtifactHandlerStub; import org.apache.maven.project.MavenProject; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.ConnectionException; +import org.apache.maven.wagon.ResourceDoesNotExistException; +import org.apache.maven.wagon.TransferFailedException; +import org.apache.maven.wagon.Wagon; +import org.apache.maven.wagon.authentication.AuthenticationException; +import org.apache.maven.wagon.authentication.AuthenticationInfo; +import org.apache.maven.wagon.authorization.AuthorizationException; +import org.apache.maven.wagon.proxy.ProxyInfo; import org.codehaus.mojo.versions.model.IgnoreVersion; import org.codehaus.mojo.versions.model.Rule; import org.codehaus.mojo.versions.model.RuleSet; import org.codehaus.mojo.versions.ordering.VersionComparators; import org.codehaus.mojo.versions.utils.VersionStub; +import org.eclipse.aether.DefaultRepositorySystemSession; import org.eclipse.aether.resolution.VersionRangeRequest; import org.eclipse.aether.resolution.VersionRangeResult; import org.eclipse.aether.version.Version; import org.hamcrest.CoreMatchers; import org.junit.Test; +import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; +import static java.util.Collections.singletonMap; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; import static org.hamcrest.core.IsIterableContaining.hasItems; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.any; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -65,7 +82,6 @@ */ public class DefaultVersionsHelperTest extends AbstractMojoTestCase { - @Test public void testPerRuleVersionsIgnored() throws Exception { @@ -217,6 +233,22 @@ private DefaultVersionsHelper createHelper() return createHelper( null ); } + private static Wagon mockFileWagon( URI rulesUri ) + throws AuthenticationException, ConnectionException, AuthorizationException, TransferFailedException, + ResourceDoesNotExistException + { + Wagon fileWagon = mock( Wagon.class ); + doNothing().when( fileWagon ).connect( any( org.apache.maven.wagon.repository.Repository.class ), + any( AuthenticationInfo.class ), any( ProxyInfo.class ) ); + doAnswer( i -> + { + File tempFile = i.getArgument( 1 ); + Files.copy( Paths.get( rulesUri ), tempFile.toPath(), REPLACE_EXISTING ); + return null; + } ).when( fileWagon ).get( anyString(), any( File.class ) ); + return fileWagon; + } + private DefaultVersionsHelper createHelper( org.eclipse.aether.RepositorySystem aetherRepositorySystem ) throws Exception { @@ -228,10 +260,12 @@ private DefaultVersionsHelper createHelper( org.eclipse.aether.RepositorySystem .thenReturn( emptyList() ); when( mavenSession.getCurrentProject().getRemotePluginRepositories() ) .thenReturn( emptyList() ); + when( mavenSession.getRepositorySession() ).thenReturn( new DefaultRepositorySystemSession() ); + return new DefaultVersionsHelper.Builder() .withRepositorySystem( lookup( RepositorySystem.class ) ) .withAetherRepositorySystem( aetherRepositorySystem ) - .withWagonManager( lookup( WagonManager.class ) ) + .withWagonMap( singletonMap( "file", mockFileWagon( new URI( rulesUri ) ) ) ) .withServerId( "" ) .withRulesUri( rulesUri ) .withLog( mock( Log.class ) ) diff --git a/versions-enforcer/src/main/java/org/apache/maven/plugins/enforcer/MaxDependencyUpdates.java b/versions-enforcer/src/main/java/org/apache/maven/plugins/enforcer/MaxDependencyUpdates.java index 58ea699d1e..2895596b70 100644 --- a/versions-enforcer/src/main/java/org/apache/maven/plugins/enforcer/MaxDependencyUpdates.java +++ b/versions-enforcer/src/main/java/org/apache/maven/plugins/enforcer/MaxDependencyUpdates.java @@ -19,13 +19,13 @@ */ import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Optional; import java.util.Set; import java.util.TreeSet; import java.util.stream.Collectors; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.enforcer.rule.api.EnforcerLevel; import org.apache.maven.enforcer.rule.api.EnforcerRule; @@ -38,6 +38,7 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.DefaultVersionsHelper; import org.codehaus.mojo.versions.api.Segment; @@ -276,7 +277,13 @@ private static VersionsHelper createVersionsHelper( EnforcerRuleHelper ruleHelpe return new DefaultVersionsHelper.Builder() .withRepositorySystem( ruleHelper.getComponent( RepositorySystem.class ) ) .withAetherRepositorySystem( ruleHelper.getComponent( org.eclipse.aether.RepositorySystem.class ) ) - .withWagonManager( ruleHelper.getComponent( WagonManager.class ) ) + .withWagonMap( ruleHelper.getComponentMap( Wagon.class.getName() ) + .entrySet() + .parallelStream() + .filter( e -> e.getValue() instanceof Wagon ) + .collect( HashMap::new, + ( m, e ) -> m.put( e.getKey(), (Wagon) e.getValue() ), + HashMap::putAll ) ) .withServerId( serverId ) .withRulesUri( rulesUri ) .withRuleSet( ruleSet ) diff --git a/versions-enforcer/src/site/markdown/max-dependency-updates.md.vm b/versions-enforcer/src/site/markdown/max-dependency-updates.md.vm index 26100debeb..d5912718f2 100644 --- a/versions-enforcer/src/site/markdown/max-dependency-updates.md.vm +++ b/versions-enforcer/src/site/markdown/max-dependency-updates.md.vm @@ -46,7 +46,7 @@ The following parameters are supported by this rule: | `pluginDependencyExcludes` | (empty) | List of plugin dependency exclusion patterns. Only dependencies matching none of the patterns will be considered.
The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. | | `pluginManagementDependencyIncludes` | `*` | List of plugin management dependency inclusion patterns. Only dependencies matching all the patterns will be considered.
The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. | | `pluginManagementDependencyExcludes` | (empty) | List of plugin management dependency exclusion patterns. Only dependencies matching none of the patterns will be considered.
The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. | -| `serverId` | `serverId` | *settings.xml*'s server id for the URL. This is used when wagon needs extra authentication information. | +| `serverId` | `serverId` | *settings.xml*'s server id for the URL. This is used when Wagon needs extra authentication information. | | `rulesUri` | | URI of a ruleSet file containing the rules that control how to compare version numbers. The URI could be either a Wagon URI or a classpath URI (e.g. *classpath:\/\/\/package/sub/package/rules.xml*). | | `ruleSet` | | Allows specifying the `RuleSet` object describing rules on artifact versions to ignore when considering updates.
See: [Using the ruleSet element in the POM](../version-rules.html#Using_the_ruleSet_element_in_the_POM) | diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsDependencyUpdaterMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsDependencyUpdaterMojo.java index 8992c28daf..04b5dc541f 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsDependencyUpdaterMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsDependencyUpdaterMojo.java @@ -31,7 +31,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.model.Dependency; import org.apache.maven.model.Parent; @@ -41,6 +40,7 @@ import org.apache.maven.repository.RepositorySystem; import org.apache.maven.shared.artifact.filter.PatternExcludesArtifactFilter; import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.recording.ChangeRecord; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; @@ -158,10 +158,10 @@ public abstract class AbstractVersionsDependencyUpdaterMojo @Inject protected AbstractVersionsDependencyUpdaterMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsDisplayMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsDisplayMojo.java index 0009b74339..635732cb83 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsDisplayMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsDisplayMojo.java @@ -30,9 +30,9 @@ import java.util.Set; import org.apache.commons.lang3.StringUtils; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; /** @@ -85,10 +85,10 @@ public abstract class AbstractVersionsDisplayMojo @Inject protected AbstractVersionsDisplayMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } @SuppressWarnings( "unchecked" ) diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsReport.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsReport.java index ab236f9059..b33e642016 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsReport.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsReport.java @@ -20,13 +20,11 @@ */ import java.io.File; -import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Set; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; -import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.doxia.sink.Sink; @@ -39,6 +37,7 @@ import org.apache.maven.reporting.AbstractMavenReport; import org.apache.maven.reporting.MavenReportException; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.DefaultVersionsHelper; import org.codehaus.mojo.versions.api.VersionRetrievalException; @@ -79,23 +78,6 @@ public abstract class AbstractVersionsReport */ protected org.eclipse.aether.RepositorySystem aetherRepositorySystem; - /** - * @since 1.0-alpha-3 - */ - @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true ) - protected List remoteArtifactRepositories; - - /** - * @since 1.0-alpha-3 - */ - @Parameter( defaultValue = "${project.pluginArtifactRepositories}", readonly = true ) - protected List remotePluginRepositories; - - /** - * @since 1.0-alpha-3 - */ - private final WagonManager wagonManager; - /** * settings.xml's server id for the URL. This is used when wagon needs extra authentication information. * @@ -182,17 +164,24 @@ public abstract class AbstractVersionsReport */ protected ReportRendererFactory rendererFactory; + /** + * (injected) map of {@link Wagon} instances + * + * @since 2.14.0 + */ + protected Map wagonMap; + // --------------------- GETTER / SETTER METHODS --------------------- protected AbstractVersionsReport( I18N i18n, RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, ReportRendererFactory rendererFactory ) { this.i18n = i18n; this.repositorySystem = repositorySystem; this.aetherRepositorySystem = aetherRepositorySystem; - this.wagonManager = wagonManager; + this.wagonMap = wagonMap; this.rendererFactory = rendererFactory; } @@ -206,7 +195,7 @@ public VersionsHelper getHelper() helper = new DefaultVersionsHelper.Builder() .withRepositorySystem( repositorySystem ) .withAetherRepositorySystem( aetherRepositorySystem ) - .withWagonManager( wagonManager ) + .withWagonMap( wagonMap ) .withServerId( serverId ) .withRulesUri( rulesUri ) .withRuleSet( ruleSet ) diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsUpdaterMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsUpdaterMojo.java index 5ce3f508ae..c2f28e7902 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsUpdaterMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsUpdaterMojo.java @@ -32,7 +32,6 @@ import java.util.Set; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; @@ -45,6 +44,7 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.DefaultVersionsHelper; import org.codehaus.mojo.versions.api.PomHelper; @@ -97,11 +97,6 @@ public abstract class AbstractVersionsUpdaterMojo @Parameter( defaultValue = "${reactorProjects}", required = true, readonly = true ) protected List reactorProjects; - /** - * The (injected) {@link WagonManager} instance. - */ - private final WagonManager wagonManager; - /** * settings.xml's server id for the URL. This is used when wagon needs extra authentication information. * @@ -200,17 +195,24 @@ public abstract class AbstractVersionsUpdaterMojo @Parameter( property = "maven.version.ignore" ) protected Set ignoredVersions; + /** + * (injected) map of {@link Wagon} instances + * + * @since 2.14.0 + */ + protected final Map wagonMap; + // --------------------- GETTER / SETTER METHODS --------------------- @Inject protected AbstractVersionsUpdaterMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { this.repositorySystem = repositorySystem; this.aetherRepositorySystem = aetherRepositorySystem; - this.wagonManager = wagonManager; + this.wagonMap = wagonMap; this.changeRecorders = changeRecorders; } @@ -221,7 +223,7 @@ public VersionsHelper getHelper() throws MojoExecutionException helper = new DefaultVersionsHelper.Builder() .withRepositorySystem( repositorySystem ) .withAetherRepositorySystem( aetherRepositorySystem ) - .withWagonManager( wagonManager ) + .withWagonMap( wagonMap ) .withServerId( serverId ) .withRulesUri( rulesUri ) .withRuleSet( ruleSet ) diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/CompareDependenciesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/CompareDependenciesMojo.java index 537fa9ab91..a531a5c131 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/CompareDependenciesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/CompareDependenciesMojo.java @@ -32,7 +32,6 @@ import java.util.Map; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.model.Dependency; import org.apache.maven.plugin.MojoExecutionException; @@ -44,6 +43,7 @@ import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.ProjectBuildingResult; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactAssociation; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.Property; @@ -131,11 +131,11 @@ public class CompareDependenciesMojo @Inject public CompareDependenciesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, ProjectBuilder projectBuilder, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); this.projectBuilder = projectBuilder; } @@ -308,6 +308,7 @@ private MavenProject getRemoteMavenProject( String groupId, String artifactId, S * Compare the dependency versions of the current project with the dependency versions of a remote project * * @throws XMLStreamException + * @throws MojoExecutionException */ private List compareVersions( ModifiedPomXMLEventReader pom, List dependencies, Map remoteDependencies, diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesReportMojo.java index 55a9f23dec..8eb146ea6a 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesReportMojo.java @@ -32,7 +32,6 @@ import java.util.TreeSet; import java.util.stream.Collectors; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.model.Dependency; @@ -41,6 +40,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.reporting.MavenReportException; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.VersionRetrievalException; import org.codehaus.mojo.versions.reporting.ReportRendererFactory; @@ -111,10 +111,10 @@ public class DependencyUpdatesReportMojo extends AbstractVersionsReport wagonMap, ReportRendererFactory rendererFactory ) { - super( i18n, repositorySystem, aetherRepositorySystem, wagonManager, rendererFactory ); + super( i18n, repositorySystem, aetherRepositorySystem, wagonMap, rendererFactory ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojo.java index 7773890a75..9f978b18aa 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojo.java @@ -30,7 +30,6 @@ import java.util.TreeSet; import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.model.Dependency; import org.apache.maven.plugin.MojoExecutionException; @@ -38,6 +37,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.Segment; import org.codehaus.mojo.versions.api.VersionRetrievalException; @@ -345,10 +345,10 @@ public class DisplayDependencyUpdatesMojo @Inject public DisplayDependencyUpdatesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } // open for tests diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayParentUpdatesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayParentUpdatesMojo.java index 882d3c6765..a65d58faa2 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayParentUpdatesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayParentUpdatesMojo.java @@ -24,7 +24,6 @@ import java.util.Map; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.artifact.versioning.VersionRange; @@ -32,6 +31,7 @@ import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.VersionRetrievalException; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; @@ -53,10 +53,10 @@ public class DisplayParentUpdatesMojo @Inject public DisplayParentUpdatesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } @Override diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayPluginUpdatesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayPluginUpdatesMojo.java index a0d25aa1d5..c38aaebbe3 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayPluginUpdatesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayPluginUpdatesMojo.java @@ -49,7 +49,6 @@ import org.apache.maven.BuildFailureException; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.resolver.ArtifactResolutionException; @@ -89,6 +88,7 @@ import org.apache.maven.project.ProjectBuildingResult; import org.apache.maven.repository.RepositorySystem; import org.apache.maven.settings.Settings; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.VersionRetrievalException; @@ -172,14 +172,14 @@ public class DisplayPluginUpdatesMojo public DisplayPluginUpdatesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, ProjectBuilder projectBuilder, - WagonManager wagonManager, + Map wagonMap, LifecycleExecutor lifecycleExecutor, ModelInterpolator modelInterpolator, PluginManager pluginManager, RuntimeInformation runtimeInformation, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); this.projectBuilder = projectBuilder; this.lifecycleExecutor = lifecycleExecutor; this.modelInterpolator = modelInterpolator; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayPropertyUpdatesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayPropertyUpdatesMojo.java index 3596347b93..dcf7be6ff9 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayPropertyUpdatesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayPropertyUpdatesMojo.java @@ -27,7 +27,6 @@ import java.util.Optional; import java.util.TreeSet; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.plugin.MojoExecutionException; @@ -35,6 +34,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; import org.codehaus.mojo.versions.api.Segment; @@ -141,10 +141,10 @@ public class DisplayPropertyUpdatesMojo @Inject public DisplayPropertyUpdatesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } public void execute() diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ForceReleasesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ForceReleasesMojo.java index 7f2cb52a08..28de4ba3f5 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ForceReleasesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ForceReleasesMojo.java @@ -28,7 +28,6 @@ import java.util.regex.Matcher; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.model.Dependency; @@ -38,6 +37,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.VersionRetrievalException; @@ -70,10 +70,10 @@ public class ForceReleasesMojo @Inject public ForceReleasesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/LockSnapshotsMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/LockSnapshotsMojo.java index 6074838387..9b57fc8914 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/LockSnapshotsMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/LockSnapshotsMojo.java @@ -30,7 +30,6 @@ import org.apache.maven.RepositoryUtils; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; import org.apache.maven.plugin.MojoExecutionException; @@ -38,6 +37,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.project.MavenProject; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; @@ -69,10 +69,10 @@ public class LockSnapshotsMojo @Inject public LockSnapshotsMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ParentUpdatesReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ParentUpdatesReportMojo.java index f6b768fe69..61097221ee 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ParentUpdatesReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ParentUpdatesReportMojo.java @@ -23,8 +23,8 @@ import java.util.List; import java.util.Locale; +import java.util.Map; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -32,6 +32,7 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.reporting.MavenReportException; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.VersionRetrievalException; import org.codehaus.mojo.versions.reporting.ReportRendererFactory; @@ -56,10 +57,10 @@ public class ParentUpdatesReportMojo extends AbstractVersionsReport wagonMap, ReportRendererFactory rendererFactory ) { - super( i18n, repositorySystem, aetherRepositorySystem, wagonManager, rendererFactory ); + super( i18n, repositorySystem, aetherRepositorySystem, wagonMap, rendererFactory ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesReportMojo.java index 975b796e53..7c64b14c89 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesReportMojo.java @@ -30,7 +30,6 @@ import java.util.Set; import java.util.TreeSet; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.model.Plugin; import org.apache.maven.plugins.annotations.Mojo; @@ -38,6 +37,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.reporting.MavenReportException; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PluginUpdatesDetails; import org.codehaus.mojo.versions.api.VersionRetrievalException; import org.codehaus.mojo.versions.reporting.ReportRendererFactory; @@ -86,10 +86,10 @@ public class PluginUpdatesReportMojo extends AbstractVersionsReport wagonMap, ReportRendererFactory rendererFactory ) { - super( i18n, repositorySystem, aetherRepositorySystem, wagonManager, rendererFactory ); + super( i18n, repositorySystem, aetherRepositorySystem, wagonMap, rendererFactory ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesReportMojo.java index db0d102b62..8dd941dff4 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesReportMojo.java @@ -29,7 +29,6 @@ import java.util.Map; import java.util.TreeMap; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; @@ -37,6 +36,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.reporting.MavenReportException; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; import org.codehaus.mojo.versions.api.VersionsHelper; @@ -109,10 +109,10 @@ public class PropertyUpdatesReportMojo extends AbstractVersionsReport wagonMap, ReportRendererFactory rendererFactory ) { - super( i18n, repositorySystem, aetherRepositorySystem, wagonManager, rendererFactory ); + super( i18n, repositorySystem, aetherRepositorySystem, wagonMap, rendererFactory ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ResolveRangesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ResolveRangesMojo.java index 29e115e305..f6278cdc66 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ResolveRangesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ResolveRangesMojo.java @@ -30,7 +30,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.model.Dependency; @@ -39,6 +38,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; @@ -127,10 +127,10 @@ public class ResolveRangesMojo @Inject public ResolveRangesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetMojo.java index 4c1700bff4..1bdceacb0b 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetMojo.java @@ -41,7 +41,6 @@ import java.util.regex.Pattern; import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.model.Model; import org.apache.maven.model.Parent; import org.apache.maven.plugin.MojoExecutionException; @@ -51,6 +50,7 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuilder; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.change.DefaultVersionChange; @@ -255,11 +255,11 @@ public class SetMojo extends AbstractVersionsUpdaterMojo public SetMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, ProjectBuilder projectBuilder, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders, Prompter prompter ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); this.projectBuilder = projectBuilder; this.prompter = prompter; } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetPropertyMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetPropertyMojo.java index 8ea42bfb9c..427cca501d 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetPropertyMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetPropertyMojo.java @@ -26,12 +26,12 @@ import java.util.Arrays; import java.util.Map; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; @@ -91,10 +91,10 @@ public class SetPropertyMojo @Inject public SetPropertyMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetScmTagMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetScmTagMojo.java index 8da3525379..5940640bec 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetScmTagMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetScmTagMojo.java @@ -8,13 +8,13 @@ import java.util.List; import java.util.Map; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.model.Scm; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; @@ -67,10 +67,10 @@ public class SetScmTagMojo extends AbstractVersionsUpdaterMojo @Inject public SetScmTagMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UnlockSnapshotsMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UnlockSnapshotsMojo.java index 14e88af3a3..b490d1400c 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UnlockSnapshotsMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UnlockSnapshotsMojo.java @@ -29,7 +29,6 @@ import java.util.regex.Pattern; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; import org.apache.maven.plugin.MojoExecutionException; @@ -37,6 +36,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.project.MavenProject; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.recording.ChangeRecord; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; @@ -68,10 +68,10 @@ public class UnlockSnapshotsMojo extends AbstractVersionsDependencyUpdaterMojo @Inject public UnlockSnapshotsMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdateChildModulesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdateChildModulesMojo.java index a00659d4ce..6a0bc41362 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdateChildModulesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdateChildModulesMojo.java @@ -29,13 +29,13 @@ import java.util.Map; import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.model.Model; import org.apache.maven.model.Parent; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; @@ -70,10 +70,10 @@ public class UpdateChildModulesMojo @Inject public UpdateChildModulesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdateParentMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdateParentMojo.java index f9ff516419..0841f9e865 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdateParentMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdateParentMojo.java @@ -29,7 +29,6 @@ import java.util.stream.Collectors; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; @@ -39,6 +38,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.Segment; @@ -139,10 +139,10 @@ public class UpdateParentMojo extends AbstractVersionsUpdaterMojo @Inject public UpdateParentMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertiesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertiesMojo.java index 8292a6926d..9ef536db4d 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertiesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertiesMojo.java @@ -25,7 +25,6 @@ import java.util.Map; import java.util.Optional; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.plugin.MojoExecutionException; @@ -33,6 +32,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactAssociation; import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; @@ -140,10 +140,10 @@ public class UpdatePropertiesMojo extends AbstractVersionsDependencyUpdaterMojo @Inject public UpdatePropertiesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertyMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertyMojo.java index e8371fd369..32c569623f 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertyMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertyMojo.java @@ -25,7 +25,6 @@ import java.util.Map; import java.util.Optional; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.plugin.MojoExecutionException; @@ -33,6 +32,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactAssociation; import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; @@ -139,10 +139,10 @@ public class UpdatePropertyMojo @Inject public UpdatePropertyMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseDepVersionMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseDepVersionMojo.java index f61b2e4dce..1972443640 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseDepVersionMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseDepVersionMojo.java @@ -27,7 +27,6 @@ import java.util.Map; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; import org.apache.maven.plugin.MojoExecutionException; @@ -35,6 +34,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.VersionRetrievalException; @@ -74,10 +74,10 @@ public class UseDepVersionMojo extends AbstractVersionsDependencyUpdaterMojo @Inject public UseDepVersionMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } @Override diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestReleasesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestReleasesMojo.java index cf76a901ac..5202196bc5 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestReleasesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestReleasesMojo.java @@ -31,7 +31,6 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.DefaultArtifact; import org.apache.maven.artifact.handler.DefaultArtifactHandler; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.model.Dependency; @@ -41,6 +40,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.Segment; import org.codehaus.mojo.versions.api.VersionRetrievalException; @@ -103,10 +103,10 @@ public class UseLatestReleasesMojo @Inject public UseLatestReleasesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestSnapshotsMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestSnapshotsMojo.java index 6ed13e961f..f1f86dfa82 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestSnapshotsMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestSnapshotsMojo.java @@ -29,7 +29,6 @@ import java.util.Map; import java.util.Optional; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; import org.apache.maven.plugin.MojoExecutionException; @@ -37,6 +36,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.Segment; import org.codehaus.mojo.versions.api.VersionRetrievalException; @@ -92,10 +92,10 @@ public class UseLatestSnapshotsMojo @Inject public UseLatestSnapshotsMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestVersionsMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestVersionsMojo.java index 099d48c594..8021f2fb38 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestVersionsMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestVersionsMojo.java @@ -27,7 +27,6 @@ import java.util.Map; import java.util.Optional; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; import org.apache.maven.plugin.MojoExecutionException; @@ -35,6 +34,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.Segment; import org.codehaus.mojo.versions.api.VersionRetrievalException; @@ -100,10 +100,10 @@ public class UseLatestVersionsMojo @Inject public UseLatestVersionsMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } @Override diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestVersionsMojoBase.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestVersionsMojoBase.java index 462ebb145b..2b95c0f1e1 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestVersionsMojoBase.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseLatestVersionsMojoBase.java @@ -29,12 +29,12 @@ import java.util.function.Predicate; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.model.Dependency; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.VersionRetrievalException; import org.codehaus.mojo.versions.api.recording.ChangeRecord; @@ -50,10 +50,10 @@ public abstract class UseLatestVersionsMojoBase { public UseLatestVersionsMojoBase( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseNextReleasesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseNextReleasesMojo.java index 04c79dc7cc..70e86055e1 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseNextReleasesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseNextReleasesMojo.java @@ -27,13 +27,13 @@ import java.util.Map; import java.util.regex.Pattern; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.VersionRetrievalException; import org.codehaus.mojo.versions.api.recording.ChangeRecord; @@ -66,10 +66,10 @@ public class UseNextReleasesMojo @Inject public UseNextReleasesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseNextSnapshotsMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseNextSnapshotsMojo.java index e688443700..7d5483afa1 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseNextSnapshotsMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseNextSnapshotsMojo.java @@ -28,7 +28,6 @@ import java.util.Map; import java.util.Optional; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; import org.apache.maven.plugin.MojoExecutionException; @@ -36,6 +35,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.Segment; import org.codehaus.mojo.versions.api.VersionRetrievalException; @@ -91,10 +91,10 @@ public class UseNextSnapshotsMojo @Inject public UseNextSnapshotsMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); // the below is necessary for UseLatestVersionsMojoBase.useLatestVersions to select snapshots allowSnapshots = true; } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseNextVersionsMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseNextVersionsMojo.java index 64f4b4b318..67abe9b090 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseNextVersionsMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseNextVersionsMojo.java @@ -26,13 +26,13 @@ import java.util.Collection; import java.util.Map; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.VersionRetrievalException; import org.codehaus.mojo.versions.api.recording.ChangeRecord; @@ -58,10 +58,10 @@ public class UseNextVersionsMojo @Inject public UseNextVersionsMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseReactorMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseReactorMojo.java index 361fcc9b00..552dda2e82 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseReactorMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseReactorMojo.java @@ -28,7 +28,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; import org.apache.maven.plugin.MojoExecutionException; @@ -36,6 +35,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.project.MavenProject; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.VersionRetrievalException; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; @@ -57,10 +57,10 @@ public class UseReactorMojo @Inject public UseReactorMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseReleasesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseReleasesMojo.java index 4bee79200b..89ffbf8938 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseReleasesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseReleasesMojo.java @@ -30,7 +30,6 @@ import java.util.regex.Matcher; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; @@ -39,6 +38,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.VersionRetrievalException; @@ -84,10 +84,10 @@ public class UseReleasesMojo @Inject public UseReleasesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, - WagonManager wagonManager, + Map wagonMap, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, wagonManager, changeRecorders ); + super( repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders ); } /**