37

I'm having problems importing any Maven projects into IntelliJ IDEA. I create an empty Maven project like this:

$ mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Then I try to open the project in IDEA (File > Open Project, then choose the pom.xml). A progress box saying "Reading pom.xml" displays for a few minutes, and then just disappears without opening the project.

Looking in the IDEA log, I see some connection timeout exceptions like this:

2012-10-03 11:55:38,502 [      0]   INFO -        #com.intellij.idea.Main - ------------------------------------------------------ IDE STARTED ------------------------------------------------------ 
2012-10-03 11:55:38,512 [     10]   INFO -        #com.intellij.idea.Main - IDE: IntelliJ IDEA (build #IC-117.798, 25 Jul 2012 00:00) 
2012-10-03 11:55:38,512 [     10]   INFO -        #com.intellij.idea.Main - JRE: 1.6.0_25-b06 (Sun Microsystems Inc.) 
2012-10-03 11:55:38,512 [     10]   INFO -        #com.intellij.idea.Main - JVM: 20.0-b11 (Sun Microsystems Inc.) 
2012-10-03 11:55:38,539 [     37]   INFO - .intellij.idea.IdeaApplication - WM detected: Compiz 
2012-10-03 11:55:40,328 [   1826]   INFO - llij.ide.plugins.PluginManager - 28 plugins initialized in 1613 ms 
2012-10-03 11:55:40,328 [   1826]   INFO - llij.ide.plugins.PluginManager - Loaded plugins:IDEA CORE, Properties Support, Ant Support (1.0), XPathView + XSLT Support (4), IntelliLang (8.0), Copyright (8.1), Groovy (9.0), Maven Integration, Scala (0.5.981), Git Integration (8.1), Task Management (1.0), GitHub, hg4idea (10.0), CVS Integration (11), Intention Power Pack (1.0), I18n for Java, TestNG-J (8.0), GenerateToString (5.0), Commander (1.0.0), Plugin DevKit (1.0), UI Designer, Gradle, Eclipse Integration (3.0), Inspection Gadgets (1.0), JUnit (1.0), Subversion Integration (1.1), XSLT-Debugger (1.4), Android Support (10.0) 
2012-10-03 11:55:40,755 [   2253]   INFO - ellij.util.io.PagedFileStorage - lower=100; upper=200; buffer=10; mmap=true 
2012-10-03 11:55:40,799 [   2297]   INFO - api.vfs.impl.local.FileWatcher - Starting file watcher: /usr/lib/idea-IC-117.798/bin/fsnotifier64 
2012-10-03 11:55:40,800 [   2298]   INFO - api.vfs.impl.local.FileWatcher - Native file watcher is operational. 
2012-10-03 11:55:41,181 [   2679]   INFO - s.impl.stores.FileBasedStorage - Document was not loaded for $APP_CONFIG$/ui.lnf.xml file is null 
2012-10-03 11:55:41,181 [   2679]   INFO - .impl.stores.XmlElementStorage - Document was not loaded for $APP_CONFIG$/ui.lnf.xml 
2012-10-03 11:55:41,824 [   3322]   INFO -                  TestNG Runner - Create TestNG Template Configuration 
2012-10-03 11:55:41,833 [   3331]   INFO -                  TestNG Runner - Create TestNG Template Configuration 
2012-10-03 11:55:41,935 [   3433]   INFO - ellij.project.impl.ProjectImpl - 23 project components initialized in 693 ms 
2012-10-03 11:55:41,936 [   3434]   INFO - .module.impl.ModuleManagerImpl - 0 modules loaded in 0 ms 
2012-10-03 11:55:41,948 [   3446]   INFO - .intellij.ide.XmlRpcServerImpl - XmlRpc server listening at /127.0.0.1:63342 
2012-10-03 11:55:42,252 [   3750]   INFO - s.impl.stores.FileBasedStorage - Document was not loaded for $APP_CONFIG$/macros.xml file is null 
2012-10-03 11:55:42,252 [   3750]   INFO - .impl.stores.XmlElementStorage - Document was not loaded for $APP_CONFIG$/macros.xml 
2012-10-03 11:55:42,256 [   3754]   INFO - s.impl.stores.FileBasedStorage - Document was not loaded for $APP_CONFIG$/quicklists.xml file is null 
2012-10-03 11:55:42,256 [   3754]   INFO - .impl.stores.XmlElementStorage - Document was not loaded for $APP_CONFIG$/quicklists.xml 
2012-10-03 11:55:42,330 [   3828]   INFO - pl.stores.ApplicationStoreImpl - 79 application components initialized in 1910 ms 
2012-10-03 11:55:42,345 [   3843]   INFO - s.impl.stores.FileBasedStorage - Document was not loaded for $APP_CONFIG$/customization.xml file is null 
2012-10-03 11:55:42,345 [   3843]   INFO - .impl.stores.XmlElementStorage - Document was not loaded for $APP_CONFIG$/customization.xml 
2012-10-03 11:55:42,499 [   3997]   INFO - ij.openapi.wm.impl.IdeRootPane - App initialization took 4825 ms 
2012-10-03 11:55:50,842 [  12340]   INFO - s.impl.stores.FileBasedStorage - Document was not loaded for $APP_CONFIG$/plainTextFiles.xml file is null 
2012-10-03 11:55:50,842 [  12340]   INFO - .impl.stores.XmlElementStorage - Document was not loaded for $APP_CONFIG$/plainTextFiles.xml 
2012-10-03 11:55:55,348 [  16846]   INFO - ution.rmi.RemoteProcessSupport - /usr/lib/jvm/jdk1.6.0_25/jre/bin/java -Djava.awt.headless=true -Xmx512m -Dfile.encoding=UTF-8 -classpath /usr/lib/idea-IC-117.798/lib/resources_en.jar:/usr/lib/idea-IC-117.798/lib/annotations.jar:/usr/lib/idea-IC-117.798/lib/util.jar:/usr/lib/idea-IC-117.798/lib/trove4j.jar:/usr/lib/idea-IC-117.798/lib/jdom.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/lucene-core-2.4.1.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/activation-1.1.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/maven-2.2.1-uber.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/maven2-server-impl.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/jaxb-impl.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/jaxb-api.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/maven-embedder-1.1-SNAPSHOT.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/classworlds-1.1.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/resources_en.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/commons-beanutils.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/mercury-artifact-1.0-alpha-6.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/maven-server-api.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/maven-dependency-tree-1.2.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/archetype-common-2.0-alpha-4-SNAPSHOT.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/plexus-utils-1.5.5.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/wadl-core.jar:/usr/lib/idea-IC-117.798/plugins/maven/lib/nexus-indexer-1.2.3.jar org.jetbrains.idea.maven.server.RemoteMavenServer 
2012-10-03 11:55:55,483 [  16981]   INFO - ution.rmi.RemoteProcessSupport - Port/ID: 18011/Maven2ServerImpl9407569f 
2012-10-03 11:56:58,898 [  80396]   WARN - ution.rmi.RemoteProcessSupport - The cook failed to start due to java.net.ConnectException: Connection timed out 
2012-10-03 11:57:55,483 [ 136981]   WARN - ution.rmi.RemoteProcessSupport - java.rmi.NotBoundException: _DEAD_HAND_ 
2012-10-03 11:57:55,484 [ 136982]   WARN - ution.rmi.RemoteProcessSupport - at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:106) 
2012-10-03 11:57:55,484 [ 136982]   WARN - ution.rmi.RemoteProcessSupport - at com.intellij.execution.rmi.RemoteServer.start(RemoteServer.java:73) 
2012-10-03 11:57:55,484 [ 136982]   WARN - ution.rmi.RemoteProcessSupport - at org.jetbrains.idea.maven.server.RemoteMavenServer.main(RemoteMavenServer.java:22) 
2012-10-03 11:58:01,749 [ 143247]  ERROR - com.intellij.ide.IdeEventQueue - Error during dispatching of java.awt.event.MouseEvent[MOUSE_RELEASED,(65,116),absolute(64,140),button=1,modifiers=Button1,clickCount=1] on frame0 
java.lang.RuntimeException: Cannot reconnect.
    at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:82)
    at org.jetbrains.idea.maven.server.MavenServerManager.applyProfiles(MavenServerManager.java:311)
    at org.jetbrains.idea.maven.project.MavenProjectReader.applyProfiles(MavenProjectReader.java:369)
    at org.jetbrains.idea.maven.project.MavenProjectReader.doReadProjectModel(MavenProjectReader.java:98)
    at org.jetbrains.idea.maven.project.MavenProjectReader.readProject(MavenProjectReader.java:52)
    at org.jetbrains.idea.maven.project.MavenProject.read(MavenProject.java:405)
    at org.jetbrains.idea.maven.project.MavenProjectsTree.doUpdate(MavenProjectsTree.java:534)
    at org.jetbrains.idea.maven.project.MavenProjectsTree.doAdd(MavenProjectsTree.java:481)
    at org.jetbrains.idea.maven.project.MavenProjectsTree.update(MavenProjectsTree.java:442)
    at org.jetbrains.idea.maven.project.MavenProjectsTree.updateAll(MavenProjectsTree.java:413)
    at org.jetbrains.idea.maven.wizards.MavenProjectBuilder.readMavenProjectTree(MavenProjectBuilder.java:198)
    at org.jetbrains.idea.maven.wizards.MavenProjectBuilder.access$800(MavenProjectBuilder.java:44)
    at org.jetbrains.idea.maven.wizards.MavenProjectBuilder$3.run(MavenProjectBuilder.java:179)
    at org.jetbrains.idea.maven.utils.MavenUtil$8.run(MavenUtil.java:388)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:469)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$6.run(ProgressManagerImpl.java:288)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:218)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:169)
    at com.intellij.openapi.application.impl.ApplicationImpl$8$1.run(ApplicationImpl.java:641)
    at com.intellij.openapi.application.impl.ApplicationImpl$6.run(ApplicationImpl.java:434)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:145)
