zoukankan      html  css  js  c++  java
  • Maven基础-配置远程仓库

    http://sunxboy.iteye.com/blog/970202

      可在pom.xml里面配置远程仓库,我们需要在什么时候配置远程仓库呢?当你连接中央仓库的速度比较慢时,或者你为你的公司搭建了自己的仓库,比如Nexus仓库管理(后面我会介绍),又或者你苏需要的jar存在另外一个公共仓库,比如我们配置一个国内的镜像地址

    <project>

    <repositories>
    <repository>
    <id> maven-net-cn</id>
    <name> Maven China Mirror</name>
    <url> http://maven.net.cn/content/groups/public/</url>
    <releases>
    <enabled> true</enabled>
    </releases>
    <snapshots>
    <enabled> false</enabled>
    </snapshots>
    </repository>
    </repositories>
    <pluginRepositories>
    <pluginRepository>
    <id> maven-net-cn</id>
    <name> Maven China Mirror</name>
    <url> http://maven.net.cn/content/groups/public/</url>
    <releases>
    <enabled> true</enabled>
    </releases>
    <snapshots>
    <enabled> false</enabled>
    </snapshots>
    </pluginRepository>
    </pluginRepositories>

    </project>

     可以看到,允许配置多个repository和 plugin repository,

    <releases>

    <enabled>true</enabled>

    </releases>

    告诉Maven可以从这个仓库下载releases版本的构件,

    <snapshots>

    <enabled>false</enabled>

    </snapshots>

    告诉Maven不要从这个仓库下载snapshot版本的构件,之所以不让你从这个仓库下载snapshot版本,是因为这些版本是不稳定的.

    如果一个公司会有很多的项目,每个项目都这样配置,可以直接配置在setting.xml中

    <settings>

    <profiles>
    <profile>
    <id> myProfiel</id>
    <!—在这里加入<repositories>及<pluginRepositories>–>
    </profile>
    </profiles>
    <activeProfiles>
    <activeProfile> myProfiel </activeProfile>
    </activeProfiles>

    </settings>

     这里通过<activeProfile>元素来激活这个profile,这样我们就可以全局的使用这个配置,不再需要为每个POM做重复的配置了

  • 相关阅读:
    js中Frame框架的属性获取(1)
    c#中文件上传(1)
    表单验证Validform
    Mybatis语法笔记
    js的checkbox
    调用微信Js-SDK支付
    调用微信Js-SDK图片
    java后台上传到linux
    web服务器内层溢出
    SpringMVC
  • 原文地址:https://www.cnblogs.com/xhqgogogo/p/3687646.html
Copyright © 2011-2022 走看看