# IntelliJ IDEA 如何将另外的模块添加到项目中

**URL:** <https://www.isharkfly.com/t/intellij-idea/13829>\
**Category:** 软件技术\
**Tags:** ide\
**Created:** [December 9, 2021, 3:32pm UTC](https://www.isharkfly.com/t/intellij-idea/13829 "2021-12-09T15:32:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [December 9, 2021, 3:32pm UTC](https://www.isharkfly.com/t/intellij-idea/13829/1 "2021-12-09T15:32:03Z")

</div>

最近我们在开发一个 API 项目。

但是项目分成了 2 个仓库一个仓库名称为：mls-common，另外一个仓库名称为：mls-service

mls-service 需要导入 mls-common 的包。

在开发的时候，如果我们不在 IntelliJ IDEA 中导入模块的话，每次对 mls-common 的修改都需要重新打包，然后让 mls-service 调用，更糟糕的是 mls-service 没有办法访问到 mls-common 中的源代码。

## 解决办法

解决办法就是可以将 mls-common 作为模块导入到 mls-service 中。

因为这 2 个项目使用的是不同的 mavne pom，因此没有办法自动导入。

在 mls-service 中选择项目结构，然后选择模块。

![IJ-import-01](https://www.isharkfly.com/images/transparent.png)

然后单击上面的 + 号，然后选择导入模块。

![IJ-import-02](https://www.isharkfly.com/images/transparent.png)

然后选择需要导入的模块后进行导入。

在导入成功模块后重新进行编译就可以了完成并行开发了。

![IJ-import-03](https://www.isharkfly.com/images/transparent.png)

上面就是 IntelliJ IDEA 导入模块的用途。
