简体   繁体   English

在多个项目中使用模块IntelliJ

[英]Use module in multiple projects IntelliJ

我有几个项目需要相同的核心数据库和实用程序类,所以我决定制作一个“核心”模块来放入这些模块。有没有办法在多个项目中使用这个模块,或者我是否使用模块用于错误的目的?

Yeah! 是啊! While I obviously can't provide a thorough critique of how you're using modules given what you've told us, the fact that you've encapsulated reusable functionality in this one is certainly a good sign! 虽然我明显无法根据你告诉我们的内容对你如何使用模块提供全面的批评,但你在这个中封装了可重用功能这一事实无疑是一个好兆头!

Given that such is the purpose of modules, surely intelliJ would want to make it easy to share them across projects - and they did: In the File menu, there's an option to "Import Module". 鉴于这是模块的目的,当然,intelliJ希望能够轻松地跨项目共享它们 - 并且它们确实:在“文件”菜单中,有一个“导入模块”选项。 Click that and walk through the wizard, selecting the directory where your module is stored, and it'll appear in your Projects menu as normal. 单击它并浏览向导,选择存储模块的目录,它将正常显示在“项目”菜单中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM