Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij Community can't use http proxy for Maven

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?

like image 902
MikeHoss Avatar asked Nov 23 '09 16:11

MikeHoss


People also ask

Does IntelliJ Community Edition support Maven?

Maven IntelliJ IDEA supports a fully-functional integration with Maven that helps you automate your building process. You can easily create a new Maven project, open and sync an existing one, add a Maven support to any existing IntelliJ IDEA project, configure and manage a multi-module project.

How do I change proxy settings in IntelliJ?

Configure proxy settings directly from IntelliJ IDEA. Do the following: Open the Version Control | Subversion | Network page of the IDE settings Ctrl+Alt+S . Click the Edit Network Options button and specify the proxy settings in the Edit Subversion Options Related to Network Layers dialog that opens.


2 Answers

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> 
like image 39
user3298801 Avatar answered Oct 05 '22 12:10

user3298801


  1. Navigate to Maven > Importing1. 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. Do the same under Maven > Runner1

  4. Apply and close the settings window.

It should work now.


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

like image 67
DrBug Avatar answered Oct 05 '22 13:10

DrBug