skip indexing on a certain Jars

Answered

Hi,

 

I guess I will ask the question in the forum before I jump into the IDEA code to find out where the cutting point is it does the indexing for the Jars.

I would like to skip the indexing on Jars given a particular naming convention. This is because I have hundred thousands of class files in a certain Jars of which I don't really care about. IDEA in its current form indexing all those classes in the module dependencies just does not perform well - UI lagging, CPU hogging, taking long time to do the index, etc. 

I wrote a plugin to Aspect-weaving the indexer to by-pass those jars in Eclipse IDE, and I would like to do the same to IDEA too. 

Can anyone show where the point is IDEA that does all the indexing tasks, so I can weave into the logic to bypass a certain jar that's in the dependencies in a module?

7 comments
Comment actions Permalink

You can exclude a part (or the whole content) of a library JAR file, but currently you need to do it manually, there is no way to do it by a pattern. But note that this will affect many IDEA's features, e.g. references to excluded classes will be shown as errors etc.

BTW why do you need to have such JARs in dependencies?

0
Comment actions Permalink

@Serge @Nikolay, oh well, we use NACA (Cobol to Java code conversion) in our company for the legacy business code to convert native Cobol into Java bytecode for execution. And the code base is huge! 200MB (compressed) in one single JAR is common. And it consists of ~15k class files. Not to mention the variables and methods in those classes. Running Java transform agent on those classes just not possible too - Java just die. 

Most of the time as a developer I don't care about those JARs, as it is compiled code. Thus, most of the IDE features referencing those classes can be safely ignored or skipped. That's fine.  However, I do need it to be included in the deployed runtime folder in the application server. And to make thing complicated, I have to use IVY for the dependencies management. And we all know that the IVY support in IDEA is not so great comparing to Eclipse IVY plugin counterpart. I can't just exclude a particular JAR in the IVY dependency management in IDEA. 

Being able to skip a particular JAR / File from being indexed on the module dependencies will make a huge difference, from IDE performance perspective.

 

0
Comment actions Permalink

Adding the Jars to the File Exclusion list in the Setting ain't gonna fly because it also stripped out the Jars when building the artifacts for the application server deployment. 

In short, if there is anyway I can have the Jars physically presents in the project but able to by-pass all the indexing mechanism in the IDE, that will be ideal.

0
Comment actions Permalink

I have figured out where to intercept the indexing process. It is not pretty as it iterates through the VirtualFiles(each of the classes) and check if its parent is the target Jar. 

 

https://gist.github.com/johnnykang/eed464578e33f03cdc1b0d06c19c00e4

 

But it will work for me for now. 

0
Comment actions Permalink

Ok, I see. Excluding JARs indeed may cause problems because they won't be added to classpath, copied to artifacts etc. But did you try excluding the JAR content in library editor as I suggested?

0
Comment actions Permalink

@Nikolay well. I didn't try but I know it will work as per your instruction. The trouble is , I am using IvyDE as dependency management, it creates internal JARs container in the module, without exposing it to the 'Sources' tree, therefore I can't mark it as 'excluded'.  Furthermore, I only want to mark a particular JARs as excluded, not all JARs. Your instruction will mark the whole container as EXCLUDED, and I won't be able to type search in other JARs that I am interested in.

0

Please sign in to leave a comment.