Concepts and differences between Project and Module in IntelliJ IDEA

In IntelliJ IDEA, there is no concept similar to Eclipse workspace (Workspace), but Projectthese Moduletwo concepts are proposed. Next, let's see how IntelliJ IDEA officially describes the two!

For Project, IntelliJ IDEA officially introduced it like this:

A project is a top-level organizational unit for your development work in IntelliJ IDEA. In its finished form, a project may represent a complete software solution. A project is a collection of:

  • Your work results: source code, build scripts, configuration files, documentation, artifacts, etc.
  • SDKs and libraries that you use to develop, compile, run and test your code.
  • Project settings that represent your working preferences in the context of a project.

A project has one or more modules as its parts.

For Module, IntelliJ IDEA officially introduced it like this:

  • A module is a part of a project that you can compile, run, test and debug independently.
  • Modules are a way to reduce complexity of large projects while maintaining a common (project) configuration.
  • Modules are reusable: if necessary, a module can be included in more than one project.

Through the above introduction, we know that it Projectis the top-level structural unit in IntelliJ IDEA, and then Module, one Projectcan have multiple Module. At present, the mainstream large-scale project structures are basically multi Module-structures. Such projects are generally divided according to functions, such as: user-core-module, user-facade-module and user-hessian-module, etc. can depend on each other. It can be seen from the naming of these Modulethat they are all modules in the same project and have an inseparable business relationship with each other.

Therefore, we can roughly conclude that one Projectis composed of one or more Modulemodules, try to keep each module in the same project, and have an interdependent relationship with each other at this time. Here, the reason for saying "try as much as possible" is because IntelliJ IDEA Projectdoes not have any development functions such as coding settings and builds. It mainly has the effect of a project definition, scope constraint, and specification type. Perhaps, we can also simply Geographical understanding Projectis a simple directory, but this directory must have its representative meaning in naming. In general, IntelliJ IDEA is Projectsingle Module. At this time Project, Modulethe two are combined into one. When the storage path is not modified, it obviously Projecthas Modulea strong constraint on it! But to be honest, here is the directory where Modulethe content is placed , and in fact, it is still self-restraint.ProjectModule

000

  • Label 1: Project name, project name;
  • Note 2: Project location, project storage address;
  • Label 3: Module name, module name;
  • Note 4: Module file location, module storage address.

As shown in the figure above, by observing Projectthe Modulestorage address of and, we can find that a directory named is created here user-core-moduleand placed under user-modules-projectthe directory named, without combining the two directories into one, It also prepares us to build more Module.Project

111

As shown in the figure above, it is obviously user-modules-projectonly a directory.

112

As shown in the figure above, click File–> New–> Modulein turn to enter the following interface:

113

As shown in the figure above, after input Module name, Content rootand Module file locationautomatically change, and then click finishto complete:

114

user-modules-projectAs shown in the figure above, we have established two in the project Module, namely user-core-moduleand user-hessian-module. Next, let's look at the storage directory:

115

As shown in the figure above, obviously in the user-modules-projectdirectory, there is another directory named user-hessian-module. At this point, many builds Moduleare complete!Project


———— ☆☆☆ ——Back- >The easiest IntelliJ IDEA tutorial in history<- Contents—— ☆☆☆ ————

from here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324764462&siteId=291194637