安装java,Maven

java下载
Maven下载
jdk8 Maven3.9.6

上传

tar -zxvf jdk-8u391-linux-x64.tar.gz -C /usr/local
tar -zxvf apache-maven-3.9.6-bin.tar.gz  -C /usr/local
cd /usr/local/
mv jdk1.8.0_391/ jdk
mv apache-maven-3.9.6/ maven

后续操作

仓库更新

 <mirror>
    <id>huaweicloud</id>
    <url>https://repo.huaweicloud.com/repository/maven/</url>
    <mirrorOf>central</mirrorOf>
  </mirror>
  <mirror>
    <id>tencent</id>
    <url>https://mirrors.cloud.tencent.com/repository/maven/</url>
    <mirrorOf>central</mirrorOf>
  </mirror>

编译插件

<profile>
    <id>jdk18</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>

<activeProfiles>
  <activeProfile>jdk18</activeProfile>
</activeProfiles>

编辑变量

vi /etc/profile
export MAVEN_HOME=/usr/local/maven PATH=$PATH:$MAVEN_HOME/bin

刷新查看结果

source /etc/profile

mvn -version

最后修改:2024 年 10 月 21 日
如果觉得我的文章对你有用,请随意赞赏