Caused by: java.rmi.RemoteException: Cannot start maven service; nested exception is: 
    java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: 
    java.net.ConnectException: Connection timed out
    at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:120)
    at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:71)
    at org.jetbrains.idea.maven.server.RemoteObjectWrapper.getOrCreateWrappee(RemoteObjectWrapper.java:41)
    at org.jetbrains.idea.maven.server.MavenServerManager$8.execute(MavenServerManager.java:314)
    at org.jetbrains.idea.maven.server.MavenServerManager$8.execute(MavenServerManager.java:311)
    at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:76)
    ... 27 more
Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: 
    java.net.ConnectException: Connection timed out
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at com.intellij.execution.rmi.RemoteProcessSupport$2.compute(RemoteProcessSupport.java:215)
    at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:122)
    at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:212)
    at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:133)
    at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:117)
    ... 32 more
Caused by: java.net.ConnectException: Connection timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:529)
    at java.net.Socket.connect(Socket.java:478)
    at java.net.Socket.(Socket.java:375)
    at java.net.Socket.(Socket.java:189)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
    ... 41 more
2012-10-03 11:58:01,752 [ 143250]  ERROR - com.intellij.ide.IdeEventQueue - IntelliJ IDEA 11.1.3  Build #IC-117.798 
2012-10-03 11:58:01,752 [ 143250]  ERROR - com.intellij.ide.IdeEventQueue - JDK: 1.6.0_25 
2012-10-03 11:58:01,752 [ 143250]  ERROR - com.intellij.ide.IdeEventQueue - VM: Java HotSpot(TM) 64-Bit Server VM 
2012-10-03 11:58:01,752 [ 143250]  ERROR - com.intellij.ide.IdeEventQueue - Vendor: Sun Microsystems Inc. 
2012-10-03 11:58:01,752 [ 143250]  ERROR - com.intellij.ide.IdeEventQueue - OS: Linux 
2012-10-03 11:58:01,752 [ 143250]  ERROR - com.intellij.ide.IdeEventQueue - Last Action: OpenProject 
2012-10-03 11:58:01,752 [ 143250]  ERROR - com.intellij.ide.IdeEventQueue - Original exception:  
java.rmi.RemoteException: Cannot start maven service; nested exception is: 
    java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: 
    java.net.ConnectException: Connection timed out
    at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:120)
    at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:71)
    at org.jetbrains.idea.maven.server.RemoteObjectWrapper.getOrCreateWrappee(RemoteObjectWrapper.java:41)
    at org.jetbrains.idea.maven.server.MavenServerManager$8.execute(MavenServerManager.java:314)
    at org.jetbrains.idea.maven.server.MavenServerManager$8.execute(MavenServerManager.java:311)
    at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:76)
    at org.jetbrains.idea.maven.server.MavenServerManager.applyProfiles(MavenServerManager.java:311)
    at org.jetbrains.idea.maven.project.MavenProjectReader.applyProfiles(MavenProjectReader.java:369)
    at org.jetbrains.idea.maven.project.MavenProjectReader.doReadProjectModel(MavenProjectReader.java:98)
    at org.jetbrains.idea.maven.project.MavenProjectReader.readProject(MavenProjectReader.java:52)
    at org.jetbrains.idea.maven.project.MavenProject.read(MavenProject.java:405)
    at org.jetbrains.idea.maven.project.MavenProjectsTree.doUpdate(MavenProjectsTree.java:534)
    at org.jetbrains.idea.maven.project.MavenProjectsTree.doAdd(MavenProjectsTree.java:481)
    at org.jetbrains.idea.maven.project.MavenProjectsTree.update(MavenProjectsTree.java:442)
    at org.jetbrains.idea.maven.project.MavenProjectsTree.updateAll(MavenProjectsTree.java:413)
    at org.jetbrains.idea.maven.wizards.MavenProjectBuilder.readMavenProjectTree(MavenProjectBuilder.java:198)
    at org.jetbrains.idea.maven.wizards.MavenProjectBuilder.access$800(MavenProjectBuilder.java:44)
    at org.jetbrains.idea.maven.wizards.MavenProjectBuilder$3.run(MavenProjectBuilder.java:179)
    at org.jetbrains.idea.maven.utils.MavenUtil$8.run(MavenUtil.java:388)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:469)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$6.run(ProgressManagerImpl.java:288)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:218)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:169)
    at com.intellij.openapi.application.impl.ApplicationImpl$8$1.run(ApplicationImpl.java:641)
    at com.intellij.openapi.application.impl.ApplicationImpl$6.run(ApplicationImpl.java:434)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:145)
Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: 
    java.net.ConnectException: Connection timed out
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at com.intellij.execution.rmi.RemoteProcessSupport$2.compute(RemoteProcessSupport.java:215)
    at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:122)
    at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:212)
    at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:133)
    at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:117)
    ... 32 more
