天天看點

配置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、配置完成可以開始工作啦~

**

繼續閱讀