• maven的安装和配置


    maven安装

    前提:安装了jdk(本环境已经安装了jdk)

    下载地址:https://maven.apache.org/download.cgi

    wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
    

    解压&软连接

    tar -zxvf apache-maven-3.8.6-bin.tar.gz -C /opt
    ln -s apache-maven-3.8.6 mvn
    

    配置环境变量

    #vim /etc/profile
    #maven
    export MVN_HOME=/opt/mvn
    export PATH=$MVN_HOME/bin:$PATH
    
    #source /etc/profile
    

    验证安装情况

    [root@data3 ~]# mvn -v
    Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
    Maven home: /opt/mvn
    Java version: 1.8.0_241, vendor: Oracle Corporation, runtime: /usr/local/jdk1.8.0_241/jre
    Default locale: en_US, platform encoding: UTF-8
    OS name: "linux", version: "3.10.0-957.el7.x86_64", arch: "amd64", family: "unix"
    

    maven配置

    第一种方式(settings.xml文件)

    在mirrors节点下加入一个新的mirror节点,配置阿里镜像地址,完整配置如下:

    <mirrors>
         <!-- 阿里云仓库 -->
            <mirror>
                <id>alimaven</id>
                <mirrorOf>central</mirrorOf>
                <name>aliyun maven</name>
                <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
            </mirror>
        
            <!-- 中央仓库1 -->
            <mirror>
                <id>repo1</id>
                <mirrorOf>central</mirrorOf>
                <name>Human Readable Name for this Mirror.</name>
                <url>http://repo1.maven.org/maven2/</url>
            </mirror>
        
            <!-- 中央仓库2 -->
            <mirror>
                <id>repo2</id>
                <mirrorOf>central</mirrorOf>
                <name>Human Readable Name for this Mirror.</name>
                <url>http://repo2.maven.org/maven2/</url>
            </mirror>    
    </mirrors>
    

    第二种方式(pom.xml方式)

    修改项目pom.xml,在repositories节点下加入repository节点,配置阿里镜像地址,完整配置如下:

    此配置参考renren-genertor项目的pom.xml配置,项目网址:https://gitee.com/renrenio/renren-generator

    <repositories>
    		<repository>
    			<id>public</id>
    			<name>aliyun nexus</name>
    			<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    			<releases>
    				<enabled>true</enabled>
    			</releases>
    		</repository>
    </repositories>
    	<pluginRepositories>
    		<pluginRepository>
    			<id>public</id>
    			<name>aliyun nexus</name>
    			<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    			<releases>
    				<enabled>true</enabled>
    			</releases>
    			<snapshots>
    				<enabled>false</enabled>
    			</snapshots>
    		</pluginRepository>
    	</pluginRepositories>
    
    

    参考:http://t.zoukankan.com/hxun-p-11274196.html
    https://blog.csdn.net/shaoming314/article/details/120357151

  • 相关阅读:
    【leetcode】Search a 2D Matrix
    【leetcode】Minimum Path Sum
    LCD1602和LCD12864
    Keil建立第一个ARM工程的步骤
    Keil建立第一个C51工程的步骤
    STM32 GPIO寄存器 IDR ODR BSRR BRR
    STM32F10x_StdPeriph_Driver_3.5.0(中文版).chm的使用
    如何查看stm32固件库版本及MDK和keil uvision的关系
    stm32时钟系统
    stm32f103和s3c2440配置
  • 原文地址:https://www.cnblogs.com/zsql/p/16436824.html
Copyright © 2020-2023  润新知