java 无法在 IntelliJ Idea 2016.1.1 中导入 maven 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36473138/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't import the maven project in IntelliJ Idea 2016.1.1
提问by Garima Gupta
回答by Ben Flowers
I had the same issue, but managed to solve it by updating my /etc/hosts file such that there is was only one entry for localhost
我有同样的问题,但设法通过更新我的 /etc/hosts 文件来解决它,这样本地主机只有一个条目
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
# 192.xxx.xxx.xxx localhost <-comment out this
255.255.255.255 broadcasthost
#::1 localhost <- comment out this
回答by Dmitry Nichiporenko
回答by maytham-???????
I have had similar issue on my spare computer, the problem appears when creating/importing Maven project. It seems for some reason it has lost the access to java SDK and it was not there, even thus I tried to re-importing it. I tried to select java SDK again with out luck. I ended up with following solution:
我在我的备用计算机上遇到了类似的问题,创建/导入 Maven 项目时出现问题。似乎出于某种原因,它失去了对 java SDK 的访问权限,并且它不存在,即使如此我也尝试重新导入它。我尝试再次选择 java SDK,但运气不佳。我最终得到了以下解决方案:
- Uninstalling IntelliJ (2016.2.4)
- Reinstalling Java JDK latest 1.8, restart the system
- Installing latest IntelliJ (2016.2.5)
- First time I started IntelliJ, and when creating first time new project, ensure selecting the correct SDK path (see image)
- Now you should be able to (click on next) creating/importing new Maven project.
- 卸载 IntelliJ (2016.2.4)
- 重装Java JDK最新1.8,重启系统
- 安装最新的 IntelliJ (2016.2.5)
- 我第一次启动 IntelliJ,在创建第一次新项目时,确保选择正确的 SDK 路径(见图)
- 现在您应该能够(单击下一步)创建/导入新的 Maven 项目。
The other answers did not helped me much.
其他答案对我没有多大帮助。
回答by yukun sun
I had the same issue just now,through the idea.log
, I found the problem:
我刚才遇到了同样的问题,通过idea.log
,我发现了问题:
Caused by: com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java" (in directory "/Users/xxx/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/182.4129.33/IntelliJ IDEA.app/Contents/bin"): error=2, No such file or directory
at
com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:408)
at com.intellij.execution.process.OSProcessHandler.startProcess(OSProcessHandler.java:51)
at com.intellij.execution.process.OSProcessHandler.<init>(OSProcessHandler.java:44)
at org.jetbrains.idea.maven.server.MavenServerManager.startProcess(MavenServerManager.java:367)
at org.jetbrains.idea.maven.server.MavenServerManager.execute(MavenServerManager.java:358)
at com.intellij.execution.rmi.RemoteProcessSupport.startProcess(RemoteProcessSupport.java:212)
at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:139)
... 28 more
the jdk1.7.0_79.jdk
have been removed,so it doesn't work...
在jdk1.7.0_79.jdk
已被删除,所以它不工作...
回答by Max Robbertze
I ran into this and at first it seemed due to the use of a tilde ~
in the file path of the root of the project. It also seemed to go "flaky" if you try to use a ~
.
我遇到了这个问题,起初似乎是因为~
在项目根目录的文件路径中使用了波浪号。如果您尝试使用~
.
More investigation lead to: /home/user/.IdeaIC15/system/log (might be a bit different for other systems)
更多调查导致:/home/user/.IdeaIC15/system/log(其他系统可能略有不同)
Do
做
tail -100f idea.log
tail -100f idea.log
in a terminal in that directory and see what you get when you click "next"
在该目录中的终端中,查看单击“下一步”时会得到什么
Mine was missing / corrupt java7 instance
我的丢失/损坏的 java7 实例
All this is pertaining to Linux only.
所有这些仅与 Linux 相关。
回答by Dan Hymanson
I had the same problem, turns out I had a lock on the directory. try renaming the folder to confirm this is not your issue. Once the lock is removed try importing the project.
我遇到了同样的问题,结果我锁定了目录。尝试重命名文件夹以确认这不是您的问题。解除锁定后,尝试导入项目。
回答by asifsid88
I know this is older issue, but today I also encountered this issue. In my case it was JDK unavailable (as my IntelliJ was pointing to external JDK which got updated and old path didn't exists). Nevertheless, the issue can be different for different people. The best way to tackle this problem is to check intelliJ logs, that will tell you exact issue it is facing and then proceed with its fix. I'm sure this will save your time and you will solve the issue very quickly.
我知道这是老问题,但今天我也遇到了这个问题。就我而言,它是 JDK 不可用的(因为我的 IntelliJ 指向已更新的外部 JDK 并且旧路径不存在)。然而,对于不同的人来说,问题可能会有所不同。解决此问题的最佳方法是检查 intelliJ 日志,它会告诉您它面临的确切问题,然后继续进行修复。我相信这会节省您的时间并且您会很快解决问题。
How to locate idea.log file is here
如何找到idea.log文件在这里
P.S. May be when you read this post, the above link to locate idea.log file stale. So kindly get the updated link from IntelliJ jetbrains website (Look for idea.log
file path)
OR follow the below steps:
1. Open intellij
2. Click on Help
tab from menu-bar
3. Select Show log in Finder
. Get the path to this path and do tail -f </path-to-file/idea.log>
PS 可能是当您阅读这篇文章时,上面的链接会定位到idea.log 文件过时。所以请从 IntelliJ jetbrains 网站获取更新的链接(查找idea.log
文件路径)
或按照以下步骤操作:
1. 打开 Intellij
2. 单击Help
菜单栏中的选项卡
3. 选择Show log in Finder
。获取此路径的路径并执行tail -f </path-to-file/idea.log>
回答by Rudy Vissers
In my case to solve this problem I did a strace on Linux of the Intellij Java process that is called when you do a next (+ child processes) and discovered that it was related to the execution of the Maven embedded jar.
在我的例子中,为了解决这个问题,我在 Intellij Java 进程的 Linux 上做了一个 strace,当您执行下一个(+ 子进程)时调用该进程,并发现它与 Maven 嵌入式 jar 的执行有关。
Execution of the Maven embedded jar (process 4940):
Maven内嵌jar的执行(进程4940):
4940 execve("/home/rudy/Softwares/jdk1.8.0_111/bin/java", ["/home/rudy/Softwares/jdk1.8.0_11"..., "-Djava.awt.headless=true", "-Didea.version==2018.1.4", "-Xmx1024m", "-Didea.maven.embedder.version=3."...
第 4940 章"-Didea.version==2018.1.4", "-Xmx1024m", "-Didea.maven.embedder.version=3."...
Error returned by the process 4940:
进程4940返回的错误:
4940 <... execve resumed> ) = -1 ENOENT (No such file or directory)
4940 <... execve resumed> ) = -1 ENOENT(没有这样的文件或目录)
I had decided to move the jdk8 to a directory home/rudy/Softwares/jdks/jdk1.8.0_111 and it was previously in home/rudy/Softwares/jdk1.8.0_111.
我决定将 jdk8 移动到目录 home/rudy/Softwares/jdks/jdk1.8.0_111 ,它以前在 home/rudy/Softwares/jdk1.8.0_111 中。
It seems before to move JDKs used by Intellij to first reconfigure Intellij to use the new path and then use the import maven functionnality.
之前似乎移动 Intellij 使用的 JDK 首先重新配置 Intellij 以使用新路径,然后使用导入 maven 功能。
I did a mistake, it is true (moving the JDK) and Intellij has no way to know where the JDK was moved (unless scanning the all filesystem) but it should clearly display an error message and not get blocked on the 'next'.
我犯了一个错误,这是真的(移动 JDK)并且 Intellij 无法知道 JDK 被移动到哪里(除非扫描所有文件系统),但它应该清楚地显示一条错误消息并且不会在“下一步”中被阻止。
回答by saranya elumalai
I had this issue today and it took me 2 hours to identify and fix it. I tried to import the project from perforce workspace which had '/' in the workspace name (ABC/lighting_workspace).
我今天遇到了这个问题,我花了 2 个小时来识别和修复它。我尝试从工作区名称 (ABC/lighting_workspace) 中包含“/”的 perforce 工作区导入项目。
When I created another perforce workspace without '/' in the name (lighting_workspace), I was able to import the existing project :)
当我创建另一个名称中没有“/”的 perforce 工作区 (lighting_workspace) 时,我能够导入现有项目:)
回答by Luca Tampellini
Had exactly the same issue, in my case it was a memory problem: the importer needed more memory than the one allowed by the VM's limit set by default after the installation of IntelliJ: I had 768 mb set by default and i moved them to 2048 mb.
有完全相同的问题,在我的情况下,这是一个内存问题:在安装 IntelliJ 后,导入程序需要的内存比默认设置的 VM 限制允许的内存多:我默认设置了 768 mb,我将它们移到了 2048英
You can set this under : Preferences |-> Build, Execution, Deployment |-> Build Tools |-> Maven |-> Importing |-> VM options for importer
您可以在以下设置: 首选项 |-> 构建、执行、部署 |-> 构建工具 |-> Maven |-> 导入 |-> 导入程序的 VM 选项