How to have multiple module in a Project

After hearing the news of Idea walking on path of Open-Source ,i decided to give it a go.

Have heard so much good things about this i was expecting a pleasent ride , but alas! i am not even able to do basic work.

I just wanted to create a Workspace (Project in IDEA) having several independent projects (module in IDEA) and am not even able to get this right.

I am able to create first Module correctly , its just when i try to create a second independent module ...i am getting lost.

IDEA just place this inside the first module or sometime the second module is not proper maven project which can be run independently.

I know that i may be doing something really silly as this is very common requirement/feature ?

Please help me in sorting this out .


I am using community edition .



Attachment(s):
screenshot.JPG
1 comment
Comment actions Permalink

Welcome to the IDEA community.

If you go into the "Project Structure" dialog (Ctrl+Alt+Shift+S, or File | Project Structure, or click the button next to project settings on tool bar) and select "Modules" under "Project Settings" on the left, you will see all your modules. If you open the context menu on a module (right-click or context menu key) you will see a menu option to Move the module at the bottom of the menu. You can move it to the top level, or add it to a new or existing module group. And you can create child module groups within other module groups. See the attached screen shot for an example. If you take a look at this post -- http://www.jetbrains.net/devnet/message/5220894#5220894 -- there is some discussion on modules and module groups. And a way you can mimic the Eclipse workspace concept if desired. (I'll attach to this post a zip file with the sample projects I mocked up for that post.) That example shows three projects, which all contain sub-modules, that can be opened separately (i.e. in separate windows) or together via the "all-projects" project. It then uses module groups to group things. This mimics the Eclipse workspace concept if that is desired.  But I would recommend trying to work with the way IDEA organizes things such that each project is opened in its own window. In the end, I think it keeps things more organized, less cluttered, and is easier to work with. And remember, when desired you can add module X from project B to project A.

The other factor in where you will see the projects in the tree of the Project tool window is where the files exist on the disk. For example, in the projects I attached, the two sub modules "sub-mod-1-A-i" and "sub-mod-1-A-i" exist on disk in the subdirectory of "mod-1-A", so they show up in the project tree as a sub-node to "mod-1-A" even though they are part of the "Project-1" module group within the "all-projects" project.

Note that the example projects I posted  are using the older project format of a single .ipr file rather than the newer .idea directory based structure. But the concepts are the same. I just created those samples a long time ago and never converted the four projects to the .idea directory structure.

I hope that helps.

Regards,

Mark



Attachment(s):
screenshot.png
project-examples.zip
0

Please sign in to leave a comment.