Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Information Provided
-
3.9.3
-
None
-
None
Description
Hi.
I've tried to follow the documentation at https://maven.apache.org/guides/mini/guide-resolver-transport.html to migrate from Wagon to the new HTTP Artifact Resolver, but it's not clear to me where and how I should set the new aether.connector.http.preemptiveAuth property in order to make the resolver use it properly, like it was with Wagon.
My (template of the) settings.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" > <localRepository>${env.CI_PROJECT_DIR}/{{ template "maven-m2-folder-name" }}/repository</localRepository> <servers> <server> <id>artifactory.release.credentials</id> <username>{{ template "mandatory-image-credentials-username" .Values.imageCredentials.username }}</username> <password>{{ template "mandatory-image-credentials-password" .Values.imageCredentials.password }}</password> <configuration> <aether.connector.http.preemptiveAuth>true</aether.connector.http.preemptiveAuth> <!-- For Maven 3.8.x --> <httpConfiguration> <all> <usePreemptive>true</usePreemptive> </all> </httpConfiguration> </configuration> </server> <server> <id>artifactory.snapshot.credentials</id> <username>{{ template "mandatory-image-credentials-username" .Values.imageCredentials.username }}</username> <password>{{ template "mandatory-image-credentials-password" .Values.imageCredentials.password }}</password> <configuration> <aether.connector.http.preemptiveAuth>true</aether.connector.http.preemptiveAuth> <!-- For Maven 3.8.x --> <httpConfiguration> <all> <usePreemptive>true</usePreemptive> </all> </httpConfiguration> </configuration> </server> </servers> <profiles> <profile> <id>maven-repository</id> <activation> <activeByDefault>true</activeByDefault> </activation> <repositories> <repository> <id>artifactory.release.credentials</id> <url>{{ template "artifactory-base-url" .Values.imageCredentials.registry }}/artifactory/torrent</url> <releases> <updatePolicy>never</updatePolicy> <checksumPolicy>fail</checksumPolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>artifactory.snapshot.credentials</id> <url>{{ template "artifactory-base-url" .Values.imageCredentials.registry }}/artifactory/torrent-snapshot</url> <releases> <enabled>false</enabled> </releases> </repository> </repositories> </profile> </profiles> <mirrors> <mirror> <id>artifactory.release.credentials</id> <name>Artifactory mirror repository</name> <url>{{ template "artifactory-base-url" .Values.imageCredentials.registry }}/artifactory/torrent</url> <mirrorOf>*,!artifactory.release.credentials,!artifactory.snapshot.credentials</mirrorOf> </mirror> </mirrors> </settings>
but the property seems to be ignored, causing Maven to complain that's not able to find my artifacts.
As (hopefully temporary) solution, I'm setting the MAVEN_ARGS environment variable with the value -Daether.connector.http.preemptiveAuth=true.
The weird thing is that, in DEBUG, I can see that somehow the property is applied and the credentials are picked up
[DEBUG] Using transporter HttpTransporter with priority 5.0 for https://<artifactory-host>/artifactory/<repository>/ [DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://<artifactory-host>/artifactory/<repository>/ with username=<username>, password=***
but, somehow, only once while when applying -Daether.connector.http.preemptiveAuth=true I can see the same logs multiple times (maybe once for every artifact).
Can you please provide some guidance/help on this?
I would also suggest to add to the documentation a/some example/s on how the migration should be really done.
Attachments
Issue Links
- is related to
-
MNG-7849 Improvement in settings/server configuration for http transport
- Open
- links to