IntelliJ: Working on multiple projects

2019-01-08 03:10发布

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.

15条回答
家丑人穷心不美
2楼-- · 2019-01-08 03:26

To expand @Neo answer: after choosing your directory. select import module from external model and choose your model (maven in this case).

choose model

Then check keep project files option from next dialog. It will keep all files in original directory.

options

Your final project structure would be something like this.

structure

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)

查看更多
迷人小祖宗
3楼-- · 2019-01-08 03:28

Prequisite

Having all the related projects in the same root directory.

Steps

1) First you create a new Empty project

New empty project


2) Then you select the root directory of all you projects.

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

Select root directory


3) Then, in the next window, you import the different projects as modules

Import projects as modules


4) In the next window, to import each project, simply double click on the build.gradle, or pom.xml

The project will be imported as a new module. Select build file


5) Done, you now have all your projects as modules, opened on the same IntelliJ project

Result

查看更多
地球回转人心会变
4楼-- · 2019-01-08 03:28

You can use Armory plugin which makes switching between projects comfortable. The default shortcut for Project List is Alt + A.

Screenshot of Project List window

By default currently opened projects are displayed at the top of this list (with bold style).

查看更多
啃猪蹄的小仙女
5楼-- · 2019-01-08 03:35

Please follow these steps:

Step 1: Open "Maven Projects"

enter image description here

Step 2: Select project you want to import:

enter image description here

查看更多
Explosion°爆炸
6楼-- · 2019-01-08 03:36

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.

查看更多
SAY GOODBYE
7楼-- · 2019-01-08 03:37
  • new empty project
  • File -> New -> Module from Existing Sources
查看更多
登录 后发表回答