Project structures and modules

Hi all,

I hope this post can act a start for a better project and module structure. If this is already covered somewhere, I apologize: I couldn't find it easily.

Currently, I'm working at multiple projects, each consisting of multiple modules at the same time. At the moment, I have a hard time to do this with IntelliJ, because of the following reasons:

  • I have to open multiple instances of IntelliJ to work on different projects. If I don't do this, and get all the modules (if it's possible) in the same IDE instance, I cannot see the difference between project 1 and project 2. It's just a list of modules, and I have no idea which project relates to what.

  • Adding new modules is hard, since this should be done with the new project window (when the modules are based on external modules, like Maven/Eclipse)

  • I cannot easily 'close' modules, to exclude them from refactorings/code search/inspections/etc..

  • As a last note (less important, but quite irritating) : The project is a migration/refactoring project. I change 2 projects at the same time, creating files in both of them. However, the file headers are different in both projects, and changing the default templates will only work for one project.


The reason for all this, is that my current IDE view is a mess. In subversion, everything is nicely structures. Eg, my SVN repository looks likes this:

billing/trunk/ resourcing/trunk/ customers/trunk/]]>

Eg:

billing/trunk/commons
billing/trunk/services
billing/trunk/domain
customer/trunk/commons
customer/trunk/domain

When importing this, my project looks like this:

commons
services
domain
commons
domain

In short: no structure anymore. In my opinion, it would be great to have the SVN (or any kind of structure) resembled in my IDE. That would make the layout a lot clearer, and would give a better navigation etc through the projects. Combined with per-project settings, this would be a major improvement to an already great IDE!

Erik

Edited by: Erik Pragt on Mar 18, 2008 11:01 AM

9 comments
Comment actions Permalink

did you try the "move module to group" context action on modules ?

This should enable you to create module groups for your 3 top level categories

0
Comment actions Permalink

No, not yet. I'll try it out tomorrow, and I'll let you know!

0
Comment actions Permalink

Tibaut, I tried to use it, but it's not working at all. I keep loosing my Groups (still don't know when), creating a project with extra Maven modules keep on removing other modules (and popup with questions like: project x is not part of maven. Do you want to remove it? (Ofcourse I don't, I'm adding it!)

Anyway, in theory, this might be nice. It gives me the flexibility I need (at least, for project structure, the settings, etc are still IDE bound, instead of project/module bound), so thanks for the hint!

Update
I managed to reproduce it: when doing a 'Synchronize with Maven projects" action, my project structure is removed. I guess this is a bug, I'll report it...

Edited by: Erik Pragt on Mar 20, 2008 11:58 AM

0
Comment actions Permalink

Not sure this will help, but maven IDEA support allows you to create module groups for maven multi module projects (aka project with packaging pom, that includes other modules).

Guess this should be able to work for you, if you just create some aggregate poms

1 billing multimodule that includes billing/trunk/commons, billing/trunk/services, billing/trunk/domain as sub modules
1 customer multimodule that includes customer/trunk/commons, customer/trunk/domain as sub modules.

when you say

the settings, etc are still IDE bound, instead of project/module bound

what settings are you talking about ?

Some settings are IDE bound (file templates for example), but some others can be customized per project (not per module as far as I know though)

0
Comment actions Permalink

Thanks for the suggestion Thibaut, but I already have multimodule projects in maven. the billing and the customer projects both have a parent project, along with (around) 3 other projects. My directory structure looks like this:

billing/maven-billing-parent
billing/domain
billing/utils
customer/maven-customer-parent
customer/commons
customer/domain
etc...

What I see in IntelliJ is a list of 'maven-billing-parent', domain, utils, commons, domain, etc. When I group this, like as in your suggestion, and I resynchronize with Maven, all the groups are lost.

With 'the settings' I mean settings like file templates and code formatters, among others.

I don't want to set the settings per module, but I don't know the real difference between a project and a module. I thought that in IntelliJ you can open 1 project with multiple modules, but I have multiple (maven) projects, each with multiple modules.

0
Comment actions Permalink

in IDEA terminology , 1 project is equivalent to an Eclipse workspace, and you can only view one project in 1 IDEA window,
An IDEA project is composed of modules.

You can define code formatters per project. but not file templates.

I'm not sure i clearly explained what I meant for the module groups, did you check the checkbox shown in the screenshot ? This should create the module groups for you, based on your maven multimodules



Attachment(s):
Clipboard01.jpg
0
Comment actions Permalink

Ah, thanks! I didn't know about the checkbox.

(but now I have the problem that I don't like the names IntelliJ has given to my groups, nor having the option to change them... I still don't see why IntelliJ should remove my groups. If I want to create a structure of 3 levels deep, I keep on loosing that structure, even though I've only added an extra dependency....)

0
Comment actions Permalink

names of projects are taken from your pom's name IIRC (not artfactId)

Can't help you for IDEA overriding your settings :)

0
Comment actions Permalink

Crap, than I have to find someone else to blame ;)

0

Please sign in to leave a comment.