intellij IDEA2021.1 Maven project使用

这篇博客指导如何在IntelliJ IDEA中新建一个Maven项目。首先从欢迎屏幕选择New Project,然后选择Maven选项。接着设置项目的SDK和(可选)archetype,输入GroupId、ArtifactId和Version等Maven坐标信息。如果使用archetype,可以进一步配置其属性。最后指定项目名称和位置,点击Finish完成创建。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Create a new Maven project

  1. If no project is currently open in IntelliJ IDEA, click New Project on the Welcome screen. Otherwise, select File | New | Project from the main menu.

  2. Select Maven from the options on the left.

  3. Specify project's SDK (JDK) or use the default one and an archetype if you want to use a predefined project template (configure your own archetype by clicking Add Archetype ).

    Click Next.

  4. On the next page of the wizard, specify the following Maven coordinates that are added to the pom.xml file:
    • GroupId- a package of a new project.

    • ArtifactId- a name of your project.

    • Version- a version of a new project. By default, this field is specified automatically.

    For more information on Maven coordinates, see Maven naming conventions.

    Click Next.
  5. If you are creating a project using a Maven archetype, IntelliJ IDEA displays the Maven settings that you can use to set the Maven home directory and Maven repositories. Also, you can check the archetype properties.

    Click Next.

  6. Specify the name and location settings.

    Click Finish.

### IntelliJ IDEA 2021.2 导入项目的具体方法 以下是关于如何在 IntelliJ IDEA 2021.2 中导入项目的详细教程: #### 1. 打开 IntelliJ IDEA 启动 IntelliJ IDEA 应用程序,进入欢迎界面。如果没有打开任何项目,默认会显示欢迎屏幕。 #### 2. 选择 “Import Project” 在欢迎界面上方菜单栏中找到并点击 **“Import Project”** 按钮[^1]。这一步用于加载现有的项目结构到 IDE 当中。 #### 3. 浏览本地磁盘寻找项目根目录 弹出窗口后,导航至存储有目标项目的文件夹位置,并选中它作为要导入的工程基础路径。通常情况下,该文件夹应该包含必要的构建脚本(如 Maven 的 `pom.xml` 或 Gradle 的 `build.gradle` 文件)以及源代码树状体系[^2]。 #### 4. 配置项目设置 当检测到有效的构建工具描述符时(例如 Maven),IDE 将自动识别这些依赖关系并通过专用向导引导用户完成初始化过程。此时可以根据实际开发环境调整 JDK 版本等相关参数: - 在 **“New Project Setup”** 页面里指定合适的 SDK; - 如果是基于 Maven 构建的话,则无需手动干预太多细节因为大部分属性可以从 POM 文件读取而来[^3]。 #### 5. 加载模块与索引建立 等待几秒钟时间让系统扫描整个工作区内的所有组件并将它们解析成内部表示形式。期间可能会涉及到下载缺失库、编译初步验证等工作项。完成后即可正常编辑运行调试您的应用啦! --- ```xml <!-- Example of setting properties inside pom.xml --> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> ``` 上述 XML 片段展示了如何在 Maven 工程中定义编码方式及兼容性级别,确保跨平台一致性的同时也便于后续维护升级[^3]。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值