Caused by: java.net.ConnectException: Connection timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:529)
    at java.net.Socket.connect(Socket.java:478)
    at java.net.Socket.(Socket.java:375)
    at java.net.Socket.(Socket.java:189)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
    ... 41 more

I'm using the latest versions of IDEA (11.1.3) and Maven (3.0.4). Any ideas what I am doing wrong?

del
  • 6,341
  • 10
  • 42
  • 45
  • It can be a firewall or other networking issue, see http://youtrack.jetbrains.com/issue/IDEA-64132#comment=27-380070. – CrazyCoder Oct 03 '12 at 06:17
  • @CrazyCoder - Thanks! Adding `127.0.0.1 localhost` to `/etc/hosts` fixed the problem. If you post your comment as an answer, I can accept it as the solution. – del Oct 03 '12 at 06:25

12 Answers12

79

It's a common problem related to networking and address resolution. In some cases localhost may not resolve and it's required to have

127.0.0.1 localhost

in /etc/hosts file. Also make sure there are no other IP addresses mapped to localhost.

See my comment in the related YouTrack issue for more details.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • 2
    Slightly different, but I had a rogue entry in my /etc/hosts file (after rebuilding domain profile). Editing the /etc/hosts file and removing this as per @CrazyCoder's answer fixed the issue, IntelliJ now importing maven pom files correctly. – Andrew Eells Jul 22 '15 at 12:59
  • 1
    AND also do not have any other ip´s directing to localhost! – Macilias Feb 23 '16 at 15:52
  • @CrazyCoder Plea update your answer to include Macilias comment. Is is necessary to remove other mappings of any IP redirecting to localhost. I faced the same issue and got fixed by it. – Sachin Jain Jun 23 '16 at 11:58
  • Thanks @CrazyCoder its save lots of time, i was trying to resolve since last two weeks. – Nilesh Kikani Aug 30 '17 at 16:52
  • I could not correctly import maven dependencies in intellij maven view, because of a local proxy in witch I forgot to exclude localhost and 127.0.0.1 – user1767316 Nov 06 '19 at 13:18
  • in my case, I changed JAVA_HOME path before and maven throw this error. – Amir Azizkhani May 14 '21 at 17:15
