zoukankan      html  css  js  c++  java
  • maven基础-配置(setting.xml)

    1.启动代理配置

    <proxies>
        <proxy>
          <id>optional</id>
          <active>true</active>
          <protocol>http</protocol>
          <username>proxyuser</</username>
          <password>proxypass</password>
          <host>proxy.host.net</host>
          <port>80</port>
          <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
        </proxy>
    </proxies>
    

    2.设置本地资源仓库

    <localRepository>/Users/apple/software/apache-maven-3.6.2/MavenRepository</localRepository>
    

    3.中央仓库

    是Maven社区提供的仓库,其中包含了大量常用的库

    配置阿里云仓库

    <mirrors>
        <mirror>
          <id>alimaven</id>
          <name>aliyun maven</name>
          <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
          <mirrorOf>central</mirrorOf>        
        </mirror>
    </mirrors>
    
    <repositories>  
            <repository>  
                <id>alimaven</id>  
                <name>aliyun maven</name>  
                <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
                <releases>  
                    <enabled>true</enabled>  
                </releases>  
                <snapshots>  
                    <enabled>false</enabled>  
                </snapshots>  
            </repository>  
    </repositories>

    4.设置远程仓库

    它是开发人员自己定制的仓库,里面存放着所需要的代码库和其他工程需要的jar包

    <repositories>
        <repository>
            <id>xx.xx</id>
            <url>https://xx/content/repositories/public/</url>
        </repository>
    </repositories>

    总结:maven依赖库的查询顺序

    (1)在maven本地资源库搜索

    (2)在中央仓库搜索

    (3)在远程仓库搜索

    5.定制库到本地仓库

    (1)从网上下载jar包到本地

    (2)在控制台

    mvn install:install-file -Dfile=/Users/apple/software/apache-maven-3.6.2/MavenRepository/vip/kk/kk-base-component/1.0-SNAPSHOT/kk-base-component-1.0-SNAPSHOT.jar -DgroupId=vip.kk -DartifactId=kk-base-component -Dversion=1.0-SNAPSHOT -Dpackaging=jar
    

    (3)安装完毕后就可以在pom文件中使用了

    <dependency>
          <groupId>vip.kk</groupId>
          <artifactId>kk-base-component</artifactId>
          <version>1.0-SNAPSHOT</version>
     </dependency>
    

    groupId:项目的包名

    artifactId:模块名

    version:版本

  • 相关阅读:
    简单的几句接口调用,完美完成缩短网站
    nodejs语言实现验证码生成功能
    人工智能:文本相似度分析
    SolrCloud 5.2.1 installation and configuration
    借鉴DP思想: HouseRobberIII
    有意思的数学题:Trapping Rain Water
    API认证方法一览
    FE: Responsive Web Design Overview
    FE: Sass and Bootstrap 3 with Sass
    假期小记:14年寒假二三四事(儿)
  • 原文地址:https://www.cnblogs.com/freeht/p/13072386.html
Copyright © 2011-2022 走看看