From e0458febb9daece5ad1c6d5dfabf649c7274ddd6 Mon Sep 17 00:00:00 2001 From: Andrzej Jarmoniuk Date: Fri, 25 Nov 2022 15:36:37 +0100 Subject: [PATCH] #704: Remove WagonManager --- .../versions/api/DefaultVersionsHelper.java | 257 +++++++++--------- .../mojo/versions/utils/WagonUtils.java | 112 -------- .../api/DefaultVersionsHelperTest.java | 32 ++- .../enforcer/MaxDependencyUpdates.java | 13 +- .../it/it-transporter-001/invoker.properties | 2 + .../src/it/it-transporter-001/pom.xml | 18 ++ .../src/it/it-transporter-001/rules.xml | 12 + .../src/it/it-transporter-001/verify.groovy | 3 + .../it/it-transporter-002/invoker.properties | 2 + .../src/it/it-transporter-002/pom.xml | 38 +++ .../src/it/it-transporter-002/rules.xml | 12 + .../src/it/it-transporter-002/verify.groovy | 3 + ...AbstractVersionsDependencyUpdaterMojo.java | 6 +- .../versions/AbstractVersionsDisplayMojo.java | 6 +- .../mojo/versions/AbstractVersionsReport.java | 43 +-- .../versions/AbstractVersionsUpdaterMojo.java | 28 +- .../versions/CompareDependenciesMojo.java | 6 +- .../versions/DependencyUpdatesReportMojo.java | 7 +- .../DisplayDependencyUpdatesMojo.java | 6 +- .../versions/DisplayParentUpdatesMojo.java | 6 +- .../versions/DisplayPluginUpdatesMojo.java | 6 +- .../versions/DisplayPropertyUpdatesMojo.java | 6 +- .../mojo/versions/ForceReleasesMojo.java | 10 +- .../mojo/versions/LockSnapshotsMojo.java | 6 +- .../versions/ParentUpdatesReportMojo.java | 8 +- .../versions/PluginUpdatesReportMojo.java | 7 +- .../versions/PropertyUpdatesReportMojo.java | 7 +- .../mojo/versions/ResolveRangesMojo.java | 6 +- .../org/codehaus/mojo/versions/SetMojo.java | 8 +- .../mojo/versions/SetPropertyMojo.java | 12 +- .../codehaus/mojo/versions/SetScmTagMojo.java | 6 +- .../mojo/versions/UnlockSnapshotsMojo.java | 6 +- .../mojo/versions/UpdateChildModulesMojo.java | 6 +- .../mojo/versions/UpdateParentMojo.java | 6 +- .../mojo/versions/UpdatePropertiesMojo.java | 6 +- .../mojo/versions/UpdatePropertyMojo.java | 6 +- .../mojo/versions/UseDepVersionMojo.java | 6 +- .../mojo/versions/UseLatestReleasesMojo.java | 6 +- .../mojo/versions/UseLatestSnapshotsMojo.java | 6 +- .../mojo/versions/UseLatestVersionsMojo.java | 8 +- .../versions/UseLatestVersionsMojoBase.java | 6 +- .../mojo/versions/UseNextReleasesMojo.java | 10 +- .../mojo/versions/UseNextSnapshotsMojo.java | 6 +- .../mojo/versions/UseNextVersionsMojo.java | 10 +- .../mojo/versions/UseReactorMojo.java | 6 +- .../mojo/versions/UseReleasesMojo.java | 6 +- .../codehaus/mojo/versions/SetMojoTest.java | 5 +- .../mojo/versions/utils/MockUtils.java | 29 +- 48 files changed, 421 insertions(+), 407 deletions(-) delete mode 100644 versions-common/src/main/java/org/codehaus/mojo/versions/utils/WagonUtils.java create mode 100644 versions-maven-plugin/src/it/it-transporter-001/invoker.properties create mode 100644 versions-maven-plugin/src/it/it-transporter-001/pom.xml create mode 100644 versions-maven-plugin/src/it/it-transporter-001/rules.xml create mode 100644 versions-maven-plugin/src/it/it-transporter-001/verify.groovy create mode 100644 versions-maven-plugin/src/it/it-transporter-002/invoker.properties create mode 100644 versions-maven-plugin/src/it/it-transporter-002/pom.xml create mode 100644 versions-maven-plugin/src/it/it-transporter-002/rules.xml create mode 100644 versions-maven-plugin/src/it/it-transporter-002/verify.groovy diff --git a/versions-common/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java b/versions-common/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java index 9ef7215ece..4ff664f181 100644 --- a/versions-common/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java +++ b/versions-common/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java @@ -23,6 +23,9 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.io.StringReader; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Files; import java.util.ArrayList; @@ -35,6 +38,8 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.Optional; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; @@ -50,7 +55,6 @@ import org.apache.maven.RepositoryUtils; 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; @@ -65,13 +69,9 @@ import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; import org.apache.maven.repository.RepositorySystem; -import org.apache.maven.settings.Settings; -import org.apache.maven.wagon.ConnectionException; import org.apache.maven.wagon.ResourceDoesNotExistException; import org.apache.maven.wagon.TransferFailedException; -import org.apache.maven.wagon.UnsupportedProtocolException; import org.apache.maven.wagon.Wagon; -import org.apache.maven.wagon.authentication.AuthenticationException; import org.apache.maven.wagon.authorization.AuthorizationException; import org.codehaus.mojo.versions.model.IgnoreVersion; import org.codehaus.mojo.versions.model.Rule; @@ -84,13 +84,19 @@ import org.codehaus.mojo.versions.utils.PluginComparator; import org.codehaus.mojo.versions.utils.RegexUtils; import org.codehaus.mojo.versions.utils.VersionsExpressionEvaluator; -import org.codehaus.mojo.versions.utils.WagonUtils; import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.eclipse.aether.repository.RemoteRepository; import org.eclipse.aether.resolution.VersionRangeRequest; import org.eclipse.aether.resolution.VersionRangeResolutionException; +import org.eclipse.aether.spi.connector.transport.GetTask; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; +import org.eclipse.aether.transfer.NoTransporterException; + +import static java.util.Optional.empty; +import static java.util.Optional.of; /** * Helper class that provides common functionality required by both the mojos and the reports. @@ -157,7 +163,6 @@ public class DefaultVersionsHelper * @since 2.12 */ private final Map artifactBestFitRule = new HashMap<>(); - /** * Private constructor used by the builder */ @@ -260,103 +265,6 @@ private static RuleSet enrichRuleSet( Collection ignoredVersions, RuleSe 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 +776,131 @@ 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 transporterFactoryMap; 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 ( 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 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 RuleSet getRulesUsingTransporter() + { + RulesUri uri; + try + { + uri = RulesUri.build( rulesUri ); + } + catch ( URISyntaxException e ) + { + log.warn( "Invalid rulesUri protocol: " + e.getMessage() ); + return null; + } + + RemoteRepository repository = new RemoteRepository.Builder( null, null, uri.baseUri ) + .build(); + return transporterFactoryMap + .values() + .stream() + // highest priority first -> reversing the order of arguments: + .sorted( ( f1, f2 ) -> Float.compare( f2.getPriority(), f1.getPriority() ) ) + .map( factory -> + { + try + { + return factory.newInstance( mavenSession.getRepositorySession(), repository ); + } + catch ( NoTransporterException e ) + { + log.warn( "No transporter possible for " + uri.baseUri + ": " + + e.getMessage() ); + return null; + } + } ) + .filter( Objects::nonNull ) + .map( transporter -> + { + try + { + GetTask getTask = new GetTask( uri.fileUri ); + transporter.get( getTask ); + return new RuleXpp3Reader().read( new StringReader( getTask.getDataString() ) ); + } + catch ( Exception e ) + { + log.warn( "Error while reading the rules string: " + e.getMessage() ); + return null; + } + } ) + .filter( Objects::nonNull ) + .findFirst() + .orElse( null ); + } + + 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 +930,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,6 +967,12 @@ public Builder withAetherRepositorySystem( org.eclipse.aether.RepositorySystem a return this; } + public Builder withTransporterFactoryMap( Map transporterFactoryMap ) + { + this.transporterFactoryMap = transporterFactoryMap; + return this; + } + /** * Builds the constructed {@linkplain DefaultVersionsHelper} object * @return constructed {@linkplain DefaultVersionsHelper} @@ -984,9 +998,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 ) + : getRulesUsingTransporter(); } 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..9561622446 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,8 @@ * under the License. */ +import java.io.InputStream; +import java.io.OutputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -26,8 +28,8 @@ import java.util.Objects; import java.util.stream.Collectors; +import org.apache.commons.io.IOUtils; 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,7 +43,6 @@ 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.codehaus.mojo.versions.model.IgnoreVersion; import org.codehaus.mojo.versions.model.Rule; import org.codehaus.mojo.versions.model.RuleSet; @@ -49,18 +50,23 @@ import org.codehaus.mojo.versions.utils.VersionStub; import org.eclipse.aether.resolution.VersionRangeRequest; import org.eclipse.aether.resolution.VersionRangeResult; +import org.eclipse.aether.spi.connector.transport.GetTask; +import org.eclipse.aether.spi.connector.transport.Transporter; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import org.eclipse.aether.version.Version; import org.hamcrest.CoreMatchers; import org.junit.Test; 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.Mockito.any; +import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -69,7 +75,6 @@ */ public class DefaultVersionsHelperTest extends AbstractMojoTestCase { - @Test public void testPerRuleVersionsIgnored() throws Exception { @@ -232,14 +237,31 @@ private DefaultVersionsHelper createHelper( org.eclipse.aether.RepositorySystem .thenReturn( emptyList() ); when( mavenSession.getCurrentProject().getRemotePluginRepositories() ) .thenReturn( emptyList() ); + + // actual transporter testing is done in it-transporter-* and e.g. it-rules-via-classpath-001 + Transporter transporter = mock( Transporter.class ); + doAnswer( i -> + { + GetTask getTask = i.getArgument( 0 ); + try ( InputStream inputStream = getClass().getResourceAsStream( resourcePath ); + OutputStream outputStream = getTask.newOutputStream() ) + { + IOUtils.copy( Objects.requireNonNull( inputStream ), outputStream ); + } + return null; + } ).when( transporter ).get( any( GetTask.class ) ); + + TransporterFactory transporterFactory = mock( TransporterFactory.class ); + when( transporterFactory.newInstance( any(), any() ) ) + .thenReturn( transporter ); + 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() ) + .withTransporterFactoryMap( singletonMap( "mock", transporterFactory ) ) .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..db855598d5 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,6 @@ 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.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.DefaultVersionsHelper; import org.codehaus.mojo.versions.api.Segment; @@ -50,6 +49,7 @@ import org.codehaus.mojo.versions.utils.DependencyComparator; import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; @@ -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}" ) ) + .withTransporterFactoryMap( ruleHelper.getComponentMap( TransporterFactory.class.getName() ) + .entrySet() + .parallelStream() + .filter( e -> e.getValue() instanceof TransporterFactory ) + .collect( HashMap::new, + ( m, e ) -> m.put( e.getKey(), (TransporterFactory) e.getValue() ), + HashMap::putAll ) ) .withServerId( serverId ) .withRulesUri( rulesUri ) .withRuleSet( ruleSet ) diff --git a/versions-maven-plugin/src/it/it-transporter-001/invoker.properties b/versions-maven-plugin/src/it/it-transporter-001/invoker.properties new file mode 100644 index 0000000000..1c628a5b17 --- /dev/null +++ b/versions-maven-plugin/src/it/it-transporter-001/invoker.properties @@ -0,0 +1,2 @@ +invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:use-latest-releases +invoker.mavenOpts = -Dmaven.version.rules=file:rules.xml diff --git a/versions-maven-plugin/src/it/it-transporter-001/pom.xml b/versions-maven-plugin/src/it/it-transporter-001/pom.xml new file mode 100644 index 0000000000..8263900678 --- /dev/null +++ b/versions-maven-plugin/src/it/it-transporter-001/pom.xml @@ -0,0 +1,18 @@ + + 4.0.0 + + localhost + it-transporter-001 + 1.0 + pom + + + + localhost + dummy-api + 1.0 + + + + diff --git a/versions-maven-plugin/src/it/it-transporter-001/rules.xml b/versions-maven-plugin/src/it/it-transporter-001/rules.xml new file mode 100644 index 0000000000..99d7cb705c --- /dev/null +++ b/versions-maven-plugin/src/it/it-transporter-001/rules.xml @@ -0,0 +1,12 @@ + + + + + 3.* + + + + diff --git a/versions-maven-plugin/src/it/it-transporter-001/verify.groovy b/versions-maven-plugin/src/it/it-transporter-001/verify.groovy new file mode 100644 index 0000000000..921f69ef90 --- /dev/null +++ b/versions-maven-plugin/src/it/it-transporter-001/verify.groovy @@ -0,0 +1,3 @@ +def project = new XmlSlurper().parse( new File( basedir, 'pom.xml' ) ) + +assert !( project.dependencies.dependency.find { node -> node.artifactId == 'dummy-api' }.version =~ /3.*/ ) diff --git a/versions-maven-plugin/src/it/it-transporter-002/invoker.properties b/versions-maven-plugin/src/it/it-transporter-002/invoker.properties new file mode 100644 index 0000000000..1c628a5b17 --- /dev/null +++ b/versions-maven-plugin/src/it/it-transporter-002/invoker.properties @@ -0,0 +1,2 @@ +invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:use-latest-releases +invoker.mavenOpts = -Dmaven.version.rules=file:rules.xml diff --git a/versions-maven-plugin/src/it/it-transporter-002/pom.xml b/versions-maven-plugin/src/it/it-transporter-002/pom.xml new file mode 100644 index 0000000000..dfaa164ae7 --- /dev/null +++ b/versions-maven-plugin/src/it/it-transporter-002/pom.xml @@ -0,0 +1,38 @@ + + 4.0.0 + + localhost + it-transporter-001 + 1.0 + pom + + + + localhost + dummy-api + 1.0 + + + + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + org.apache.maven.resolver + maven-resolver-transport-file + 1.8.2 + runtime + + + + + + + + diff --git a/versions-maven-plugin/src/it/it-transporter-002/rules.xml b/versions-maven-plugin/src/it/it-transporter-002/rules.xml new file mode 100644 index 0000000000..99d7cb705c --- /dev/null +++ b/versions-maven-plugin/src/it/it-transporter-002/rules.xml @@ -0,0 +1,12 @@ + + + + + 3.* + + + + diff --git a/versions-maven-plugin/src/it/it-transporter-002/verify.groovy b/versions-maven-plugin/src/it/it-transporter-002/verify.groovy new file mode 100644 index 0000000000..921f69ef90 --- /dev/null +++ b/versions-maven-plugin/src/it/it-transporter-002/verify.groovy @@ -0,0 +1,3 @@ +def project = new XmlSlurper().parse( new File( basedir, 'pom.xml' ) ) + +assert !( project.dependencies.dependency.find { node -> node.artifactId == 'dummy-api' }.version =~ /3.*/ ) 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..8f1169a3e7 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; @@ -50,6 +49,7 @@ import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; import org.codehaus.mojo.versions.utils.DependencyBuilder; import org.codehaus.mojo.versions.utils.DependencyComparator; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Base class for a mojo that updates dependency versions. @@ -161,11 +161,11 @@ public abstract class AbstractVersionsDependencyUpdaterMojo protected AbstractVersionsDependencyUpdaterMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..52d243085d 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,12 +30,12 @@ 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.codehaus.mojo.versions.api.recording.ChangeRecorder; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Abstract base class for the Display___ mojos. @@ -88,11 +88,11 @@ public abstract class AbstractVersionsDisplayMojo protected AbstractVersionsDisplayMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..3838a7ecf6 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,6 @@ 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.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.DefaultVersionsHelper; import org.codehaus.mojo.versions.api.VersionRetrievalException; @@ -48,6 +45,7 @@ import org.codehaus.mojo.versions.model.RuleSet; import org.codehaus.mojo.versions.reporting.ReportRendererFactory; import org.codehaus.plexus.i18n.I18N; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Base class for all versions reports. @@ -81,29 +79,6 @@ public abstract class AbstractVersionsReport */ protected org.eclipse.aether.RepositorySystem aetherRepositorySystem; - /** - * @since 1.0-alpha-3 - */ - @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true ) - protected List remoteArtifactRepositories; - - /** - * @since 1.0-alpha-3 - */ - @Parameter( defaultValue = "${project.pluginArtifactRepositories}", readonly = true ) - protected List remotePluginRepositories; - - /** - * @since 1.0-alpha-3 - */ - private final WagonManager wagonManager; - - /** - * @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. * @@ -192,19 +167,26 @@ public abstract class AbstractVersionsReport */ protected ReportRendererFactory rendererFactory; + /** + * (injected) map of {@link TransporterFactory} objects + * + * @since 2.14.0 + */ + protected Map transporterFactoryMap; + // --------------------- GETTER / SETTER METHODS --------------------- protected AbstractVersionsReport( I18N i18n, RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, ArtifactResolver artifactResolver, - WagonManager wagonManager, + Map transporterFactoryMap, ReportRendererFactory rendererFactory ) { this.i18n = i18n; this.repositorySystem = repositorySystem; this.aetherRepositorySystem = aetherRepositorySystem; this.artifactResolver = artifactResolver; - this.wagonManager = wagonManager; + this.transporterFactoryMap = transporterFactoryMap; this.rendererFactory = rendererFactory; } @@ -220,8 +202,7 @@ public VersionsHelper getHelper() .withArtifactResolver( artifactResolver ) .withAetherRepositorySystem( aetherRepositorySystem ) .withLocalRepository( localRepository ) - .withWagonManager( wagonManager ) - .withSettings( settings ) + .withTransporterFactoryMap( transporterFactoryMap ) .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..927d438f1a 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,6 @@ 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.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.DefaultVersionsHelper; import org.codehaus.mojo.versions.api.PomHelper; @@ -66,6 +64,7 @@ import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.WriterFactory; import org.codehaus.stax2.XMLInputFactory2; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Abstract base class for Versions Mojos. @@ -128,17 +127,6 @@ public abstract class AbstractVersionsUpdaterMojo @Parameter( defaultValue = "${localRepository}", readonly = true ) 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. * @@ -238,20 +226,27 @@ public abstract class AbstractVersionsUpdaterMojo @Parameter( property = "maven.version.ignore" ) protected Set ignoredVersions; + /** + * (injected) map of transporter factories + * + * @since 2.14.0 + */ + protected final Map transporterFactoryMap; + // --------------------- GETTER / SETTER METHODS --------------------- @Inject protected AbstractVersionsUpdaterMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { this.repositorySystem = repositorySystem; this.aetherRepositorySystem = aetherRepositorySystem; this.projectBuilder = projectBuilder; - this.wagonManager = wagonManager; + this.transporterFactoryMap = transporterFactoryMap; 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 ) + .withTransporterFactoryMap( transporterFactoryMap ) .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..63c0d339ed 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; @@ -52,6 +51,7 @@ import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; import org.codehaus.mojo.versions.utils.DependencyBuilder; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static java.util.Collections.singletonList; @@ -129,12 +129,12 @@ public class CompareDependenciesMojo public CompareDependenciesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, MavenProjectBuilder mavenProjectBuilder, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..1f664a1c42 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; @@ -49,6 +48,7 @@ import org.codehaus.mojo.versions.utils.DependencyComparator; import org.codehaus.mojo.versions.xml.DependencyUpdatesXmlReportRenderer; import org.codehaus.plexus.i18n.I18N; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static java.util.Collections.emptyMap; import static org.codehaus.mojo.versions.utils.MavenProjectUtils.interpolateVersion; @@ -113,10 +113,11 @@ public class DependencyUpdatesReportMojo extends AbstractVersionsReport transporterFactoryMap, ReportRendererFactory rendererFactory ) { - super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, wagonManager, rendererFactory ); + super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, transporterFactoryMap, + 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..c39823aba4 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; @@ -49,6 +48,7 @@ import org.codehaus.mojo.versions.utils.DependencyComparator; import org.codehaus.mojo.versions.utils.SegmentUtils; import org.codehaus.plexus.util.StringUtils; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static java.util.Collections.emptySet; import static java.util.Optional.empty; @@ -348,11 +348,11 @@ public class DisplayDependencyUpdatesMojo public DisplayDependencyUpdatesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..8b128a75ea 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; @@ -38,6 +37,7 @@ import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; import org.codehaus.mojo.versions.utils.DependencyBuilder; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Displays any updates of the project's parent project @@ -56,11 +56,11 @@ public class DisplayParentUpdatesMojo public DisplayParentUpdatesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..9727f55c42 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; @@ -102,6 +101,7 @@ import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.StringUtils; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Displays all plugins that have newer versions available, taking care of Maven version prerequisites. @@ -166,7 +166,7 @@ public class DisplayPluginUpdatesMojo public DisplayPluginUpdatesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, 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, transporterFactoryMap, 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..005cba88a5 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; @@ -45,6 +44,7 @@ import org.codehaus.mojo.versions.ordering.InvalidSegmentException; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; import org.codehaus.mojo.versions.utils.SegmentUtils; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Displays properties that are linked to artifact versions and have updates available. @@ -144,11 +144,11 @@ public class DisplayPropertyUpdatesMojo public DisplayPropertyUpdatesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..47c652358e 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; @@ -41,11 +40,12 @@ import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.repository.RepositorySystem; 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 org.eclipse.aether.spi.connector.transport.TransporterFactory; 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 transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..35e9542d2d 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; @@ -42,6 +41,7 @@ import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Attempts to resolve unlocked snapshot dependency versions to the locked timestamp versions used in the build. For @@ -70,11 +70,11 @@ public class LockSnapshotsMojo public LockSnapshotsMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..039778f9de 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; @@ -39,6 +39,7 @@ import org.codehaus.mojo.versions.reporting.model.ParentUpdatesModel; import org.codehaus.mojo.versions.utils.DependencyBuilder; import org.codehaus.plexus.i18n.I18N; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Generates a report on available updates for parent artifacts @@ -58,10 +59,11 @@ protected ParentUpdatesReportMojo( I18N i18n, RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, ArtifactResolver artifactResolver, - WagonManager wagonManager, + Map transporterFactoryMap, ReportRendererFactory rendererFactory ) { - super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, wagonManager, rendererFactory ); + super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, transporterFactoryMap, + 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..424004dd72 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; @@ -46,6 +45,7 @@ import org.codehaus.mojo.versions.utils.PluginComparator; import org.codehaus.mojo.versions.xml.PluginUpdatesXmlReportRenderer; import org.codehaus.plexus.i18n.I18N; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static org.codehaus.mojo.versions.utils.MiscUtils.filter; @@ -88,10 +88,11 @@ protected PluginUpdatesReportMojo( I18N i18n, RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, ArtifactResolver artifactResolver, - WagonManager wagonManager, + Map transporterFactoryMap, ReportRendererFactory rendererFactory ) { - super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, wagonManager, rendererFactory ); + super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, transporterFactoryMap, + 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..56698b8eeb 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; @@ -46,6 +45,7 @@ import org.codehaus.mojo.versions.utils.PropertyComparator; import org.codehaus.mojo.versions.xml.PropertyUpdatesXmlReportRenderer; import org.codehaus.plexus.i18n.I18N; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Generates a report of available updates for properties of a project which are linked to the dependencies and/or @@ -111,10 +111,11 @@ protected PropertyUpdatesReportMojo( I18N i18n, RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, ArtifactResolver artifactResolver, - WagonManager wagonManager, + Map transporterFactoryMap, ReportRendererFactory rendererFactory ) { - super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, wagonManager, rendererFactory ); + super( i18n, repositorySystem, aetherRepositorySystem, artifactResolver, transporterFactoryMap, + 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..9937ae49f5 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; @@ -51,6 +50,7 @@ import org.codehaus.mojo.versions.ordering.InvalidSegmentException; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; import org.codehaus.mojo.versions.utils.SegmentUtils; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Attempts to resolve dependency version ranges to the specific version being used in the build. For example a version @@ -130,11 +130,11 @@ public class ResolveRangesMojo public ResolveRangesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..5c0bddab08 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; @@ -65,6 +64,7 @@ import org.codehaus.plexus.components.interactivity.Prompter; import org.codehaus.plexus.components.interactivity.PrompterException; import org.codehaus.plexus.util.StringUtils; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static org.codehaus.plexus.util.StringUtils.isEmpty; @@ -249,12 +249,12 @@ public class SetMojo extends AbstractVersionsUpdaterMojo public SetMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders, Prompter prompter ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..33457f3ced 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; @@ -41,6 +40,7 @@ import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; import org.codehaus.mojo.versions.utils.PropertiesVersionsFileReader; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static org.apache.commons.lang3.StringUtils.defaultString; import static org.apache.commons.lang3.StringUtils.isEmpty; @@ -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 transporterFactoryMap, + ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..fdc7d583cf 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; @@ -20,6 +19,7 @@ import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static org.apache.commons.lang3.StringUtils.isAllBlank; import static org.apache.commons.lang3.StringUtils.isBlank; @@ -70,11 +70,11 @@ public class SetScmTagMojo extends AbstractVersionsUpdaterMojo public SetScmTagMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..f749014d12 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; @@ -44,6 +43,7 @@ import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.recording.DefaultChangeRecord; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Attempts to resolve unlocked snapshot dependency versions to the locked timestamp versions used in the build. For @@ -71,11 +71,11 @@ public class UnlockSnapshotsMojo extends AbstractVersionsDependencyUpdaterMojo public UnlockSnapshotsMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..31366c3af8 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; @@ -41,6 +40,7 @@ import org.codehaus.mojo.versions.api.PomHelper; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Scans the current projects child modules, updating the versions of any which use the current project to the version @@ -73,11 +73,11 @@ public class UpdateChildModulesMojo public UpdateChildModulesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..245f647a95 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; @@ -52,6 +51,7 @@ import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; import org.codehaus.mojo.versions.utils.DependencyBuilder; import org.codehaus.mojo.versions.utils.SegmentUtils; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static org.apache.maven.shared.utils.StringUtils.isBlank; @@ -142,11 +142,11 @@ public class UpdateParentMojo extends AbstractVersionsUpdaterMojo public UpdateParentMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..3619ca1dc6 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; @@ -45,6 +44,7 @@ import org.codehaus.mojo.versions.ordering.InvalidSegmentException; import org.codehaus.mojo.versions.recording.DefaultChangeRecord; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static org.codehaus.mojo.versions.utils.SegmentUtils.determineUnchangedSegment; @@ -143,11 +143,11 @@ public class UpdatePropertiesMojo extends AbstractVersionsDependencyUpdaterMojo public UpdatePropertiesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..5cd4767eed 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; @@ -46,6 +45,7 @@ import org.codehaus.mojo.versions.recording.DefaultChangeRecord; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; import org.codehaus.mojo.versions.utils.SegmentUtils; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Sets a property to the latest version in a given range of associated artifacts. @@ -142,11 +142,11 @@ public class UpdatePropertyMojo public UpdatePropertyMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..9720ae2a5b 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; @@ -43,6 +42,7 @@ import org.codehaus.mojo.versions.api.recording.ChangeRecord; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static java.util.Collections.singletonList; @@ -77,11 +77,11 @@ public class UseDepVersionMojo extends AbstractVersionsDependencyUpdaterMojo public UseDepVersionMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..4e703fd5e1 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; @@ -51,6 +50,7 @@ import org.codehaus.mojo.versions.ordering.InvalidSegmentException; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; import org.codehaus.mojo.versions.utils.SegmentUtils; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static java.util.Collections.singletonList; import static java.util.Optional.empty; @@ -106,11 +106,11 @@ public class UseLatestReleasesMojo public UseLatestReleasesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..27885516a3 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; @@ -47,6 +46,7 @@ import org.codehaus.mojo.versions.ordering.InvalidSegmentException; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; import org.codehaus.mojo.versions.utils.SegmentUtils; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static java.util.Collections.singletonList; import static java.util.Optional.empty; @@ -95,11 +95,11 @@ public class UseLatestSnapshotsMojo public UseLatestSnapshotsMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..4a32cfae70 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; @@ -39,12 +38,13 @@ import org.apache.maven.repository.RepositorySystem; 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; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static java.util.Collections.singletonList; import static java.util.Optional.empty; @@ -103,11 +103,11 @@ public class UseLatestVersionsMojo public UseLatestVersionsMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..e245dc3769 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; @@ -42,6 +41,7 @@ import org.codehaus.mojo.versions.api.recording.ChangeRecord; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Common base class for {@link UseLatestVersionsMojo} @@ -53,11 +53,11 @@ public abstract class UseLatestVersionsMojoBase public UseLatestVersionsMojoBase( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..4845ea59e0 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,11 +35,12 @@ 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.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 org.eclipse.aether.spi.connector.transport.TransporterFactory; import static java.util.Collections.singletonList; import static java.util.Optional.of; @@ -69,11 +69,11 @@ public class UseNextReleasesMojo public UseNextReleasesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..2aba68c908 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; @@ -46,6 +45,7 @@ import org.codehaus.mojo.versions.ordering.InvalidSegmentException; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; import org.codehaus.mojo.versions.utils.SegmentUtils; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static java.util.Collections.singletonList; import static java.util.Optional.empty; @@ -94,11 +94,11 @@ public class UseNextSnapshotsMojo public UseNextSnapshotsMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..b4cc606aa8 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,11 +34,12 @@ 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.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 org.eclipse.aether.spi.connector.transport.TransporterFactory; import static java.util.Collections.singletonList; import static java.util.Optional.of; @@ -61,11 +61,11 @@ public class UseNextVersionsMojo public UseNextVersionsMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..7b48214f86 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; @@ -42,6 +41,7 @@ import org.codehaus.mojo.versions.api.VersionRetrievalException; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; /** * Replaces any versions with the corresponding version from the reactor. @@ -60,11 +60,11 @@ public class UseReactorMojo public UseReactorMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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..a81db64f9e 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; @@ -47,6 +46,7 @@ import org.codehaus.mojo.versions.api.recording.ChangeRecord; import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; +import org.eclipse.aether.spi.connector.transport.TransporterFactory; import static java.util.Collections.singletonList; @@ -87,11 +87,11 @@ public class UseReleasesMojo public UseReleasesMojo( RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, MavenProjectBuilder projectBuilder, - WagonManager wagonManager, + Map transporterFactoryMap, ArtifactResolver artifactResolver, Map changeRecorders ) { - super( repositorySystem, aetherRepositorySystem, projectBuilder, wagonManager, artifactResolver, + super( repositorySystem, aetherRepositorySystem, projectBuilder, transporterFactoryMap, 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; }