Failed to get IntelliJ for file recognition of compiled Java files

There is a build.xml file in our project, but IntelliJ cannot import it. I get:

Cannot import anything from <path_to>/build.xml file. 

In Eclipse, I can do:

 File -> Import -> General -> Existing Projects into workspace. 

and selected the top-level folder. I did the same in IJ. The project is imported and indexed in order, I can perform a search for any class. However, it does not recognize protobuf compiled file files. I installed the proto plugin, so the syntax selects my .proto files, but still does not understand that there is a compiled class that it must reference. Do I need to do something to recognize these files?

+6
source share
1 answer

since this is almost the only place where I could find an exact description of the problem that I encountered with Idea, I answer, even if this is an old question.

It turns out that if the .java file generated by the protocol buffer compiler is larger than 2.5 MB (by default), Idea completely ignores it. Even if there is a .class file, even if compiled / done successfully, even if you create a project just fine with Maven.

To fix this, simply edit the idea.properties file (it is inside the bin folder in the Idea installation folder) and either comment out this parameter or set it to something larger than your generated .java file (in my case, I set it to 15000 , since my generated file currently has a size of about 8 MB):

 #--------------------------------------------------------------------- # 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 β€œoverwrite the old Idea folder with what you just downloaded,” this change should be applied after each update / update.

+11
source

Source: https://habr.com/ru/post/986590/


All Articles