Big project with many jars

I have a big project which contains multiple modules. Each one of them will often refer to the same 3rd party jar such as weblogic, log4j, etc. but in different locations.

i.e.
module1 -> module1/jars/weblogic.jar
module2 -> module2/jars/weblogic.jar
module3 -> module3/jars/weblogic.jar

This yields to large memory consumption in J-IDEA. Is it possible to check if those jars are the same and then you don't need to reprocess the same jar again?

5 comments

Hello Nat,

This is not possible unfortunately since any of these jars can change independently
at any moment and we should be aware of the fact.

-


Maxim Shafirov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

I have a big project which contains multiple modules. Each one of them
will often refer to the same 3rd party jar such as weblogic, log4j,
etc. but in different locations.

i.e.
module1 -> module1/jars/weblogic.jar
module2 -> module2/jars/weblogic.jar
module3 -> module3/jars/weblogic.jar
This yields to large memory consumption in J-IDEA. Is it possible to
check if those jars are the same and then you don't need to reprocess
the same jar again?



0

Nat,

Wouldn't it be simpler to just add those jars as project or global libraries in IDEA? I would just create a new directory project/jars or global/jars and put the weblogic.jar, log4j.jar etc. In IDEA, you add all the global/jars/*.jar as project or global jars.

You can just leave the weblogic.jar, log4j.jar, etc. in each of the module/jars directories alone. Just don't add them to IDEA's module libraries.

-Alex

0

Thanks Alex. I understand that but somehow that was the setup of the projects. 3rd party jars got updated all the time during the development process and each module may refer to the same version of jar or it may not. So it would be pretty difficult to refer it as global libraries. I don't like it either.

Somehow, J-IDEA should be smart enough to cache and reuse the jar information. When the jar got changed, J-IDEA will be notified by the file system and if those jars start to be different. It should start to cache the jar information separately.

0

But if the module libraries change, don't you have to manually go update the libraries in IDEA Settings?

If you always have weblogic.jar, log4j.jar, etc. available as project libraries then when you edit the module's jar libraries, if the module has a weblogic.jar, you would just check off the weblogic.jar in the project jar section instead of having to add a new module library "weblogic.jar". If a module doesn't use weblogic.jar, then weblogic.jar would be uncheced in the project jars section. This seems to be what you want; I don't see the problem.

Is the reality even more complicated than you have explained, i.e. some of the weblogic.jar's are different
from the other ones and you want IDEA to sort it all out
by doing binary comparisons of the jarfiles?

The problem with what you are suggesting is that even thought conceptually the weblogic.jar is the same for all the modules, there is a copy of weblogic.jar in each module directory, e.g. modulexyz/jars/weblogic.jar. If you add each of those individual weblogic.jar for each module, then IDEA has to treat them as separate files.

0

Please sign in to leave a comment.