1

I need to develop applications here at the company. And inside the company's network there is a *.pac file that determine the destination according to the request. I'm using git as the version control and maven as the dependency manager, after searching on the internet I've found the following link which helped me configure git to work properly:

Getting git to work with a proxy server

Unfortunately, for Maven I couldn't find a way to make it work. I've checked the following links but none seemed to work either:

https://www.mkyong.com/maven/how-to-enable-proxy-setting-in-maven/

https://maven.apache.org/guides/mini/guide-proxies.html

Some comments were telling to configure the settings.xml file in the .m2 folder, I configured it like that:

<proxies>
<proxy>
    <id>p1</id>
    <active>true</active>
    <protocol>http</protocol>
    <host>hostname</host>
    <port>3129</port>
    <username>user</username>
    <password>password</password>
</proxy> 

<proxy>
    <id>p2</id>
    <active>true</active>
    <protocol>https</protocol>
    <host>hostname</host>
    <port>3443</port>
    <username>user</username>
    <password>password</password>
</proxy> 
</proxies>

Even so it doesn't work.

Has anyone went through this problem, does anyone know how to solve it?

Rogerio LR
  • 21
  • 1
  • 5
  • Could be https://issues.apache.org/jira/browse/MNG-6413 . Quite often https is enough, so try removing p1. – Robert Scholte Aug 22 '18 at 17:52
  • Thanks for the answer @Robert, I tried to delete the p1 but still doesn't work. It fails and shows the message: [WARNING] Could not transfer metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Not authorized by proxy , ReasonPhrase:Proxy Authentication Required. – Rogerio LR Aug 22 '18 at 18:16
  • Since you're talking about a company, the best advice is to install a [repository manager](https://maven.apache.org/repository-management.html) and let the manager handle the proxy settings. – Robert Scholte Aug 22 '18 at 18:16
  • You should check if you company (as mine do) uses an script (.pac). In such case, download that script, analyze it and you could see the actual proxy location. Copy it and put it between tags. I could find the script URL in Windows Proxy Configuration page, if its your case, it migth helps. – Francisco M Jun 20 '23 at 12:43

1 Answers1

0

Man, cut this id off and use only http, something like:

<proxy>
  <!--<id>optional</id> -->
  <active>true</active>
  <protocol>http</protocol>
  <username>user</username>
  <password>passwrod</password>
  <host>proxy address without "http://" </host>
  <port>proxyport</port>
  <nonProxyHosts>*.yourdomain.com</nonProxyHosts>
</proxy>    

I put the file setting.xml with this configuration only in my .m2 folder and works like a charm to me.

Yuri
  • 1,691
  • 2
  • 13
  • 12