artifactBestFitRule = new HashMap<>();
-
/**
* Private constructor used by the builder
*/
@@ -165,43 +167,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 ) );
@@ -214,149 +179,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 + ":" ) );
@@ -868,19 +690,251 @@ public static class Builder
private ArtifactRepository localRepository;
private Collection ignoredVersions;
private RuleSet ruleSet;
- private WagonManager wagonManager;
- private Settings settings;
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
+ {
+ String baseUri;
+ URI fileUri;
+
+ private RulesUri( String baseUri, URI fileUri )
+ {
+ this.baseUri = baseUri;
+ this.fileUri = fileUri;
+ }
+
+ static RulesUri build( String rulesUri ) throws URISyntaxException
+ {
+ int split = rulesUri.lastIndexOf( '/' );
+ return split == -1
+ ? new RulesUri( rulesUri, new URI( "" ) )
+ : new RulesUri( rulesUri.substring( 0, split ) + '/',
+ new URI( split + 1 < rulesUri.length()
+ ? rulesUri.substring( split + 1 )
+ : "" ) );
+ }
+ }
+
+ private RemoteRepository remoteRepository( RulesUri uri )
+ {
+ RemoteRepository prototype = new RemoteRepository.Builder( serverId, uri.fileUri.getScheme(), uri.baseUri )
+ .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.fileUri.toString(), 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;
@@ -910,19 +964,7 @@ public Builder withRuleSet( RuleSet ruleSet )
this.ruleSet = ruleSet;
return this;
}
-
- public Builder withWagonManager( WagonManager wagonManager )
- {
- this.wagonManager = wagonManager;
- return this;
- }
-
- public Builder withSettings( Settings settings )
- {
- this.settings = settings;
- return this;
- }
-
+
public Builder withServerId( String serverId )
{
this.serverId = serverId;
@@ -959,10 +1001,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
{
@@ -984,9 +1032,8 @@ public DefaultVersionsHelper build() throws MojoExecutionException
instance.ruleSet = isBlank( rulesUri )
? new RuleSet()
: isClasspathUri( rulesUri )
- ? getRulesFromClasspath( rulesUri, log )
- : getRulesViaWagon( rulesUri, log, serverId, serverId, wagonManager,
- settings );
+ ? getRulesFromClasspath( rulesUri, log )
+ : 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 b442516370..0d716d2fff 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.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.artifact.resolver.DefaultArtifactResolver;
@@ -41,26 +44,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.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.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;
@@ -69,7 +85,6 @@
*/
public class DefaultVersionsHelperTest extends AbstractMojoTestCase
{
-
@Test
public void testPerRuleVersionsIgnored() throws Exception
{
@@ -221,6 +236,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
{
@@ -232,14 +263,15 @@ 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 ) )
.withArtifactResolver( new DefaultArtifactResolver() )
.withAetherRepositorySystem( aetherRepositorySystem )
.withLocalRepository( new DefaultArtifactRepository(
"", "", new DefaultRepositoryLayout() ) )
- .withWagonManager( lookup( WagonManager.class ) )
- .withSettings( new Settings() )
+ .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 3806386d96..0e5dd75aca 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.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
@@ -40,7 +40,7 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
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.DefaultVersionsHelper;
import org.codehaus.mojo.versions.api.Segment;
@@ -220,7 +220,7 @@ public class MaxDependencyUpdates implements EnforcerRule2
protected List pluginManagementDependencyExcludes = emptyList();
/**
- * settings.xml's server id for the URL. This is used when wagon needs extra authentication information.
+ * settings.xml's server id for the URL. This is used when Wagon needs extra authentication information.
*
* @since 2.14.0
*/
@@ -281,8 +281,13 @@ private static VersionsHelper createVersionsHelper( EnforcerRuleHelper ruleHelpe
.withArtifactResolver( ruleHelper.getComponent( ArtifactResolver.class ) )
.withAetherRepositorySystem( ruleHelper.getComponent( org.eclipse.aether.RepositorySystem.class ) )
.withLocalRepository( (ArtifactRepository) ruleHelper.evaluate( "${localRepository}" ) )
- .withWagonManager( ruleHelper.getComponent( WagonManager.class ) )
- .withSettings( (Settings) ruleHelper.evaluate( "${settings}" ) )
+ .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 5bee054503..253e53335e 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.ArtifactResolver;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.model.Dependency;
@@ -43,6 +42,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;
@@ -161,11 +161,11 @@ public abstract class AbstractVersionsDependencyUpdaterMojo
protected AbstractVersionsDependencyUpdaterMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 98a6779361..e12b5c7103 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,11 +30,11 @@
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
-import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.repository.RepositorySystem;
+import org.apache.maven.wagon.Wagon;
import org.codehaus.mojo.versions.api.recording.ChangeRecorder;
/**
@@ -88,11 +88,11 @@ public abstract class AbstractVersionsDisplayMojo
protected AbstractVersionsDisplayMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
changeRecorders );
}
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 45e0b1654f..18d8538227 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.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.VersionRange;
@@ -40,7 +38,7 @@
import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.MavenReportException;
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.DefaultVersionsHelper;
import org.codehaus.mojo.versions.api.VersionRetrievalException;
@@ -82,30 +80,7 @@ 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;
-
- /**
- * @since 1.0-alpha-3
- */
- @Parameter( defaultValue = "${settings}", readonly = true )
- private Settings settings;
-
- /**
- * settings.xml's server id for the URL. This is used when wagon needs extra authentication information.
+ * settings.xml's server id for the URL. This is used when Wagon needs extra authentication information.
*
* @since 1.0-alpha-3
*/
@@ -192,19 +167,26 @@ 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,
ArtifactResolver artifactResolver,
- WagonManager wagonManager,
+ Map wagonMap,
ReportRendererFactory rendererFactory )
{
this.i18n = i18n;
this.repositorySystem = repositorySystem;
this.aetherRepositorySystem = aetherRepositorySystem;
this.artifactResolver = artifactResolver;
- this.wagonManager = wagonManager;
+ this.wagonMap = wagonMap;
this.rendererFactory = rendererFactory;
}
@@ -220,8 +202,7 @@ public VersionsHelper getHelper()
.withArtifactResolver( artifactResolver )
.withAetherRepositorySystem( aetherRepositorySystem )
.withLocalRepository( localRepository )
- .withWagonManager( wagonManager )
- .withSettings( settings )
+ .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 4b69512ba5..af7434bb34 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.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
@@ -49,7 +48,7 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
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.DefaultVersionsHelper;
import org.codehaus.mojo.versions.api.PomHelper;
@@ -129,18 +128,7 @@ public abstract class AbstractVersionsUpdaterMojo
protected ArtifactRepository localRepository;
/**
- * The (injected) {@link WagonManager} instance.
- */
- private final WagonManager wagonManager;
-
- /**
- * @since 1.0-alpha-3
- */
- @Parameter( defaultValue = "${settings}", readonly = true )
- protected Settings settings;
-
- /**
- * settings.xml's server id for the URL. This is used when wagon needs extra authentication information.
+ * settings.xml's server id for the URL. This is used when Wagon needs extra authentication information.
*
* @since 1.0-alpha-3
*/
@@ -238,20 +226,27 @@ 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,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
this.repositorySystem = repositorySystem;
this.aetherRepositorySystem = aetherRepositorySystem;
this.projectBuilder = projectBuilder;
- this.wagonManager = wagonManager;
+ this.wagonMap = wagonMap;
this.artifactResolver = artifactResolver;
this.changeRecorders = changeRecorders;
}
@@ -265,8 +260,7 @@ public VersionsHelper getHelper() throws MojoExecutionException
.withArtifactResolver( artifactResolver )
.withAetherRepositorySystem( aetherRepositorySystem )
.withLocalRepository( localRepository )
- .withWagonManager( wagonManager )
- .withSettings( settings )
+ .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 a955c8555b..c79639e0d4 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.ArtifactResolver;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoExecutionException;
@@ -43,6 +42,7 @@
import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.ProjectBuildingException;
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;
@@ -129,12 +129,12 @@ public class CompareDependenciesMojo
public CompareDependenciesMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
MavenProjectBuilder mavenProjectBuilder,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
changeRecorders );
this.mavenProjectBuilder = mavenProjectBuilder;
}
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 fb6fe624b5..2aff0d6608 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.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.doxia.sink.Sink;
@@ -42,6 +41,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;
@@ -113,10 +113,11 @@ public class DependencyUpdatesReportMojo extends AbstractVersionsReport wagonMap,
ReportRendererFactory rendererFactory )
{
- super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, wagonManager, rendererFactory );
+ super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, 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 3d37aa60f4..a71fea9dc5 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.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.model.Dependency;
@@ -40,6 +39,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -348,11 +348,11 @@ public class DisplayDependencyUpdatesMojo
public DisplayDependencyUpdatesMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
changeRecorders );
}
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 a932c5aa28..25eb6da15d 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.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
@@ -34,6 +33,7 @@
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -56,11 +56,11 @@ public class DisplayParentUpdatesMojo
public DisplayParentUpdatesMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
changeRecorders );
}
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 41840c2785..0896475f5c 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;
@@ -90,6 +89,7 @@
import org.apache.maven.project.ProjectBuildingException;
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;
@@ -166,7 +166,7 @@ public class DisplayPluginUpdatesMojo
public DisplayPluginUpdatesMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
LifecycleExecutor lifecycleExecutor,
ModelInterpolator modelInterpolator,
@@ -174,7 +174,7 @@ public DisplayPluginUpdatesMojo( RepositorySystem repositorySystem,
RuntimeInformation runtimeInformation,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
changeRecorders );
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 7bf8d69256..718ed93dd6 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.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
@@ -37,6 +36,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -144,11 +144,11 @@ public class DisplayPropertyUpdatesMojo
public DisplayPropertyUpdatesMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
changeRecorders );
}
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 256c979469..70c72f6a47 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.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.VersionRange;
@@ -40,11 +39,12 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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.recording.ChangeRecord;
-import org.codehaus.mojo.versions.api.recording.ChangeRecorder;
import org.codehaus.mojo.versions.api.PomHelper;
import org.codehaus.mojo.versions.api.VersionRetrievalException;
+import org.codehaus.mojo.versions.api.recording.ChangeRecord;
+import org.codehaus.mojo.versions.api.recording.ChangeRecorder;
import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader;
import static java.util.Collections.singletonList;
@@ -73,11 +73,11 @@ public class ForceReleasesMojo
public ForceReleasesMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 735c43244e..932bba6c88 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
@@ -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.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
@@ -39,6 +38,7 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
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,11 +70,11 @@ public class LockSnapshotsMojo
public LockSnapshotsMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 83bb2ab4b5..163f84554b 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.artifact.resolver.ArtifactResolver;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.plugins.annotations.Mojo;
@@ -33,6 +33,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;
@@ -58,10 +59,11 @@ protected ParentUpdatesReportMojo( I18N i18n,
RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
ArtifactResolver artifactResolver,
- WagonManager wagonManager,
+ Map wagonMap,
ReportRendererFactory rendererFactory )
{
- super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, wagonManager, rendererFactory );
+ super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, 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 40427c1962..4dacd0cb8e 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.artifact.resolver.ArtifactResolver;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.model.Plugin;
@@ -39,6 +38,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;
@@ -88,10 +88,11 @@ protected PluginUpdatesReportMojo( I18N i18n,
RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
ArtifactResolver artifactResolver,
- WagonManager wagonManager,
+ Map wagonMap,
ReportRendererFactory rendererFactory )
{
- super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, wagonManager, rendererFactory );
+ super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, 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 419fa786f5..6a33337142 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.artifact.resolver.ArtifactResolver;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.plugin.MojoExecutionException;
@@ -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.Property;
import org.codehaus.mojo.versions.api.PropertyVersions;
import org.codehaus.mojo.versions.api.VersionsHelper;
@@ -111,10 +111,11 @@ protected PropertyUpdatesReportMojo( I18N i18n,
RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
ArtifactResolver artifactResolver,
- WagonManager wagonManager,
+ Map wagonMap,
ReportRendererFactory rendererFactory )
{
- super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, wagonManager, rendererFactory );
+ super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, 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 d0c8198bfe..d2079953a9 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.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
@@ -41,6 +40,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -130,11 +130,11 @@ public class ResolveRangesMojo
public ResolveRangesMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 4924289303..6037463fef 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.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Model;
import org.apache.maven.model.Parent;
@@ -52,6 +51,7 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -249,12 +249,12 @@ public class SetMojo extends AbstractVersionsUpdaterMojo
public SetMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders,
Prompter prompter )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
changeRecorders );
this.prompter = prompter;
}
@@ -310,7 +310,7 @@ public void execute() throws MojoExecutionException, MojoFailureException
getLog().info( "removeSnapshot enabled whilst the version is not a snapshot: nothing to do." );
return;
}
- if ( settings.isInteractiveMode() )
+ if ( session.getSettings().isInteractiveMode() )
{
try
{
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 6abca80b7c..8eede8871f 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,7 +26,6 @@
import java.util.Arrays;
import java.util.Map;
-import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -34,6 +33,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -92,13 +92,13 @@ public class SetPropertyMojo
@Inject
public SetPropertyMojo( RepositorySystem repositorySystem,
- org.eclipse.aether.RepositorySystem aetherRepositorySystem,
- MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
- ArtifactResolver artifactResolver,
+ org.eclipse.aether.RepositorySystem aetherRepositorySystem,
+ MavenProjectBuilder projectBuilder,
+ Map wagonMap,
+ ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 777ec9287e..465ecd33b3 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,7 +8,6 @@
import java.util.List;
import java.util.Map;
-import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Scm;
import org.apache.maven.plugin.MojoExecutionException;
@@ -17,6 +16,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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,11 +70,11 @@ public class SetScmTagMojo extends AbstractVersionsUpdaterMojo
public SetScmTagMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 e3c18336ba..6c509d18bb 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.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
@@ -39,6 +38,7 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -71,11 +71,11 @@ public class UnlockSnapshotsMojo extends AbstractVersionsDependencyUpdaterMojo
public UnlockSnapshotsMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 0cd87fa827..7b372e9c20 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,7 +29,6 @@
import java.util.Map;
import org.apache.maven.artifact.ArtifactUtils;
-import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Model;
import org.apache.maven.model.Parent;
@@ -38,6 +37,7 @@
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -73,11 +73,11 @@ public class UpdateChildModulesMojo
public UpdateChildModulesMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 1dac708177..ba37213b33 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.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
@@ -41,6 +40,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -142,11 +142,11 @@ public class UpdateParentMojo extends AbstractVersionsUpdaterMojo
public UpdateParentMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 a5c5d8a094..c910f2934b 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.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
@@ -35,6 +34,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -143,11 +143,11 @@ public class UpdatePropertiesMojo extends AbstractVersionsDependencyUpdaterMojo
public UpdatePropertiesMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 abef1cf509..6258366f6c 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.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
@@ -35,6 +34,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -142,11 +142,11 @@ public class UpdatePropertyMojo
public UpdatePropertyMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 c895e14680..d1a9eae6fb 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.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
@@ -37,6 +36,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -77,11 +77,11 @@ public class UseDepVersionMojo extends AbstractVersionsDependencyUpdaterMojo
public UseDepVersionMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
changeRecorders );
}
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 f0f8d9a2aa..c7eaa252b1 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.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.VersionRange;
@@ -43,6 +42,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -106,11 +106,11 @@ public class UseLatestReleasesMojo
public UseLatestReleasesMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 96f183b654..f9b39544aa 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.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
@@ -39,6 +38,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -95,11 +95,11 @@ public class UseLatestSnapshotsMojo
public UseLatestSnapshotsMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 d7d018d906..b025ec024c 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.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
@@ -37,11 +36,12 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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;
import org.codehaus.mojo.versions.api.recording.ChangeRecord;
import org.codehaus.mojo.versions.api.recording.ChangeRecorder;
-import org.codehaus.mojo.versions.api.VersionRetrievalException;
import org.codehaus.mojo.versions.ordering.InvalidSegmentException;
import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader;
import org.codehaus.mojo.versions.utils.SegmentUtils;
@@ -103,11 +103,11 @@ public class UseLatestVersionsMojo
public UseLatestVersionsMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
changeRecorders );
}
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 da94696cd4..966a2eea82 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,7 +29,6 @@
import java.util.function.Predicate;
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
@@ -37,6 +36,7 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -53,11 +53,11 @@ public abstract class UseLatestVersionsMojoBase
public UseLatestVersionsMojoBase( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 64ab6c8b5e..5ffc943e6a 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,7 +27,6 @@
import java.util.Map;
import java.util.regex.Pattern;
-import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
@@ -36,10 +35,11 @@
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.repository.RepositorySystem;
-import org.codehaus.mojo.versions.api.recording.ChangeRecord;
-import org.codehaus.mojo.versions.api.recording.ChangeRecorder;
+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;
+import org.codehaus.mojo.versions.api.recording.ChangeRecorder;
import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader;
import static java.util.Collections.singletonList;
@@ -69,11 +69,11 @@ public class UseNextReleasesMojo
public UseNextReleasesMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 ced9081288..c6c3e181ab 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.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
@@ -38,6 +37,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -94,11 +94,11 @@ public class UseNextSnapshotsMojo
public UseNextSnapshotsMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 925ca661c6..b0aee36f75 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,7 +26,6 @@
import java.util.Collection;
import java.util.Map;
-import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
@@ -35,10 +34,11 @@
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.repository.RepositorySystem;
-import org.codehaus.mojo.versions.api.recording.ChangeRecord;
-import org.codehaus.mojo.versions.api.recording.ChangeRecorder;
+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;
+import org.codehaus.mojo.versions.api.recording.ChangeRecorder;
import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader;
import static java.util.Collections.singletonList;
@@ -61,11 +61,11 @@ public class UseNextVersionsMojo
public UseNextVersionsMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 f583ce2287..e29980835b 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.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
@@ -38,6 +37,7 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -60,11 +60,11 @@ public class UseReactorMojo
public UseReactorMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
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 e1a69d156e..5fac54d563 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.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.model.Dependency;
@@ -41,6 +40,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectBuilder;
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;
@@ -87,11 +87,11 @@ public class UseReleasesMojo
public UseReleasesMojo( RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystem aetherRepositorySystem,
MavenProjectBuilder projectBuilder,
- WagonManager wagonManager,
+ Map wagonMap,
ArtifactResolver artifactResolver,
Map changeRecorders )
{
- super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver,
+ super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonMap, artifactResolver,
changeRecorders );
}
diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/SetMojoTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/SetMojoTest.java
index 3a34edd890..e652b8ea7b 100644
--- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/SetMojoTest.java
+++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/SetMojoTest.java
@@ -6,7 +6,6 @@
import java.nio.file.Path;
import java.nio.file.Paths;
-import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.model.Model;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -146,9 +145,7 @@ public void testRemoveSnapshotIdempotency()
// no exception should be thrown, the file should stay with version "1.0"
SetMojo secondRun = (SetMojo) mojoRule.lookupConfiguredMojo( tempDir.toFile(), "set" );
- MavenExecutionRequest request =
- (MavenExecutionRequest) getVariableValueFromObject( secondRun.settings, "request" );
- setVariableValueToObject( request, "interactiveMode", false );
+ secondRun.session.getSettings().setInteractiveMode( false );
secondRun.execute();
assertThat( String.join( "", Files.readAllLines( tempDir.resolve( "pom.xml" ) ) ),
containsString( "1.0" ) );
diff --git a/versions-test/src/main/java/org/codehaus/mojo/versions/utils/MockUtils.java b/versions-test/src/main/java/org/codehaus/mojo/versions/utils/MockUtils.java
index 733344f143..133eead056 100644
--- a/versions-test/src/main/java/org/codehaus/mojo/versions/utils/MockUtils.java
+++ b/versions-test/src/main/java/org/codehaus/mojo/versions/utils/MockUtils.java
@@ -19,6 +19,7 @@
* under the License.
*/
+import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -35,6 +36,9 @@
import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.i18n.I18N;
import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.resolution.ArtifactRequest;
+import org.eclipse.aether.resolution.ArtifactResolutionException;
+import org.eclipse.aether.resolution.ArtifactResult;
import org.eclipse.aether.resolution.VersionRangeRequest;
import org.eclipse.aether.resolution.VersionRangeResolutionException;
import org.eclipse.aether.resolution.VersionRangeResult;
@@ -78,8 +82,8 @@ public static org.eclipse.aether.RepositorySystem mockAetherRepositorySystem( Ma
org.eclipse.aether.RepositorySystem repositorySystem = mock( org.eclipse.aether.RepositorySystem.class );
try
{
- when( repositorySystem.resolveVersionRange( any(), any( VersionRangeRequest.class ) ) ).then(
- invocation ->
+ when( repositorySystem.resolveVersionRange( any(), any( VersionRangeRequest.class ) ) )
+ .then( invocation ->
{
VersionRangeRequest request = invocation.getArgument( 1 );
return versionMap.entrySet().stream()
@@ -91,11 +95,28 @@ public static org.eclipse.aether.RepositorySystem mockAetherRepositorySystem( Ma
.map( versions -> new VersionRangeResult( request ).setVersions( versions ) )
.orElse( null ); // should tell us if we haven't populated all cases in the test
} );
+ when( repositorySystem.resolveArtifact( any( RepositorySystemSession.class ),
+ any( ArtifactRequest.class ) ) )
+ .then( invocation ->
+ {
+ ArtifactRequest request = invocation.getArgument( 1 );
+ org.eclipse.aether.artifact.Artifact copiedArtifact =
+ new org.eclipse.aether.artifact.DefaultArtifact(
+ request.getArtifact().getGroupId(),
+ request.getArtifact().getArtifactId(),
+ request.getArtifact().getClassifier(),
+ request.getArtifact().getExtension(),
+ request.getArtifact().getVersion() );
+ copiedArtifact.setFile( mock( File.class ) );
+ return new ArtifactResult( request )
+ .setArtifact( copiedArtifact );
+ } );
}
- catch ( VersionRangeResolutionException e )
+ catch ( VersionRangeResolutionException | ArtifactResolutionException e )
{
throw new RuntimeException( e );
}
+
return repositorySystem;
}
@@ -149,8 +170,6 @@ public static MavenSession mockMavenSession()
.thenReturn( mock( RepositorySystemSession.class ) );
when( session.getCurrentProject() ).thenReturn( mock( MavenProject.class ) );
when( session.getCurrentProject().getRemotePluginRepositories() ).thenReturn( emptyList() );
- when( session.getCurrentProject().getPluginArtifactRepositories() ).thenReturn( emptyList() );
- when( session.getCurrentProject().getRemoteArtifactRepositories() ).thenReturn( emptyList() );
when( session.getCurrentProject().getRemoteProjectRepositories() ).thenReturn( emptyList() );
return session;
}