天天看点

配置IDEA和Maven配置IDEA配置Maven

配置IDEA

安装完IDEA之后我们需要做一些设置,让IDEA更好地运行。

1、将自动导包设置打开

配置IDEA和Maven配置IDEA配置Maven
配置IDEA和Maven配置IDEA配置Maven

2、设置默认新项目选项

注意:File-->New Projects Settings-->Settings for New Projects

这样新建项目就不需要重新选择Maven路径了

配置IDEA和Maven配置IDEA配置Maven

配置Maven

用于springboot开发

1、下载maven前往https://maven.apache.org/download.cgi下载最新版的Maven程序

配置IDEA和Maven配置IDEA配置Maven

2、将其解压到C:\D\Maven-3.8.1-bin\apache-maven-3.8.1

配置IDEA和Maven配置IDEA配置Maven

 3、配置环境变量 MAVEN_HOME

配置IDEA和Maven配置IDEA配置Maven
配置IDEA和Maven配置IDEA配置Maven

4、maven设置

在配置文件settings.xml中加入下列代码,为maven换源阿里云的源,指定JDK的版本

注意:需要删除原有setitngs.xml中的标签,否则后续会报错

配置IDEA和Maven配置IDEA配置Maven
<mirrors>

      <mirror>

        <id>nexus-aliyun</id>

        <mirrorOf>central</mirrorOf>

        <name>Nexus aliyun</name>

        <url>http://maven.aliyun.com/nexus/content/groups/public</url>

      </mirror>

  </mirrors>

  <profiles>

         <profile>

              <id>jdk-11</id>

              <activation>

                <activeByDefault>true</activeByDefault>

                <jdk>11</jdk>

              </activation>

              <properties>

                <maven.compiler.source>11</maven.compiler.source>

                <maven.compiler.target>11</maven.compiler.target>

                <maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>

              </properties>

         </profile>

  </profiles>
           

5、测试安装是否成功

windows自带cmd:Win+R---> cmd

命令:mvn -v

配置IDEA和Maven配置IDEA配置Maven

6、配置IDEA中的Maven

选择对应的安装路径即可

配置IDEA和Maven配置IDEA配置Maven
配置IDEA和Maven配置IDEA配置Maven

7、创建一个新的Mvaen项目

配置IDEA和Maven配置IDEA配置Maven
配置IDEA和Maven配置IDEA配置Maven

8、安装maven相关的包

依照下图所示在IDEA右侧找到Maven按钮点击下载源码和文档,等待一段时间即可

配置IDEA和Maven配置IDEA配置Maven

9、配置完成可以开始工作啦~

**

继续阅读