Suggestion for 8.0 intellij :)

Hey guys,

I am going to probably cause a stir up here in the forums because of what I am about to suggest. But is there anyway we can have like working sets and the ability to load up multiple projects at the same time in the same window without having to open up a separate editor and just clutter the desk? The reason I ask is because I am working on 5 different projects that are connected to each other because of dependencies between them and it is so much easier in Eclipse to have all of them open and just search in between them. I created some working sets in Eclipse to help narrow stuff down in searches and its brilliant. Is there any possibility of having something like that implemented in the 8.0 release?

Cheers !

PS : If there is already a way to do soemthing like that in the current 7 release let me know and I will be forever grateful ;)

13 comments

Hello Surya,

I am going to probably cause a stir up here in the forums because of
what I am about to suggest. But is there anyway we can have like
working sets and the ability to load up multiple projects at the same
time in the same window without having to open up a separate editor
and just clutter the desk? The reason I ask is because I am working on
5 different projects that are connected to each other because of
dependencies between them and it is so much easier in Eclipse to have
all of them open and just search in between them. I created some
working sets in Eclipse to help narrow stuff down in searches and its
brilliant. Is there any possibility of having something like that
implemented in the 8.0 release?


Why don't you simply create a single project which contains each of those
5 sub-projects as a module?

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

:) I'm in the same situation here. These guys here prefer Eclipse and the application has 7 Eclipse projects inside. 3 of them make up an ejb1.jar, 1 of them makes up an ejb2.jar, other 2 of them make up web.war and the last one makes up utility.jar which can be used in ejb1.jar, ejb2.jar and web.war. And of course they use MyEclipse (version 6.5). Interestingly, MyEclipse allows them to put the utility.jar code in all ejb1.jar, ejb2.jar and WEB-INF/classes of the web.war. I want to work on this application in Idea and I tried to put the utility.jar code in both ejb's and the web.war, but Idea doesn't let me to do that and I think it's right.

So I create 4 Idea modules for ejb1, ejb2, web and utitlity respectively (actually, I can create 1 module with 2 ejb facets and 1 web facet, and 1 module for the utility). The source for the ejb1 module comes from the 3 Eclipse projects. The source for the ejb2 comes from 1 eclipse project, the source for the web comes from 2 eclispe projects. And then I don't need to create 7 Idea projects.

Attached is how those Idea modules are laid out.



Attachment(s):
idea.png
0

I am wondering how I would do what you suggest because we are using mvn to create the intellij project files. So we have project1 and it has 5 modules in intellij and we have project 2 which has 3 modules...i do mvn idea:idea in the project 1 folder and i do mvn idea:idea in project 2 folder and then I am able to load them up. project 1 and project2 are in the same level if you think about folders on a hard drive. So I dont see how I am going to load up project 1 and project 2 as modules...and also logically that does not really make sense because what would I call the parent project? Names are very important especially since I am working with like 15 diferent projects lol.

0

When I faced a similar situation at one point, I took advantage of the Module Groups to help organize things. First I created a separate IDEA project for each actual project. I created all the modules for each project. This allowed me to work on the projects individually when I wanted to. Some times its easier to focus on the one task. Or I could open two of the projects, with one on each monitor. Creating a separate IDEA project for each actual project also allowed me to use the various project level tools. (These weren't maven projects, so I did not use that, but you could.)

Once I had all the IDEA projects created, I created a parent IDEA project. I simply added all the already existing individual modules for each project. (So you have to add each module one at a time rather than all modules at once.) As I added the modules, I grouped them in a module group named the same as the actual project's name. I even further organized some of the modules in the one project into a sub-group since that project itself had a module group.

I've attached a screen shot that shows the configuration in terms of hard drive hierarchy, IDEA's project view, and the project settings dialog.

You asked "what would I call the parent project?" Well, if the projects are being grouped at work, they must have something common to them. How are they collectively referred to around the office? Even if it is a department name that can be used to collectively refer to them. If it's two projects, you can use a name like "project1-project2-bundle". Or use generic names like "All-Projects", "My-Project-Group", "Project-Bundle-1", "Workspace", "IDEA-Workspace", "Projects", etc. I mean Eclipse simple calls it a "workspace". ;)

I hope that helps.



Attachment(s):
many-to-one-projects.png
0

oh, thanks a lot
i didn't know about such functionality
thanks to you, now I have a lot of module groups :)

0

Beware, cause there are some problems with them. The main problem is that because they are modules, and not projects anymore, you cannot build when one of the (totally unrelated) projects/modules has a compilation or other kind of error. You cannot close the module to prevent this. Also, some of the functionalities in IntelliJ just don't work as nice anymore, like 'open type', because you cannot filter on modules, not even when you create your own custom scope. Just some 'things' to keep in mind!

0

Exactly which is why does it not make sense for Intellij to handle projects like the way Eclipse does?

0

