You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Cosimo Damiano Prete (Jira)" <ji...@apache.org> on 2023/07/23 17:09:00 UTC

[jira] [Created] (MNG-7850) Artifact Resolver config is ignored

Cosimo Damiano Prete created MNG-7850:
-----------------------------------------

             Summary: Artifact Resolver config is ignored
                 Key: MNG-7850
                 URL: https://issues.apache.org/jira/browse/MNG-7850
             Project: Maven
          Issue Type: Bug
          Components: Documentation:  General
    Affects Versions: 3.9.3
            Reporter: Cosimo Damiano Prete


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:
{code:xml}
<?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>
{code}
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 this is that, in {{{}DEBUG{}}}, I can see that somehow the property is applied and the credentials are picked up
{code:bash}
[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=*** {code}
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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)