由于项目是gitlab上存储的,所以下下来之后,之前遇到过,以为是重新下载之后master上面没有内容导致无法正常打开,这种情况,切换一下master再打开即可;
但是这次遇到的问题不是这种情况,
使用
git branch -r 查看远程分支
git checkout --track branchname 切换到分支
idea打开,打开多次依然不行;现象是打开新下载的项目,无法打开,而且老的项目无法编译,会报错,idea上报错:
Unable to import maven project. See logs for details
然后去度娘找日志,搜索完全不行,于是换google,可以这样查看日志:help->Show log in finder,或者直接terminal 里面看:/Users/zhang/Library/Logs/IntelliJIdea15/idea.log
然后找到以下日志:
2016-12-20 16:08:39,695 [ 112867] WARN - ution.rmi.RemoteProcessSupport - The cook failed to start due to java.net.ConnectException: Connection refused
2016-12-20 16:08:40,730 [ 113902] ERROR - llij.ide.plugins.PluginManager - Cannot reconnect.
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:522)
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.access$300(MavenProjectReader.java:42)
at org.jetbrains.idea.maven.project.MavenProjectReader$1.doProcessParent(MavenProjectReader.java:422)
at org.jetbrains.idea.maven.project.MavenProjectReader$1.doProcessParent(MavenProjectReader.java:399)
at org.jetbrains.idea.maven.project.MavenParentProjectFileProcessor.processRepositoryParent(MavenParentProjectFileProcessor.java:84)
at org.jetbrains.idea.maven.project.MavenParentProjectFileProcessor.process(MavenParentProjectFileProcessor.java:62)
at org.jetbrains.idea.maven.project.MavenProjectReader.resolveInheritance(MavenProjectReader.java:425)
at org.jetbrains.idea.maven.project.MavenProjectReader.doReadProjectModel(MavenProjectReader.java:95)
at org.jetbrains.idea.maven.project.MavenProjectReader.access$300(MavenProjectReader.java:42)
at org.jetbrains.idea.maven.project.MavenProjectReader$1.doProcessParent(MavenProjectReader.java:422)
at org.jetbrains.idea.maven.project.MavenProjectReader$1.doProcessParent(MavenProjectReader.java:399)
at org.jetbrains.idea.maven.project.MavenParentProjectFileProcessor.processRepositoryParent(MavenParentProjectFileProcessor.java:84)
at org.jetbrains.idea.maven.project.MavenParentProjectFileProcessor.process(MavenParentProjectFileProcessor.java:62)
at org.jetbrains.idea.maven.project.MavenProjectReader.resolveInheritance(MavenProjectReader.java:425)
at org.jetbrains.idea.maven.project.MavenProjectReader.doReadProjectModel(MavenProjectReader.java:95)
at org.jetbrains.idea.maven.project.MavenProjectReader.readProject(MavenProjectReader.java:53)
at org.jetbrains.idea.maven.project.MavenProject.read(MavenProject.java:626)
at org.jetbrains.idea.maven.wizards.MavenProjectBuilder.collectProfiles(MavenProjectBuilder.java:197)
at org.jetbrains.idea.maven.wizards.MavenProjectBuilder.access$900(MavenProjectBuilder.java:47)
at org.jetbrains.idea.maven.wizards.MavenProjectBuilder$1.run(MavenProjectBuilder.java:171)
at org.jetbrains.idea.maven.utils.MavenUtil$6.run(MavenUtil.java:430)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:563)
at com.intellij.openapi.progress.impl.CoreProgressManager$8.run(CoreProgressManager.java:357)
at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:446)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
at com.intellij.openapi.application.impl.ApplicationImpl$14$1.run(ApplicationImpl.java:626)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:365)
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)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:55)
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
at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:166)
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$9.execute(MavenServerManager.java:525)
at org.jetbrains.idea.maven.server.MavenServerManager$9.execute(MavenServerManager.java:522)
at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:76)
... 38 more
Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: 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.newCall(UnicastRef.java:342)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at com.intellij.execution.rmi.RemoteProcessSupport$3.compute(RemoteProcessSupport.java:256)
at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:181)
at com.intellij.execution.rmi.RemoteProcessSupport.a(RemoteProcessSupport.java:252)
at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:164)
at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:163)
... 43 more
这才找对了方向,然后搜索关键字(aused by: java.rmi.RemoteException: Cannot start maven service; nested exception is),找到以下信息:
http://www.guudo.cn/tech/view/id/15947,这里面说的解决办法可能有些用,但是不是所有环境都一样,我是没有卸载,因为觉得卸载成本比较高
http://stackoverflow.com/questions/12701347/unable-to-import-maven-project-into-intellij-idea,最终解决方案是从这里得到的,还是国外的网站描述的清楚些
解决办法:
在/etc/hosts里添加一行127.0.0.1 localhost,重新导入即可解决
其他参考链接:
http://stackoverflow.com/questions/26754344/intellij-cannot-start-maven-service-executionexception
http://stackoverflow.com/questions/30569909/unable-to-import-maven-project-in-intellij14
https://my.oschina.net/matt0614/blog/749724
同时发现一个好玩的,给idea terminal添加颜色:
http://www.hankcs.com/program/java/log4j-2-console-color-configuration-with-intellij-idea.html
给terminal也加个颜色吧:
https://github.com/altercation/solarized
https://github.com/mbadolato/iTerm2-Color-Schemes
https://laoshuterry.gitbooks.io/mac_os_setup_guide/content/4_ZshConfig.html 配置教程