We build in maven multiple projects (let's name them A,B,C). Project A uses .jar of project B which uses .jar of project C.
I am modifying codes of all A/B/C projects, (A is MVC app, B are business services and C is some shared layer).
The thing is, in Eclipse/NetBeans I can see all of them at once and it's comfortable to modify them. In IDEA though, I have to open 3 instances (or n instances) of IntelliJ IDEA.
Am I missing something? Is there better approach when using IntelliJ? This is the biggest downside of IntelliJ for me atm.
This question is related to
intellij-idea
Having all the related projects in the same root directory.
This will create a empty project, with a .idea directory that will simply remember the module organisation we are about to do in the next step
The project will be imported as a new module.
There is no need to move entire projects to a module. The use case for module is a bit finer grained than as a project container.
To open multiple projects in the same window:
File -> Open Project
Select open in this window.
Check box that says add to current project.
You can use Armory plugin which makes switching between projects comfortable. The default shortcut for Project List is Alt + A.
By default currently opened projects are displayed at the top of this list (with bold style).
I am new to maven and did not understand how I could work with local maven project added through Viktor Nordling's answer and still have a proper dependency in pom.xml file. The answer is simple: intellij first looks at your locally added module and if it doesn't find one it goes to get the project remotely. You can check this by looking at "external libraries" under your project browser when you add or remove maven module.
Hope this helps anyone.
To expand @Neo answer:
after choosing your directory. select import module from external model
and choose your model (maven in this case).
Then check keep project files
option from next dialog. It will keep all files in original directory.
Your final project structure would be something like this.
Now you can add your module as dependency to other module's pom.xml
and if you change the source code of your dependencies, Intellij takes care of updating your project (there is no need to run mvn
build manually for dependencies)
As of release 2019.2, this is as easy as File->Attach Project.
In IntelliJ 14.1.2, I did it like following:
Select File
->Project Structure
->Modules
.
Select +
and Import Module
and select the directory of your project(or directory where pom exists) and click OK.
Follow through the next flow of screens and after you click Finish
, you should see the project alongside your existing one.
Since macOS Big Sur and IntelliJ IDEA 2020.3.2 you can use "open projects in tabs on macOS Big Sur" feature. To use it, you have to enable this feature in your system settings:
System Preferences -> General -> Prefer tabs [always] when opening documents
After this step, when you will try to open second project in IntelliJ, choose New Window
(yes, New Window
, not This Window
).
It should result with opening new project in same window, but in the new card:
None of the solutions worked for me, since I am not working on Maven projects. There is a simpler solution. Go to:
File->Project Structure->Modules.
Instead of adding module, simply click the third option (copy). Browse your local directory and select the project you would like to add. Module name will resolve automatically. That's it.
Update: When you want to reopen to project with multiple sub-projects, in order to avoid re-doing steps as described above, just go to File->Open Recent->'Your Big Project'.
I think this has improved with recent versions of IntelliJ. In my current version (12.0.2), you can add any number of separate Maven projects to the same "workspace".
The simplest way I've found to do this is to click the little +
icon in the "Maven Projects" window (View > Tool Windows > Maven Projects) and then select the additional pom file you want to import.
Press "F4" on windows which will open up "Project Structure" and then click "+" icon or "Alt + Insert" to select a new project to be imported; then click OK button...
you can use import module option which will open it just like eclipse in the same navigator.
For people not using maven to build and wanting to add a new project (I am using intellij 14.1.3):
Depending on your builder, additional steps will be needed to add it to the build process.
For SBT, and in the top level project I modified the Build.scala file to aggregate the new project, and added the project in the SBT projects window. More info on SBT multiproject builds: http://www.scala-sbt.org/0.12.2/docs/Getting-Started/Multi-Project.html
To Intellij IDEA 2019.2, F4 + click on module, click to + for add any project from your HDD, above this menu yo can edit the IDE with you create the project and more options, very easy
Source: Stackoverflow.com