Loading

mvn deploy to Exchange fails with 401 Unauthorized or "Artifact could not be resolved" - Connected App credential format in settings.xml

Julkaisupäivä: Jun 24, 2026
Kuvaus

PROBLEM

Publishing to Anypoint Exchange via Maven fails with: Exchange publication failed: Artifact could not be resolved or a 401 Unauthorized from the Exchange Maven repository.

ROOT CAUSE

Anypoint Exchange's Maven facade (v3) does not support direct Anypoint Platform username/password authentication when Multi-Factor Authentication (MFA) is enforced on the organization. The Maven client has no mechanism to complete an interactive MFA challenge during a build, so credentials are rejected at the authentication layer before any artifact resolution occurs.

The supported authentication pattern is a Connected App (Client Credentials grant). However, the credentials must be passed in the exact format the Exchange v3 Maven facade expects.

Ratkaisu

SOLUTION

In settings.xml, configure the Exchange server with Connected App credentials using the literal username ~~~Client~~~ and formatting the password as clientId~?~clientSecret. Confirm the ID in settings.xml matches the repositoryId in pom.xml.

<server>
      <id>Repository</id>
      <username>yourUserName</username>
      <password>yourPassword</password>
</server>

    to:

<server>
      <id>Repository</id>
      <username>~~~Client~~~</username> 
      <password>clientID~?~clientSecret</password>
 </server>

 

Knowledge-artikkelin numero

005387636

 
Ladataan
Salesforce Help | Article