Skip to content

Commit f7ca0b6

Browse files
authored
[MNG-7608] Make native transport the default (#961)
This immediately cuts in "half" the count of HTTP requests against Maven Central or any major MRM. Altering the meaning of "default": is now same as "auto", but still leaving it in place for future, as "default" at some point may again become something different than "native". --- https://issues.apache.org/jira/browse/MNG-7608
1 parent 51354e6 commit f7ca0b6

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -324,23 +324,7 @@ public DefaultRepositorySystemSession newRepositorySession(MavenExecutionRequest
324324

325325
Object transport = configProps.getOrDefault(MAVEN_RESOLVER_TRANSPORT_KEY, MAVEN_RESOLVER_TRANSPORT_DEFAULT);
326326
if (MAVEN_RESOLVER_TRANSPORT_DEFAULT.equals(transport)) {
327-
// The "default" mode (user did not set anything) needs to tweak resolver default priorities
328-
// that are coded like this (default values):
329-
//
330-
// org.eclipse.aether.transport.http.HttpTransporterFactory.priority = 5.0f;
331-
// org.eclipse.aether.transport.wagon.WagonTransporterFactory.priority = -1.0f;
332-
//
333-
// Hence, as both are present on classpath, HttpTransport would be selected, while
334-
// we want to retain "default" behaviour of Maven and use Wagon. To achieve that,
335-
// we set explicitly priority of WagonTransport to 6.0f (just above of HttpTransport),
336-
// to make it "win" over HttpTransport. We do this to NOT interfere with possibly
337-
// installed OTHER transports and their priorities, as unlike "wagon" or "native"
338-
// transport setting, that sets priorities to MAX, hence prevents any 3rd party
339-
// transport to get into play (inhibits them), in default mode we want to retain
340-
// old behavior. Also, this "default" mode is different from "auto" setting,
341-
// as it does not alter resolver priorities at all, and uses priorities as is.
342-
343-
configProps.put(WAGON_TRANSPORTER_PRIORITY_KEY, "6");
327+
// The "default" mode (user did not set anything) from now on defaults to AUTO
344328
} else if (MAVEN_RESOLVER_TRANSPORT_NATIVE.equals(transport)) {
345329
// Make sure (whatever extra priority is set) that resolver native is selected
346330
configProps.put(NATIVE_FILE_TRANSPORTER_PRIORITY_KEY, RESOLVER_MAX_PRIORITY);

0 commit comments

Comments
 (0)