Java 项目文件上的智能图标
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2728333/
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 icon over project files
提问by Shaun Hare
intellij has placed what look like no entry signs over my java files (red circles with a line through) searched around but cannot find why? Would anyone know please.
intellij 已经在我的 java 文件上放置了看起来没有入口标志的东西(红色圆圈和一条线),但找不到原因?请问有谁知道。
It's a maven project if that makes a difference
如果这有所作为,这是一个 Maven 项目
采纳答案by duffymo
It means those files aren't part of the project settings. How did you create that project?
这意味着这些文件不是项目设置的一部分。你是如何创建那个项目的?
I'm not sure which version of IntelliJ you're using - I run 9.0.1. I'd recommend opening the project structure (icon to the right of the "wrench" or Ctrl+Alt+Shift+S), click on "Modules", and designate the directory where the .java files are located as a source directory (it'll change to a blue color).
我不确定您使用的是哪个版本的 IntelliJ - 我运行的是 9.0.1。我建议打开项目结构(“扳手”右侧的图标或 Ctrl+Alt+Shift+S),单击“模块”,然后将 .java 文件所在的目录指定为源目录(它会变成蓝色)。
回答by ZenBalance
For those who have this problem with Android Studio. Try the following:
对于那些在 Android Studio 中遇到此问题的人。请尝试以下操作:
1) Navigate to your project settings
1) 导航到您的项目设置
2) Go to Modules -> and under the module option tab select "Sources" - There should be an option to "Add Content Root" and below it, blue, green, and red tab folders for Source Folders, Test Source Folders, and Excluded Folders respectively.
2) 转到 Modules -> 并在模块选项选项卡下选择“Sources” - 应该有一个“Add Content Root”选项,在它下面,源文件夹、测试源文件夹和蓝色、绿色和红色选项卡文件夹分别排除文件夹。
3) On the right side, right click on the java source folder you want to add and select to add it to Source or Tests (depending on what kind of files you are adding).
3)在右侧,右键单击要添加的java源文件夹,然后选择将其添加到Source或Tests(取决于您添加的文件类型)。
4) The added files should now show up with a blue circle with a c in the center on the left hand project window pane.
4) 添加的文件现在应该在左侧项目窗口窗格的中心显示一个带有 ac 的蓝色圆圈。
回答by BLuEGoD
For maven projects:
对于 Maven 项目:
In my case I had to import the project through Maven. Some modules were missing (they weren't specified in the root pom) so adding those as maven projects fixed the issue.
就我而言,我必须通过 Maven 导入项目。缺少一些模块(它们未在根 pom 中指定),因此将它们添加为 Maven 项目解决了该问题。
click on the 'plus' icon on the right hand side maven menu and then add the project. This imported all sources / structure automatically.
单击右侧 maven 菜单上的“加号”图标,然后添加项目。这会自动导入所有源/结构。