I may be wrong, but it seems to me the "issue" is hugely overblown. Just don't use mvn idea:idea, and, instead, create a new IntelliJ project from external maven configurations - by specifically choosing the POMs you want included in your project. All those POMs result in separate IntelliJ modules, and IntelliJ/Maven will resolve the dependencies specified in the POMs.

IntelliJ encourages developers to create modular projects with elegant minimal dependencies. But it can't force them to completely avoid doing stupid things. It never stops to amaze me how much trouble is caused on a daily basis simply because some "software engineers" just can't design anything right - starting with the project structure! Most of the time you don't even have to look at the code to see how messed up the project is: just look at its package structure.

Why can't people see how simple everything can be - if you just think a tiny bit before you do anything? Just package components according to their functional domain. And minimize the dependencies between such components. Let's say you have an Account component that encapsulates all things account. Within that component, you may include subpackages for account-related domain objects, account-related business service (that define the service APIs, and, perhaps, some re-usable implementations that more than one application will use; applications may provide app-specific implementations in their own project's packages), etc. Within the service package, you may have a data access package (for the business service DAO layer), etc. Then, any application or other component/module that needs the account-managing functionality, could simply have a dependency on the Account component (that is all compiled and distributed as account.jar). The component may have dependencies on other components such as Commons, Address, etc. And some User component will have a dependency on the Account component, if need be. Instead, many projects I see put all domain objects (that serve totally different purposes) into one Domain module, all services are bundled in some Services module, etc. It sounds insane - if you think about it - but people even bundle all exception classes (regardless of the area of functionality they relate to) in some package called "exceptions". Then, they do the same thing with constants! So, everything gets coupled in the end. To top it all off, they collect all properties (e.g. account service properties, user svc properties, authentication properties, connection properties, other functinoal domain specific properties) in one(!) property file! Then, there is some sort of idiotic PropertyManager class that "manages" these properties, and all disparate services are using that object, and therefore are all coupled through that object, as well as through the constants package, through the exceptions package, etc. As the result, you can't reuse just one small functional piece in a different application. Everything is tightly coupled - for one specific application. So, you still end up with tons of modules/projects that are not really detachable from one another, nothing is compartmentalized, everything has dependencies on everything else. Brrrrr...(You'd think I am making it all up? Nah... True story...And it's not the worst I've seen.)

0

Good post and I agree with you wholeheartedly. You suggested not to use the mvn goal to create the Intellij files. Great I wont but we do have a lot of POMs unfortunately. I am rather new to Maven mostly having used Ant before so bear with me on this. Most of the time I am moaning about this is because I need to look at the sources to better understand the API other devs have written so I have 4-5 Intellij windows open and I switch between them. So if I do it your way that you suggested then suppose if I Ctrl Click into a class called Class 2 that is being referred in Class 1 say, then it would directly open up the source right? It wont go and open up the decompiled stub?

0

The way I'm working here (projects are maven based too), is i create an "artificial" pom materializing my "workspace" (from eclipse vocabulary).
This pom has packaging = pom and declares every maven project I want to work on (eg, open in the same IDEA project) as modules.

Then you can go forward and just open this "workspace pom"

0

Beware, ...


for me it's ok
I like to have different projects in different idea instances
I've organized modules in groups only within one project

0

Surya, your assumption is correct. Here's the summary of what you'd normally do when creating a new IntelliJ work environment from existing Maven configurations:

1) Check out all your necessary project sources (POMs, Java, resources, etc.) into a dedicated local project folder on your machine.
2) When creating a brand new project, choose the "Import Project from External Module" option;
3) In the next window, choose Maven (vs. Eclipse, JBuilder, etc.)
4) In the "Select Root directory" field, specify the root where you have checked out all your project sources - from step 1.
5) Select "Create IDEA modules for aggregative projects (with 'pom' packaging)"
6) You may also select "Exhaustive Search (look for Maven projects under other Maven projects)", but leave the rest of the boxes unchecked.
7) Click the "Advanced" button and make sure that your Maven HOME and Repo folders are set properly. (I prefer to use an external Maven installation that I download from the Maven site - vs. the embedded Maven that comes w/IntelliJ, but it's really up to you.)
8) Click "Next". IntelliJ will display the list of all POM files it finds in your root folder. You can then select all or some of the POM projects from that list. The selected POMs will be used by IDEA to create IntelliJ modules within your new project.

If all your POMs are correctly configured, the resulting project will contain all the sources, libraries, and dependencies you need. You will then be able to work on any individual modules, and jump to the source/definitions of any class in any other module that the given module depends on.

You will also be able to update/commit the sources from any of the modules separately - if you have configured IntelliJ to use your VC system.

Note, that the whole procedure should normally take just a few minutes. Later, you can create another project with less or more modules included.

HTH,
Constantine

0

Great! Thanks for that post. I will try it out as soon as I can!

0

Please sign in to leave a comment.