简体   繁体   English

使用IntelliJ IDEA中的模块

[英]Working with modules in IntelliJ IDEA

As I understand, using modules allows us to control some dependencies. 据我所知,使用模块允许我们控制一些依赖项。

I mean that we can allow one module to interact with another one but not vise versa. 我的意思是我们可以允许一个模块与另一个模块进行交互,但反之亦然。 We also can make some reusable things and we can make deploying easier, if, for example, put all tests stuff into a separate module and won't deploy it to production. 我们还可以制作一些可重用的东西,并且我们可以使部署更容易,例如,如果将所有测试内容放入单独的模块中,并且不将其部署到生产中。

I haven't ever use modules but if described things are really possible I'd like to know how to make them. 我从来没有使用模块,但如果描述的话,我真的很想知道如何制作它们。

  1. How to set dependencies? 如何设置依赖?
  2. How to do this without IDE and any tools? 没有IDE和任何工具怎么做?
  3. How to do it in IntelliJ IDEA? 如何在IntelliJ IDEA中执行此操作?

Managing the dependencies yourself can quickly get complicated for non-trivial applications. 对于非平凡的应用程序,自己管理依赖项可能会很快变得复杂。 For dependency management in Java, I suggest looking at Maven. 对于Java中的依赖管理,我建议看看Maven。 Using the "test" scope you can bundle the project without all of the testing code. 使用“测试”范围,您可以在没有所有测试代码的情况下捆绑项目。 IntelliJ, like other populate IDEs, has built-in support for Maven. IntelliJ与其他填充IDE一样,内置了对Maven的支持。

Maven - Introduction to the Dependency Mechanism Maven - 依赖机制介绍

Hope it helps! 希望能帮助到你!

在IntelliJ中,您可以选择模块并右键单击它,并为所选模块设置属性(包括依赖项)。

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

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