43

I'm using the community edition 2017.2.1 and I had the same issue, I had to change the JDK version of the maven importer to the correct version(from 1.6 to 1.8) to make it work.

enter image description here

Zeus
  • 6,386
  • 6
  • 54
  • 89
  • I cannot (update repo index / download source) for several months, had to do it manually in console, and now Google lead me to this post, finally solved! – mickey Sep 02 '20 at 01:49
  • I had the same issue when trying to download source code of my dependencies. I fixed it by changing the JDK as explained in your answer – Enrico Giurin Mar 02 '21 at 17:52
  • This might be an old answer, but in 2021 it solved it for me. I am using Ultimate 2020.3 on Windows 10. – Jose Martinez Mar 04 '21 at 13:22
12

To correct this issue for me in 14.1.3 Ultimate, I had to add

-Didea.maven3.use.compat.resolver

to VM options for importer under Preferences > Build, Execution, Deployment > Build Tools > Importing

per the bug at https://youtrack.jetbrains.com/issue/IDEA-140208.

Najitaka
  • 335
  • 1
  • 4
  • 9
6

I had a similar issue running groovy script with IDEA 12. The problem was the same as @CrazyCoder stated. Solution was based on what @kevinmrohr did just a little easier to find and setup.

To solve the problem I edited idea.exe.vmoptions located in the bin directory (idea64.exe.vmoptions if you are using 64 bit version) and added -Djava.net.preferIPv4Stack=true.

