IntelliJ new project - maven archetype list empty

2019-01-21 15:42发布

When creating IntelliJ → New Project → Maven, the archetype list is blank and does not populate no matter how long the amount of time elapsed. The "Loading archetype list..." continues but does not appear to do much. Any suggestions?

enter image description here

Info from mvn -v:

Apache Maven 3.2.5 (NON-CANONICAL_2014-12-25T17:13:28_root; 2014-12-25T05:13:28-08:00)
Maven home: /opt/maven
Java version: 1.8.0_25, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.17.6-1-arch", arch: "amd64", family: "unix"

IntelliJ IDEA Professional 14.0.2

10条回答
Luminary・发光体
2楼-- · 2019-01-21 16:02

I have faced the similar problem. After looking at IDE log, I have figured out it was not able to connect the localhost. It was showing below exception :

2016-11-30 13:47:54,193 [10832638]  ERROR - plication.impl.ApplicationImpl - Cannot reconnect. 
java.lang.RuntimeException: Cannot reconnect.
    at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:82)
    at org.jetbrains.idea.maven.server.MavenIndexerWrapper.getArchetypes(MavenIndexerWrapper.java:175)
    at org.jetbrains.idea.maven.indices.MavenIndicesManager.getArchetypes(MavenIndicesManager.java:310)
    at org.jetbrains.idea.maven.wizards.MavenArchetypesStep.lambda$updateArchetypesList$2(MavenArchetypesStep.java:237)
    at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:309)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
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 refused: connect
    at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:173)
    at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:78)
    at org.jetbrains.idea.maven.server.RemoteObjectWrapper.getOrCreateWrappee(RemoteObjectWrapper.java:41)
    at org.jetbrains.idea.maven.server.MavenServerManager$4.create(MavenServerManager.java:527)
    at org.jetbrains.idea.maven.server.MavenServerManager$4.create(MavenServerManager.java:523)
    at org.jetbrains.idea.maven.server.RemoteObjectWrapper.getOrCreateWrappee(RemoteObjectWrapper.java:41)
    at org.jetbrains.idea.maven.server.MavenIndexerWrapper$7.execute(MavenIndexerWrapper.java:178)
    at org.jetbrains.idea.maven.server.MavenIndexerWrapper$7.execute(MavenIndexerWrapper.java:175)
    at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:76)
    ... 9 more
Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: 
    java.net.ConnectException: Connection refused: connect
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:342)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at com.intellij.execution.rmi.RemoteProcessSupport.lambda$acquire$2(RemoteProcessSupport.java:258)
    at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:226)
    at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:256)
    at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:162)
    at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:170)
    ... 17 more
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at java.net.Socket.<init>(Socket.java:434)
    at java.net.Socket.<init>(Socket.java:211)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
    ... 26 more

I have found the solution mentioned in the below link which has worked for me Unable to import Maven project into IntelliJ IDEA

查看更多
不美不萌又怎样
3楼-- · 2019-01-21 16:04

You can try change VM options for importer: -Xmx2048M Settings -> Maven -> Importing. Tested on IntelliJ IDEA 2016.3.4, JRE 1.8.0_111

https://www.youtube.com/watch?v=un8S3t1N4FY

查看更多
一纸荒年 Trace。
4楼-- · 2019-01-21 16:06

In my case, I had solve this.

'$JAVA_HOME/jre/bin/java' file is not have permission of run.

(http://1004lucifer.blogspot.kr/2015/08/intellij-loading-archetype-list.html)

查看更多
ら.Afraid
5楼-- · 2019-01-21 16:10

Changing the Settings->Maven->Importing->JDK for importer selection did not work for me. But clearing the "-Xmx512m" value that was in Settings->Maven->Importing->VM options for importer did. After clearing that value and saving the settings, the Maven archetype list for New Module loaded immediately in IntelliJ IDEA Professional 14.0.3.

查看更多
Melony?
6楼-- · 2019-01-21 16:16

The max memory did the trick for me as well, IntelliJ Community Edition 2016.2.4

Here's a screenshot of the settings if it helps: enter image description here

查看更多
Summer. ? 凉城
7楼-- · 2019-01-21 16:17

After checking the idea.log under ~/Library/Logs/IntelliJIdea13/, I found there was an excpetion being thrown Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: java.net.ConnectException: Connection refused. The root cause was my /etc/hosts file got corrupted somehow and the localhost ip was updated to some garbage value. After changing the localhost mapping to 127.0.0.1, my problem got resolved

查看更多
登录 后发表回答