概述
我看到了一些类似的问题[1] [2] [3],但是没有一个答案能够取得任何成功。
所以,这里是我看到的问题:
1)POM指示它无法连接到本地.m2仓库。
2)Intellij中的Maven设置显示连接到本地.m2仓库被拒绝的错误。
我迄今为止尝试过的方法:
基本上包括链接问题中提到的所有方法。包括:
1) 手动删除整个 .m2/repository 文件夹,然后再次更新 Maven 项目。
4) 将 localhost 设置为仅为 127.0.0.1。
5) 添加 -Djava.net.preferIPv4Stack=true 标志。
6) 使用 Java 1.7 启动 Intellij 而不是 1.8。
7) 卸载并重新安装 Maven、Java 和 Intellij。
其他信息:
$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
$ mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T12:39:06-07:00)
Maven home: /usr/local/apache-maven-3.5.0
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"
非常感谢你的帮助。
Idea.log
2017-08-29 13:16:51,471 [12172337] WARN - #org.jetbrains.idea.maven - Failed to update Maven indices for: [local] /Users/donato/.m2/repository
org.jetbrains.idea.maven.server.MavenServerIndexerException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused (Connection refused)
at org.jetbrains.idea.maven.server.Maven3ServerIndexerImpl.updateIndex(Maven3ServerIndexerImpl.java:221)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
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:748)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:276)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:253)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:162)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:227)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:179)
at com.sun.proxy.$Proxy137.updateIndex(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.execution.rmi.RemoteUtil.invokeRemote(RemoteUtil.java:175)
at com.intellij.execution.rmi.RemoteUtil.access$300(RemoteUtil.java:36)
at com.intellij.execution.rmi.RemoteUtil$2$1$1.compute(RemoteUtil.java:156)
at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:232)
at com.intellij.execution.rmi.RemoteUtil$2$1.invoke(RemoteUtil.java:153)
at com.sun.proxy.$Proxy137.updateIndex(Unknown Source)
at org.jetbrains.idea.maven.server.MavenIndexerWrapper$3.execute(MavenIndexerWrapper.java:120)
at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:118)
at org.jetbrains.idea.maven.server.MavenIndexerWrapper.updateIndex(MavenIndexerWrapper.java:115)
at org.jetbrains.idea.maven.indices.MavenIndex.updateContext(MavenIndex.java:371)
at org.jetbrains.idea.maven.indices.MavenIndex.updateOrRepair(MavenIndex.java:329)
at org.jetbrains.idea.maven.indices.MavenIndices.updateOrRepair(MavenIndices.java:128)
at org.jetbrains.idea.maven.indices.MavenIndicesManager.doUpdateIndices(MavenIndicesManager.java:276)
at org.jetbrains.idea.maven.indices.MavenIndicesManager.access$200(MavenIndicesManager.java:52)
at org.jetbrains.idea.maven.indices.MavenIndicesManager$3.run(MavenIndicesManager.java:243)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:718)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:170)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:548)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:493)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:165)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:343)
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.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused (Connection refused)
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.invoke(UnicastRef.java:130)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:227)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:179)
at com.sun.proxy.$Proxy29.setIndeterminate(Unknown Source)
at org.jetbrains.idea.maven.server.Maven3ServerIndexerImpl.updateIndex(Maven3ServerIndexerImpl.java:152)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
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:748)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.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.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)
... 24 more
2017-08-29 13:17:07,836 [12188702] WARN - ution.rmi.RemoteProcessSupport - java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
2017-08-29 13:17:07,841 [12188707] WARN - ution.rmi.RemoteProcessSupport - java.net.ConnectException: Connection refused (Connection refused)
2017-08-29 13:17:07,841 [12188707] WARN - ution.rmi.RemoteProcessSupport - at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
2017-08-29 13:17:07,841 [12188707] WARN - ution.rmi.RemoteProcessSupport - at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
2017-08-29 13:17:07,841 [12188707] WARN - ution.rmi.RemoteProcessSupport - at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
2017-08-29 13:17:07,841 [12188707] WARN - ution.rmi.RemoteProcessSupport - at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:130)
2017-08-29 13:17:07,841 [12188707] WARN - ution.rmi.RemoteProcessSupport - at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:227)
2017-08-29 13:17:07,841 [12188707] WARN - ution.rmi.RemoteProcessSupport - at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:179)
2017-08-29 13:17:07,841 [12188707] WARN - ution.rmi.RemoteProcessSupport - at com.sun.proxy.$Proxy1.ping(Unknown Source)
2017-08-29 13:17:07,841 [12188707] WARN - ution.rmi.RemoteProcessSupport - at com.intellij.execution.rmi.RemoteServer.start(RemoteServer.java:83)
2017-08-29 13:17:07,841 [12188707] WARN - ution.rmi.RemoteProcessSupport - at org.jetbrains.idea.maven.server.RemoteMavenServer.main(RemoteMavenServer.java:22)
2017-08-29 13:17:07,841 [12188707] WARN - ution.rmi.RemoteProcessSupport - Caused by: java.net.ConnectException: Connection refused (Connection refused)
2017-08-29 13:17:07,841 [12188707] WARN - ution.rmi.RemoteProcessSupport - at java.net.PlainSocketImpl.socketConnect(Native Method)
2017-08-29 13:17:07,841 [12188707] WARN - ution.rmi.RemoteProcessSupport - at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
2017-08-29 13:17:07,842 [12188708] WARN - ution.rmi.RemoteProcessSupport - at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
2017-08-29 13:17:07,842 [12188708] WARN - ution.rmi.RemoteProcessSupport - at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
2017-08-29 13:17:07,842 [12188708] WARN - ution.rmi.RemoteProcessSupport - at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
2017-08-29 13:17:07,842 [12188708] WARN - ution.rmi.RemoteProcessSupport - at java.net.Socket.connect(Socket.java:589)
2017-08-29 13:17:07,842 [12188708] WARN - ution.rmi.RemoteProcessSupport - at java.net.Socket.connect(Socket.java:538)
2017-08-29 13:17:07,842 [12188708] WARN - ution.rmi.RemoteProcessSupport - at java.net.Socket.<init>(Socket.java:434)
2017-08-29 13:17:07,842 [12188708] WARN - ution.rmi.RemoteProcessSupport - at java.net.Socket.<init>(Socket.java:211)
2017-08-29 13:17:07,842 [12188708] WARN - ution.rmi.RemoteProcessSupport - at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
2017-08-29 13:17:07,842 [12188708] WARN - ution.rmi.RemoteProcessSupport - at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148)
2017-08-29 13:17:07,842 [12188708] WARN - ution.rmi.RemoteProcessSupport - at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
2017-08-29 13:17:07,842 [12188708] WARN - ution.rmi.RemoteProcessSupport - ... 8 more
2017-08-29 13:17:21,180 [12202046] INFO - .script.IdeScriptEngineManager - javax.script.ScriptEngineManager initialized in 34 ms
2017-08-29 13:17:23,080 [12203946] INFO - ij.compiler.impl.CompileDriver - COMPILATION STARTED (BUILD PROCESS)
2017-08-29 13:17:23,756 [12204622] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: /Applications/IntelliJ IDEA CE.app/Contents/lib/jps-launcher.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/tools.jar:/Applications/IntelliJ IDEA CE.app/Contents/lib/optimizedFileManager.jar
2017-08-29 13:17:23,859 [12204725] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2017-08-29 13:17:23,860 [12204726] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Defaulting to no-operation (NOP) logger implementation
2017-08-29 13:17:23,860 [12204726] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2017-08-29 13:17:27,244 [12208110] INFO - pl.ProjectRootManagerComponent - project roots have changed
2017-08-29 13:17:27,299 [12208165] INFO - pl.ProjectRootManagerComponent - project roots have changed
2017-08-29 13:17:27,305 [12208171] INFO - .diagnostic.PerformanceWatcher - Pushing properties took 0ms; general responsiveness: ok; EDT responsiveness: ok
2017-08-29 13:17:27,324 [12208190] INFO - indexing.UnindexedFilesUpdater - Unindexed files update canceled
2017-08-29 13:17:27,325 [12208191] INFO - pl.ProjectRootManagerComponent - project roots have changed
2017-08-29 13:17:27,333 [12208199] INFO - .diagnostic.PerformanceWatcher - Pushing properties took 2ms; general responsiveness: ok; EDT responsiveness: ok
2017-08-29 13:17:27,336 [12208202] INFO - lij.compiler.impl.CompilerUtil - COMPILATION FINISHED (BUILD PROCESS); Errors: 100; warnings: 3 took 4150 ms: 0 min 4sec
2017-08-29 13:17:27,365 [12208231] INFO - s.CompilerReferenceServiceImpl - backward reference index reader is opened
2017-08-29 13:17:27,369 [12208235] INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 36ms; general responsiveness: ok; EDT responsiveness: ok
2017-08-29 13:17:27,635 [12208501] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: /Applications/IntelliJ IDEA CE.app/Contents/lib/jps-launcher.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/tools.jar:/Applications/IntelliJ IDEA CE.app/Contents/lib/optimizedFileManager.jar
2017-08-29 13:17:27,704 [12208570] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2017-08-29 13:17:27,704 [12208570] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Defaulting to no-operation (NOP) logger implementation
2017-08-29 13:17:27,704 [12208570] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
更新
您使用的是哪个settings.xml
文件?
/Users/donato/.m2/settings.xml
这种情况是在IntelliJ中打开任何Maven项目都会发生,还是只有这个项目会出现?
所有的Maven项目都会出现这种情况。
此外,除了Intellij显示索引失败之外,如果从Maven面板调用构建,是否可以正常工作?
构建失败,提示找不到很多符号。
settings.xml
文件?请在这里检查:文件 > 设置 > 构建,.. > 构建工具 > Maven > 用户设置文件。 - Sam