Module Dependencies (I am getting a headache)

Note: sorry I meant to post this here and not EAP :(

Help!

We have a development project that is broken into 6 sub projects. In
Eclipse these were 6 separate projects in the workspace with dependencies
created between them.

I have used IDEA's concept of modules to do achieve the same but I seem to
be getting funny behaviour (and probably as a result of something I am doing
wrong).

The project has two essentially 3 parts:
1. Client Side
2. Server Side
3. Common


Client Side Module Dependencies
-



JavSwingFrameWork depends on JavDto and JavCommon

JavSwing depends on JavSwingFrameWork, JavDto, and JavCommon

Both JavSwingFrameWork and JavSwing also use the .jar file from
JavWebServices (which is a result of an RMI compile)



Server Side Module Dependencies
-



JavReports depends on JavDto and JavCommon

JavWebServices depends on JavReports, JavDto and JavCommon



Common Dependencies
-


JavCommon depends on JavDto



Initially I just used the dependencies tab to 'tick' the modules each
needed, and this seemed ok. Occasionally though the source code in one
module would not navigate (Go to declaration) to the source of a class in
another module, it would instead show a compiled version.

I have however, recently added the JavReports module to the mix and have
started having problems whereby the class using a class from another module
cannot see all the available public methods to that class.

I have also tried turning off the dependencies and using the 'export' option
to make a module visable.

e.g.
rather than have JavWebServices depend on JavReports, JavDto and JavCommon,
I have it only depend on JavReports. I have JavReports only depend on
JavCommon.
And then JavCommon exports JavDto, JavReports exports JavCommon and JavDto.

But this not seem to fix my problem of classes not having the correct
visability.

Any thoughts??? Things I am doing wrong? What should I be doing?

Thanks
Shane

--
"If A is success in life, then A equals x plus y plus z. Work is x; y is
play; and z is keeping your mouth shut." -- Albert Einstein



1 comment
Comment actions Permalink

I'm facing the same problem, sort of. Has anyone had experience with very large multi-module projects like the one I describe here?

We have a very large enterprise non-web system with hundreds of software modules with a fairly large dependency tree. Some of us started using IDEA recently and the approach so far has been to define one IDEA project (and thus one module) per software module.

In each such project we have ant set up to build that particular module based on all modules that depend on it, which works by assuming the IDEA project name is the same as the module name (MyModule.ipr for the module MyModule.) The way the ant build files figure out the dependency order between our modules is not IDEA-dependent, instead using dependency information in a legacy format (which we can't change, so I want to accomplish something similar).

Each module's deliverables are a set of JAR files for different targets (clients, servers, etc). We have defined each module as a global library so other IDEA projects can depend on them.

So far everything has worked fine and we're very happy with IDEA. What is lacking is of course that refactoring inside one module doesn't affect other modules that depends on it, since they're residing in different IDEA projects. So, I tried to define an "umbrella" project that used the existing .iml files from some individual projects (I imported four individual modules). But when I did that, I noticed that IDEA stopped recognizing the source files in the source path for (seemingly a random number of?) modules.

Then I figured that perhaps this global library thing was wrong, removed it, and used the IDEA dependencies mechanism instead. That seemed to help - now the source files were recognized again, but of course the individual projects no longer compile since their modules' library dependencies aren't set anymore.

There are basically three snags remaining:

1) Since each module is built independently with ant (there's one common build.xml for the entire application which gets the target module name passed to it as a parameter), the old way of relying on the project name being the same as the ant build target no longer works. In the individual .ipr files, we set an ant property module.name=$ProjectName$. Would it be possible to define a new macro $SelectedModuleName$ or the like, expanding to the module name of whatever module was selected at the time or the module the current source file belongs to? (I just found the $Prompt$ macro, which works all right, so this is perhaps not such a big deal after all. :)

2) Removing the use of global libraries and instead using IDEA's dependency mechanism means that the invidivual module .ipr projects will no longer compile. I suppose I could define two .iml modules for each of our software modules, one for the individual .ipr project and one for the umbrella project, but the documentation says that having two different modules sharing the same context root may break things (how?).

3) I'm worried about memory usage and editor speed. Is there some way to tell IDEA to only "load" certain modules? I once tried adding around 25 modules to an "umbrella" project, and then opening the Paths dialog from the Settings dialog caused IDEA to freeze for several minutes (before I got bored and killed the application).

So, basically, is there some good way to share .iml files between several .ipr projects, and is there some way to dynamically pass the name of an IDEA module, as opposed to project name, to an ant build in a macro? And is IDEA built to cope with projects containing 30+ modules?

Cheers,

Jonas

0

Please sign in to leave a comment.