无法让IntelliJ识别原型编译的Java类文件

Sid*_*tha 12 eclipse intellij-idea protobuf-c

我们的项目中有一个build.xml,但IntelliJ无法从中导入.我得到一个:

Cannot import anything from <path_to>/build.xml file.
Run Code Online (Sandbox Code Playgroud)

在Eclipse上我可以做一个:

File -> Import -> General -> Existing Projects into workspace.
Run Code Online (Sandbox Code Playgroud)

并选择了顶级文件夹.我也在IJ做过同样的事.项目导入和索引很好,我可以搜索任何类.但是,它无法识别protobuf编译的类文件.我安装了proto插件,因此它的语法突出显示了我的.proto文件,但仍然没有意识到它需要引用的编译类输出.我是否需要做一些特别的事情来让它识别这些文件?

mic*_*e b 22

因为这是我唯一可以找到我所面对的问题的确切描述的地方,即使这是一个老问题,我也会回复.

事实证明,如果.java协议缓冲区编译器生成的文件大于2.5MB(默认设置),Idea会完全忽略它.即使有.class文件,即使你成功编译/ make,即使你使用Maven构建你的项目也不错.

要解决这个问题,只需编辑你的idea.properties文件(它bin在你的Idea安装文件夹中的文件夹内),然后注释掉这个设置,或者将它设置为比你生成的.java文件更大的东西(就我的情况而言,我把它设置为15000,就像我生成的那样)文件目前大小约为8MB):

#---------------------------------------------------------------------
# Maximum file size (kilobytes) IDE should provide code assistance for.
# The larger file is the slower its editor works and higher overall system memory requirements are
# if code assistance is enabled. Remove this property or set to very large number if you need
# code assistance for any files available regardless their size.
#---------------------------------------------------------------------
idea.max.intellisense.filesize=2500
Run Code Online (Sandbox Code Playgroud)

注意:至少在Linux上,默认更新策略似乎是"用刚刚下载的内容覆盖旧的Idea文件夹",每次更新/升级后都必须应用此更改.

  • 花了数小时试图弄清楚这一点,非常感谢! (3认同)