This article is an original article from joshua317. Please indicate the reprint: Reprinted fromjoshua317 blog https:///article/41
maven installation and configuration
make sureJAVA_HOME
Environment variables are set and pointed to JDK installation
Install it below
1.1 Download maven, which can be downloaded on the official apache website.
Download address: /
1.2 Unzip the file and set the local repository path
1.2.1 My decompression position is set according to my own situation
C:\MyProgram\apache-maven-3.8.1
1.2.2 Define the local repository path
Default path: ${}/.m2/repository, such as:C:\Users\Administrator\.m2\repository
Custom path: C:\MyProgram\maven\repository
1.2.3 Setting the local warehouse path and adding domestic mirrors
Modify C:\MyProgram\apache-maven-3.8.1\conf\
Set the local repository path:
<localRepository>C://MyProgram//maven//repository</localRepository>
YAML
Copy
Set up Alibaba’s central warehouse:
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>/nexus/content/groups/public</url>
<blocked>true</blocked>
</mirror>
</mirrors>
1.3 Set system environment variables
New environment variable name: MAVEN_HOME, variable value: C:\MyProgram\apache-maven-3.8.1
Edit the environment variable Path, add %MAVEN_HOME%\bin
At this point, maven has been installed
1.4 Verification
Use win key + R to open the command line prompt window, enter mvn --version If the following situation occurs, it means that the configuration is successful
Install it below
2.1 Download maven
cd /usr/local && wget /apache/maven/maven-3/3.8.1/binaries/apache-maven-3.8.
2.2 Decompression
tar xzvf apache-maven-3.8.
2.3 Add environment variables
export PATH=/usr/local/apache-maven-3.8.1/bin/mvn/bin:$PATH
2.4 Verification
If the jdk environment is not installed, it will prompt:
[root@service-01 local]# mvn -version
which: no java in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
If the installation is successful, it is as follows:
[root@service-01 local]# mvn -version
Apache Maven 3.0.5 (Red Hat 3.0.5-17)
Maven home: /usr/share/maven
Java version: 1.8.0_282, vendor: Red Hat, Inc.
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-693.2.2.el7.x86_64", arch: "amd64", family: "unix"
2.5 Setting the local repository path
Modify the /usr/local/apache-maven-3.8.1/conf/ file. Please refer to the above for modifying the content.
3 IntelliJ IDEA configuration
Open the software and click File-->Settings-->Build,Execution,Deployment-->Maven
Modify the Maven home, User Settings File and Local Repository on the right
Click OK, and the IntelliJ IDEA configuration Maven is completed.
This article is an original article from joshua317. Please indicate the reprint: Reprinted fromjoshua317 blog https:///article/41