更新时间:2021-08-25 01:33:59
你可以打开每个IDEA窗口只有一个IDEA项目。但Maven项目可以由多个模块组成,每个模块都有一个拥有自己的 pom.xml
。您还可以在同一个IDEA项目中导入多个Maven项目。
You can open only one IDEA project per IDEA window. But a Maven project can be made of multiple modules, each one having its own pom.xml
. You can also import multiple Maven projects in the same IDEA project.
如果您有现有的Maven项目,只需打开根 pom.xml
使用文件>打开
,IDEA将询问您是否应作为Maven项目开放(假设您已在IDEA中启用了Maven插件)。当您对 pom.xml
进行更改时,IDEA会建议您重新导入项目,从而添加/删除库以使IDEA项目与Maven项目同步。
If you have an existing Maven project, just open the root pom.xml
using File > Open
and IDEA will ask you if it should be opened as a Maven project (providing you have enabled the Maven plugin in IDEA). When you make changes to a pom.xml
, IDEA will suggest you to reimport the project, thus adding/removing libraries to synchronize the IDEA project with the Maven project.
要向hibernate添加依赖项,请添加以下代码:
To add a dependency to hibernate, add this code:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.9.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>4.1.9.Final</version>
</dependency>