Intellij Community can't use http proxy for Ma

2019-01-17 10:56发布

I have Intellij IDEA Community installed on a Linux box that needs to use an authenticated proxy to get to the Internet. I have a system-wide proxy on the box that works, and I have the proxy configured in ~/.m2/settings.xml. Maven correctly uses the proxy when I run try it from the command-line.

I have the same proxy configured within Intellij and it gives me the plugins listing correctly. But when I try to sync with the Maven repository withing Intellij I keep getting this:

[WARNING] Unable to get resource 'org.codehaus.mojo:hibernate3-maven-plugin:pom:2.2' 
from  repository restlet (http://maven.restlet.org): Authorization failed: Not   
authorized by proxy.

I went to Settings->Maven and put in the proxy info as properties and that didn't work. I can see by looking at those settings that Intellij is reading my ~./m2/settings.xml fine because it knows where my local repo is (it's in a non-standard place).

Anyone know how I can get this working?

8条回答
ら.Afraid
2楼-- · 2019-01-17 11:10

I commented out the proxy config in my ~/.m2/settings.xml file, let the Intellij Proxy info alone, and then supplied the properties in Setting->Maven. Not sure why that worked (nor why the settings.xml wasn't working right) but it's working now.

查看更多
倾城 Initia
3楼-- · 2019-01-17 11:13

Can you try either removing the proxy setting in settings.xml or the setting in IntelliJ itself.

And then try to sync with the maven repo from within Intellij.

查看更多
Root(大扎)
4楼-- · 2019-01-17 11:19

I had the same problem running maven inside IntelliJ whilst behind an NTLM proxy. The working solution was as follows:

  1. Download and install CNTLM. Excellent post here on how to do this https://stackoverflow.com/a/23962313/3298801
  2. Set and test your local proxy settings in IntelliJ via Settings >> System Settings >> HTTP Proxy.
  3. In Intellij set the maven runner. Within Settings >> Maven >> runner set VM options to:
    -DproxySet=true -DproxyHost=localhost -DproxyPort=3132
  4. Restart Intellij
  5. Note within ~/.m2/settings.xml I also added my proxy config as:
<proxies>
        <proxy>
            <active>true</active>
            <protocol>https</protocol>
            <host>localhost</host>
            <port>3132</port> 
        </proxy>
</proxies>
查看更多
兄弟一词,经得起流年.
5楼-- · 2019-01-17 11:19

I have had the same issue. However, my proxy settings were stored under the environment variable *M2_OPTS*.

As per the above posts, deleting the environment variables stopped IDEA from hanging.

This is under Windows 7, using IntelliJ IDEA CE 12.3

If anyone notices an open bugfix for this please respond with a link.

查看更多
淡お忘
6楼-- · 2019-01-17 11:20

I Have found similar issues with the Maven 2.2 integration in intellij 9. I am using 9.0.1

I use intellij behind a corporate firewall/proxy. If I point Intellij's maven conf to use external Maven and maven conf that has the proxy settings inside, intellij fails to download artifacts from any remote repositories.

Had no problems with intellij-8, this only started after the upgrade. The Maven conf has not changed either.

I have to do a Maven build from command line to get any new dependent artifacts into my local repo then use intellij-9.

The Maven 2.2 integration has issues behind proxy servers.

查看更多
7楼-- · 2019-01-17 11:21
  1. Navigate to Maven > Importing. inside the IntelliJ IDEA Settings (which is found under File > Settings).

  2. The second last option in Maven > Importing is a field named "VM options for importer". Append the following to whatever already exists there:

    -DproxySet=true -DproxyHost=myproxy.com -DproxyPort=3128

    Here, replace myproxy.com with your proxy server, (e.g. http://myproxyserver.com). Replace 3128 with your proxy port (e.g. 8080).

  3. Apply and close the settings window.

  4. Restart IntelliJ.

It should work now.


This may be nested under Build, Execution, Deployment > Build Tools >, depending on the version of IntelliJ you're using.

查看更多
登录 后发表回答