Restarted IDEA and everything was working without any issues.

krešimir
  • 61
  • 1
  • 4
3

I had this same problem. I don't know what caused it to start happening, I only know how I fixed it.

I found from looking at lsof -i -P that the maven remote server was attempting to run on IPv6, and apparently IntelliJ could not speak to it on IPv6. I'm not sure if it used to run on IPv4 and something caused it to start using IPv6, or if it always used IPv6 and a mac update somehow made it stop working.

Anyway, the solution I used was to edit /Applications/IntelliJ IDEA 11.app/Contents/Info.plist and add the java.net.preferIPv4Stack parameter to the java process:

<key>java</key>
<dict>
  <key>Properties</key>
  <dict>
    <key>java.net.preferIPv4Stack</key>
    <string>true</string>
  </dict>
</dict>

I really wish I could give more information about why this happened to begin with.

kevinmrohr
  • 821
  • 7
  • 11
1

Find out what process on your machine is holding the port. On Ubuntu Linux, I executed the following commands:

ps -ef | grep idea

Noticed that there is a Java process running the class org.jetbrains.idea.maven.server.RemoteMavenServer

I noted the pid of 2772 and executed

netstat -anp | grep 2772

I noted that pid 2772 was listening on port 6942

I telneted to that port:

telnet localhost 6942
Trying 127.0.0.1...  
Connected to localhost.
Escape character is '^]'.
/home/noahlz/.IdeaIC11/config/ home/noahlz/.IdeaIC11/system

