zoukankan      html  css  js  c++  java
  • Java-Maven(八):IDEA使用本地maven,并配置远程中央仓库

    1)maven安装

    一般我们从github、码云(https://gitee.com)上获取代码后,实际上我们并没有一个版本管理工具来用来获取(get)、提交(commit and push)代码的工具,因此需要使用一个代码提交管理工具,maven是这类工具中比较好的工具。

    声明:maven安装请参考:《Java-Maven(一):Maven的简介与安装


    备注:本地已经安装好了maven,安装目录为:D:WorkJavaapache-maven-3.5.0-binapache-maven-3.5.0

    2)给idea从github、码云等获取到的项目绑定 maven:

    3)修改pom.xml,添加资源库管理插件配置(可忽略):

    1   <pluginRepositories>
    2     <pluginRepository>
    3       <id>scala-tools.org</id>
    4       <name>Scala-Tools Maven2 Repository</name>
    5       <url>http://scala-tools.org/repo-releases</url>
    6     </pluginRepository>
    7   </pluginRepositories>

    4)配置远程中央仓库:

    一般情况下可以配置为国外的远程中央仓库,但是在国内从国外远程中央仓库下载jar包的速度比较差。如果国内的话,建议使用阿里的远程中央仓库(下载速度快)。配置阿里的远程中央仓库有两种方案:
    配置方式一:
    confsetting.xml

    1   <mirrors>
    2     <mirror>
    3       <id>alimaven</id>
    4       <name>aliyun maven</name>
    5       <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    6       <mirrorOf>central</mirrorOf>        
    7     </mirror>     
    8   </mirrors>

    配置方式二:

    在项目的pom.xml中配置:

     1     <repositories>
     2         <repository>
     3             <id>sonatype-nexus-snapshots</id>
     4             <name>Sonatype Nexus Snapshots</name>
     5             <url>http://maven.aliyun.com/nexus/content/groups/public</url>
     6             <releases>
     7                 <enabled>false</enabled>
     8             </releases>
     9             <snapshots>
    10                 <enabled>true</enabled>
    11             </snapshots>
    12         </repository>
    13     </repositories>
  • 相关阅读:
    反射
    IO流
    集合(下)
    集合(上)
    泛型
    异常
    常用类
    内部类
    将博客搬至CSDN
    DBMS_ERRLOG记录DML错误日志(二)
  • 原文地址:https://www.cnblogs.com/yy3b2007com/p/8024109.html
Copyright © 2011-2022 走看看