Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to import Maven project into IntelliJ IDEA

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?

like image 753
del Avatar asked Oct 03 '12 03:10

del


People also ask

Why Maven is not showing in IntelliJ?

In the file menu select settings -> plugins. search for maven, select maven, select enable. Restart intellij. Once restarted you will now have the option to start new maven project and maven functionality will be accessible in all your previous projects.

How does IntelliJ recognize Maven project?

In the Project tool window, right-click your project and select Add Framework Support. In the dialog that opens, select Maven from the options on the left and click OK. IntelliJ IDEA adds a default POM to the project and generates the standard Maven layout in Project tool window.


1 Answers

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.

like image 191
CrazyCoder Avatar answered Sep 19 '22 15:09

CrazyCoder