[MNG-7454] Include resolver-transport-http in Maven (#720)

Addendum to be2b7f890d98af20eb0753650b6605a68a97ac05:
* fix property name to align with existing ones
* fix logging configuration as no more shaded httpClient
* fix constant names
This commit is contained in:
Tamas Cservenak 2022-04-16 18:19:23 +02:00 committed by GitHub
parent 643d1e7828
commit 551009ab49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 21 deletions

View File

@ -26,7 +26,5 @@ org.slf4j.simpleLogger.log.Sisu=info
org.slf4j.simpleLogger.warnLevelString=WARNING
# MNG-6181: mvn -X also prints all debug logging from HttpClient
# Be aware that the shaded packages are used
# org.apache.http -> org.apache.maven.wagon.providers.http.httpclient
org.slf4j.simpleLogger.log.org.apache.maven.wagon.providers.http.httpclient=off
org.slf4j.simpleLogger.log.org.apache.maven.wagon.providers.http.httpclient.wire=off
org.slf4j.simpleLogger.log.org.apache.http=off
org.slf4j.simpleLogger.log.org.apache.http.wire=off

View File

@ -78,19 +78,19 @@ import org.slf4j.LoggerFactory;
@Named
public class DefaultRepositorySystemSessionFactory
{
private static final String MAVEN_TRANSPORT_KEY = "maven.transport";
private static final String MAVEN_RESOLVER_TRANSPORT_KEY = "maven.resolver.transport";
private static final String MAVEN_TRANSPORT_WAGON = "wagon";
private static final String MAVEN_RESOLVER_TRANSPORT_WAGON = "wagon";
private static final String MAVEN_TRANSPORT_RESOLVER = "resolver";
private static final String MAVEN_RESOLVER_TRANSPORT_NATIVE = "native";
private static final String MAVEN_TRANSPORT_AUTO = "auto";
private static final String MAVEN_RESOLVER_TRANSPORT_AUTO = "auto";
private static final String WAGON_TRANSPORTER_KEY_PRIORITY_KEY = "aether.priority.WagonTransporterFactory";
private static final String WAGON_TRANSPORTER_PRIORITY_KEY = "aether.priority.WagonTransporterFactory";
private static final String RESOLVER_HTTP_TRANSPORTER_PRIORITY_KEY = "aether.priority.HttpTransporterFactory";
private static final String NATIVE_HTTP_TRANSPORTER_PRIORITY_KEY = "aether.priority.HttpTransporterFactory";
private static final String RESOLVER_FILE_TRANSPORTER_PRIORITY_KEY = "aether.priority.FileTransporterFactory";
private static final String NATIVE_FILE_TRANSPORTER_PRIORITY_KEY = "aether.priority.FileTransporterFactory";
private static final String RESOLVER_MAX_PRIORITY = String.valueOf( Float.MAX_VALUE );
@ -261,23 +261,24 @@ public class DefaultRepositorySystemSessionFactory
}
session.setAuthenticationSelector( authSelector );
String transport = request.getUserProperties().getProperty( MAVEN_TRANSPORT_KEY, MAVEN_TRANSPORT_WAGON );
if ( MAVEN_TRANSPORT_RESOLVER.equals( transport ) )
String transport = request.getUserProperties()
.getProperty( MAVEN_RESOLVER_TRANSPORT_KEY, MAVEN_RESOLVER_TRANSPORT_WAGON );
if ( MAVEN_RESOLVER_TRANSPORT_NATIVE.equals( transport ) )
{
// Make sure (whatever extra priority is set) that resolver native is selected
configProps.put( RESOLVER_FILE_TRANSPORTER_PRIORITY_KEY, RESOLVER_MAX_PRIORITY );
configProps.put( RESOLVER_HTTP_TRANSPORTER_PRIORITY_KEY, RESOLVER_MAX_PRIORITY );
configProps.put( NATIVE_FILE_TRANSPORTER_PRIORITY_KEY, RESOLVER_MAX_PRIORITY );
configProps.put( NATIVE_HTTP_TRANSPORTER_PRIORITY_KEY, RESOLVER_MAX_PRIORITY );
}
else if ( MAVEN_TRANSPORT_WAGON.equals( transport ) )
else if ( MAVEN_RESOLVER_TRANSPORT_WAGON.equals( transport ) )
{
// Make sure (whatever extra priority is set) that wagon is selected
configProps.put( WAGON_TRANSPORTER_KEY_PRIORITY_KEY, RESOLVER_MAX_PRIORITY );
configProps.put( WAGON_TRANSPORTER_PRIORITY_KEY, RESOLVER_MAX_PRIORITY );
}
else if ( !MAVEN_TRANSPORT_AUTO.equals( transport ) )
else if ( !MAVEN_RESOLVER_TRANSPORT_AUTO.equals( transport ) )
{
throw new IllegalArgumentException( "Unknown maven.transport=" + transport
+ ". Supported ones are: " + MAVEN_TRANSPORT_WAGON + ", "
+ MAVEN_TRANSPORT_RESOLVER + " and " + MAVEN_TRANSPORT_AUTO );
throw new IllegalArgumentException( "Unknown resolver transport '" + transport
+ "'. Supported transports are: " + MAVEN_RESOLVER_TRANSPORT_WAGON + ", "
+ MAVEN_RESOLVER_TRANSPORT_NATIVE + ", " + MAVEN_RESOLVER_TRANSPORT_AUTO );
}
session.setTransferListener( request.getTransferListener() );