Unable to get IntelliJ to recognize proto compiled Java class files
since this is pretty much the only place I could find an exact description for the issue I was facing with Idea, I'm replying even if it's an old question.
It turns out that if the .java
file that's generated by the protocol buffers compiler is larger than 2.5MB (default setting), Idea ignores it altogether. Even if there is a .class
file, even if compile/make succeed, even if you build your project just fine with Maven.
To fix that, simply edit your idea.properties
file (it's inside the bin
folder in your Idea installation folder), and either comment out this setting, or set it to something larger than your generated .java
file (in my case, I set it to 15000
, as my generated file is currently about 8MB in size):
#---------------------------------------------------------------------
# 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
Note: at least on Linux, where the default update policy seems to be "overwrite the old Idea folder with what you just downloaded", this change must be applied after every update/upgrade.
An extension to Michele's answer,
There is no bin folder in Mac.
In macOS, when Intellij is unable to recognize proto compiled Java class files,
From the Help menu ---> select Edit Custom Properties. It might ask you to create idea.properties
file under
$HOME//Library/Application\ Support/JetBrains/IdeaIC2020.1/
create property idea.max.intellisense.filesize=2500 and set the value to accommodate your big fat proto compiled file for IntelliJ to recognize.