IDEA comes with Maven configuration and use (download)

This article mainly explains how to configure and use the Maven that comes with IDEA. If you don't want to use the Maven that comes with the compiler, you can download, install, and then continue to configure.
Download link (soon):
http://maven.apache.org/download.cgi

How to download the .zip file by selecting the version you need, unzip it, the steps are the same

Insert picture description here

You can see in IDEA's default Maven, the installation address and version of Maven
Insert picture description here

Configure the environment variable
MAVEN_HOME
D:\IDEA\plugins\maven\lib\maven3
Insert picture description here

Add path

Win10 directly add a variable
%MAVEN_HOME%\bin

For Win7, you need to add both before and after;
;%MAVEN_HOME%\bin;
Insert picture description here

Verify, open cmd to view the Maven version, if the correct Maven version appears, it means the configuration is correct
Insert picture description here

Choose a suitable folder as the local Maven repository, here is a new repo folder
Insert picture description here

Modify the settings.xml file

Modify the address of the local Maven warehouse
Insert picture description here

Release the commented code and modify the path
Insert picture description here

Modify remote warehouse address
Insert picture description here

Let go of the comment and change it to alimaven. . . . . . Not much to explain

<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>

Insert picture description here

Configure JDK version
Insert picture description here

Just let go of the comment and just replace it

<profile>
  <id>jdk-1.8</id>
  <activation>
    <activeByDefault>true</activeByDefault>
    <jdk>1.8</jdk>
  </activation>
  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
  </properties>
</profile>

Insert picture description here

The configuration in IDEA is as follows, check the Override, select the settings.xml file just configured; generally the local warehouse below will be automatically refreshed, if there is no refresh, you can modify it manually
Insert picture description here

Verification, create a simple Maven project, add a jar package in pom.xml

<dependencies>
	<dependency>
		<groupId>junit</groupId
		<artifactId>junit</artifactId>
		<version>4.9</version>
		<scope>test</scope>
	</dependency>
</dependencies>

Insert picture description here

After refreshing, successfully download the jar to the local warehouse and import it
Insert picture description here

Insert picture description here

Guess you like

Origin blog.csdn.net/jt781861965/article/details/113622435