[ 
https://issues.apache.org/jira/browse/MNG-7850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17746211#comment-17746211
 ] 

Cosimo Damiano Prete edited comment on MNG-7850 at 7/24/23 6:11 AM:
--------------------------------------------------------------------

Hi.
I've updated my {{settings.xml}} as follows (and removed the property from the 
{{MAVEN_ARGS}}), but I then get the same issue:
{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}/.m2/repository</localRepository>
  <servers>
    <server>
      <id>artifactory.release.credentials</id>
      <username>[MASKED]</username>
      <password>[MASKED]</password>
      <configuration>
        <!-- For Maven 3.8.x -->
        <httpConfiguration>
            <all>
                <usePreemptive>true</usePreemptive>
            </all>
        </httpConfiguration>
      </configuration>
    </server>
    <server>
      <id>artifactory.snapshot.credentials</id>
      <username>[MASKED]</username>
      <password>[MASKED]</password>
      <configuration>
        <!-- For Maven 3.8.x -->
        <httpConfiguration>
            <all>
                <usePreemptive>true</usePreemptive>
            </all>
        </httpConfiguration>
      </configuration>
    </server>
  </servers>
  <profiles>
    <profile>
      <id>maven-settings</id>
     <activation>
       <file><exists>.</exists></file>
      </activation>
      <properties>
        
<aether.connector.http.preemptiveAuth>true</aether.connector.http.preemptiveAuth>
      </properties>
      <repositories>
        <repository>
          <id>artifactory.release.credentials</id>
          <url>https://[MASKED]/artifactory/torrent</url>
          <releases>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>fail</checksumPolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>artifactory.snapshot.credentials</id>
          <url>https://[MASKED]/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>https://[MASKED]/artifactory/torrent</url>
          
<mirrorOf>*,!artifactory.release.credentials,!artifactory.snapshot.credentials</mirrorOf>
      </mirror>
  </mirrors>
</settings>
{code}


was (Author: JIRAUSER301468):
Hi.
I've updated my {{settings.xml}} as follows (and removed the property from the 
{{MAVEN_ARGS}}), but I still get the same issue:
{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}/.m2/repository</localRepository>
  <servers>
    <server>
      <id>artifactory.release.credentials</id>
      <username>[MASKED]</username>
      <password>[MASKED]</password>
      <configuration>
        <!-- For Maven 3.8.x -->
        <httpConfiguration>
            <all>
                <usePreemptive>true</usePreemptive>
            </all>
        </httpConfiguration>
      </configuration>
    </server>
    <server>
      <id>artifactory.snapshot.credentials</id>
      <username>[MASKED]</username>
      <password>[MASKED]</password>
      <configuration>
        <!-- For Maven 3.8.x -->
        <httpConfiguration>
            <all>
                <usePreemptive>true</usePreemptive>
            </all>
        </httpConfiguration>
      </configuration>
    </server>
  </servers>
  <profiles>
    <profile>
      <id>maven-settings</id>
     <activation>
       <file><exists>.</exists></file>
      </activation>
      <properties>
        
<aether.connector.http.preemptiveAuth>true</aether.connector.http.preemptiveAuth>
      </properties>
      <repositories>
        <repository>
          <id>artifactory.release.credentials</id>
          <url>https://[MASKED]/artifactory/torrent</url>
          <releases>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>fail</checksumPolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>artifactory.snapshot.credentials</id>
          <url>https://[MASKED]/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>https://[MASKED]/artifactory/torrent</url>
          
<mirrorOf>*,!artifactory.release.credentials,!artifactory.snapshot.credentials</mirrorOf>
      </mirror>
  </mirrors>
</settings>
{code}

> 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
>            Priority: Major
>
> 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 thing 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)

Reply via email to