克隆后IntelliJ无法识别java项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30088957/
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
IntelliJ doesn't recognize java project after cloning
提问by michalleek
I've cloned my repo from bitbucket and I am trying to open it in IntelliJ IDE, but i can't set Debug Configuration, can't set Main class in Application menu. I can't also add new Java class into project. I think that Intellij can't recognize this project is Java.
我已经从 bitbucket 克隆了我的 repo,我试图在 IntelliJ IDE 中打开它,但我无法设置调试配置,无法在应用程序菜单中设置主类。我也不能在项目中添加新的 Java 类。我认为Intellij无法识别这个项目是Java。
Is it possible to make it right?
有可能使它正确吗?
采纳答案by maba
You have to mark your src
directory as Source Root
.
您必须将src
目录标记为Source Root
.
Right-click on the src
folder and select Sources Root
:
右键单击src
文件夹并选择Sources Root
:
Then you'll see that the icons will change:
然后你会看到图标会发生变化:
EDIT
编辑
Check the output path by bringing up the Project Structure
view.
通过调出Project Structure
视图检查输出路径。
Press Ctrl+Alt+Shift+S
按Ctrl+ Alt+ Shift+S
回答by Tyrone Hinderson
Similar to what maba said above, but if applicable you probably want to mark main
and test
as source & test source directories (respectively). That's a common project directory structure where literally marking src
(parent of main
and test
) as source won't work for you.
与 maba 上面所说的类似,但如果适用,您可能希望将main
和标记test
为源和测试源目录(分别)。这是一个常见的项目目录结构,其中将src
(main
和 的父级test
)标记为源对您不起作用。