Install maven 2023 in Linux environment

1. Create folder
mkdir /home/work/software/maven

2. Download the maven installation package

wget https://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz

3. Unzip the downloaded compressed package
tar -zxvf apache-maven-3.3.9-bin.tar.gz

4. Configure environment variables

vim /etc/profile
export MAVEN_HOME=/home/work/software/maven/apache-maven-3.3.9
export PATH=${
    
    PATH}:${
    
    MAVEN_HOME}/bin

After editing, remember to use the source /etc/profile command to make the changes take effect.
After configuration, you can use the mvn -v command to confirm whether it is successful
insert image description here
5. Configure the maven local warehouse
mkdir mavenRepository

vim /home/work/software/maven/apache-maven-3.3.9/conf/settings.xml
// 添加如下配置,配置本地仓库
<localRepository>/home/work/software/maven/mavenRepository</localRepository>
// 在<mirrors></mirrors>标签中添加国内镜像源
	<mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf> 
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </mirror>
    <mirror>
      <!--This is used to direct the public snapshots repo in the 
          profile below over to a different nexus group -->
      <id>nexus-public-snapshots</id>
      <mirrorOf>public-snapshots</mirrorOf> 
      <url>http://maven.aliyun.com/nexus/content/repositories/snapshots/</url>
    </mirror>

Supongo que te gusta

Origin blog.csdn.net/lzq2357639195/article/details/130044739
Recomendado
Clasificación