So the Maven component used by IntelliJ runs as a distinct server process, which IntelliJ speaks to over a socket. You'll need to determine why IntelliJ can't reach that server port on your machine, i.e. what other process is holding onto that port and/or not sending a response back to IntelliJ

Note that the port number on your machine might be different.

noahlz
  • 10,202
  • 7
  • 56
  • 75
  • I can't see a Maven server process running. When I run `ps -ef | grep idea`, I only see `/usr/lib/jvm/jdk1.6.0_25//bin/java -Xms128m -Xmx800m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=64m -ea -Djb.vmOptionsFile=/usr/lib/idea-IC-117.798/bin/idea64.vmoptions -Xbootclasspath/a:../lib/boot.jar -Didea.paths.selector=IdeaIC11 -Djb.restart.code=88 com.intellij.idea.Main`. – del Oct 03 '12 at 04:09
  • Something is preventing your Maven Server from starting, the answer is likely a prior error in the logs. – noahlz Oct 03 '12 at 04:16
  • I suspect you're correct, but I don't know how to find out what it is that's preventing the server from starting. There are no other errors that precede the timeout error. I have updated the question to provide my entire log. – del Oct 03 '12 at 04:22
1

I faced the same problem. Sorry, none of the above suggestions worked for me. In fact when I launch the gradle project from IntelliJ, I got error as "Connection refused: connect" in the event log. I tried various options like setting -Djava.net.preferIPv4Addresses=true, windows hot fix, installing ISA Client, Restarting machine, switched java lang level, disabled firewall. Nothing helped.

Finally giving the proxy information in the IntelliJ Idea does the trick for me.

enter image description here

Give the same proxy information as in your internet properties for IntelliJ proxy settings. enter image description here

Pandiarajan
  • 410
  • 5
  • 14
1

Look for any (recently installed) applications that might prevent RemoteMavenServer from responding to Intellij's calls correctly. In my case, it turned out to be a an online accountability software:x3watch. After uninstalling it, Intellij started working fine.

gjain
  • 4,468
  • 5
  • 39
  • 47
1

In my case below line was set in ~/.profile

export _JAVA_OPTIONS="-Djava.net.preferIPv6Addresses=true

i just removed the line and rebooted. works fine after

Habib Qureshi
  • 31
  • 1
  • 5
0

Had the same issue, however the following answer fixed my problem: Maven project won't compile after upgrade to Intellij 13.1 from 12

The problem itself occured after I updated to IntelliJ 13.1.4, pre to that patch all worked fine/as intended.

Community
  • 1
  • 1
vegaasen
  • 1,022
  • 7
  • 16
0

I had similiar issue on

MAC OS X

what i did:

  • deactivated FIREWALL
  • set proxy in intellij (like explained in this thread)
  • set the ipstack-flag

nothing solved the problem...

what helped

  • starting intellij with Java 1.6 and NOT java 1.8 (defined in /Applications/IntelliJ\ IDEA\ 14.app/Contents/Info.plist )

strange

rfelgent
  • 9
  • 1
  • How to specify Java 1.6? I have same issue on Mac OSX and no other solutions seem to help. I would like to try your method to see if it can really solve the issue – The Lazy Log Sep 17 '15 at 03:48
0

I had the same issue on Linux Mint. Tried everything but nothing helped. Turned out my etc/hosts file was corrupted and restoring it worked. Another solution is here : https://www.digitalocean.com/community/questions/how-to-restore-etc-hosts-on-ubuntu-14-04