学习笔记 - Intellij IDEA 几个重要概念

声明: 内容转自 https://github.com/judasn/IntelliJ-IDEA-Tutorial/blob/master/project-composition-introduce.md

作者写的非常详细,防止丢失,故此处做学习笔记,便于翻阅


------------------------------ 转载内容 -------------------------------

Project 和 Module 介绍

这两个概念是 IntelliJ IDEA 的必懂知识点之一,也是容易混淆的两个概念,搞清楚非常重要,请务必要学会。

一个非常重要的事情:IntelliJ IDEA 没有类似 Eclipse 工作空间(workspace)的概念的。很多从 Eclipse 转过来的人总是下意识地要再同一个窗口管理 n 个项目,这在 IntelliJ IDEA 是无法得到。IntelliJ IDEA 提供的体验是:一个 Project 打开一个 Window 窗口。

对于 Project,IntelliJ IDEA 是这样解释的:

1) Whatever you do in IntelliJ IDEA, you do that in the context of a project. A project is an organizational unit that represents a complete software solution. It serves as a basis for coding assistance, bulk refactoring, coding style consistency, etc.
2) Your finished product may be decomposed into a series of discrete, isolated modules, but it's a project definition that brings them together and ties them into a greater whole.
3) Projects don't themselves contain development artifacts such as source code, build scripts, or documentation. They are the highest level of organization in the IDE, and they define project-wide settings as well as collections of what IntelliJ IDEA refers to as modules and libraries.

对于 Module,IntelliJ IDEA 是这样解释的:

1) A module is a discrete unit of functionality which you can compile, run, test and debug independently.
2) Modules contain everything that is required for their specific tasks: source code, build scripts, unit tests, deployment descriptors, and documentation. However, modules exist and are functional only in the context of a project.
3) Configuration information for a module is stored in a .iml module file. By default, such a file is located in the module's content root folder.
4) Development teams, normally, share the .iml module files through version control.
通过上面的介绍我们知道,在 IntelliJ IDEA 中 Project 是最顶级的级别,次级别是 Module。一个 Project 可以有多个 Module。目前主流的大型项目结构都是类似这种多 Module 结构,这类项目一般是这样划分的,比如:core Module、web Module、plugin Module、solr Module 等等,模块之间彼此可以相互依赖。通过这些 Module 的命名也可以看出,他们之间应该都是处于同一个项目业务情况下的模块,彼此之间是有不可分割的业务关系的。


所以我们现在总结:一个 Project 是由一个或多个 Module 组成,模块之间尽量是处在同一个项目业务的的情况下,彼此之间互相依赖关联。这里用的是 尽量,因为 IntelliJ IDEA 的 Project 是一个没有具备任何编码设置、构建等开发功能的,主要起到一个项目定义、范围约束、规范等类型的效果,也许我们可以简单地理解为就是一个单纯的目录,只是这个目录命名上必须有其代表性的意义。


原贴中有一些动态 GIF以及文字说明,非常清晰,需要的话,可以原贴查看

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值