Loading

How to manually set the Maven proxy

Udgivelsesdato: Aug 1, 2025
Opgave

GOAL

Many times while troubleshooting an issue, you run maven commands from the terminal without Studio IDE opened.
The goal is to configure your Maven app to use a proxy, without using Studio to insert the proxy setting by itself
 
Trin
The following configuration could be done in the project's pom.xml file, or your personal ~/.m2/settings.xml file
 
<settings>
  <proxies>
   <proxy>
      <id>example-proxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.example.com</host>
      <port>8080</port>
      <username>proxyuser</username>
      <password>somepassword</password>
      <nonProxyHosts>www.domain1.com|*.domain2.com</nonProxyHosts>
    </proxy>
  </proxies>
</settings>

In the previous XML, we configure the Maven app to use the "proxy.example.com:8080" proxy with "username:password" credentials and even omit some domains from the proxy usage

You may test this by running the following command from a project's root folder
 
mvn -X clean package

 
Vidensartikelnummer

001117178

 
Indlæser
Salesforce Help | Article