maven和sbt构建项目及相关国内源repositorie配置和不支持cdh包解决方案

1 篇文章 0 订阅

开发过程中经常出现要下载jar包的情况下
1通过maven
修改 maven 软件下的settings.xml文件下修改



alimaven
central
aliyun maven
http://maven.aliyun.com/nexus/content/repositories/central/

    <!-- 中央仓库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> 

或者 在 maven 的pom 文件中 增加 国内源的配置

2、也可以通过 国内的源的路径去下载 开发中 其他地方用的的 包

在浏览器中 输入 源的地址 -》 根据maven 配置的依赖(或其jar默认路径)-》 通过相应路径找到 jar 包

3 。sbt 源配置方式为在所安装的sbt下
在这里插入图片描述

增加repositories 文件 并修改呢文件内的配置为(本人配置阿里源)

[repositories]
#local
#local
#maven-local: file:D:/maven/Hrepository/maven
public: http://maven.aliyun.com/nexus/content/groups/public/
typesafe:http://dl.bintray.com/typesafe/ivy-releases/ , [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/artifact.[ext], bootOnly
ivy-sbt-plugin:http://dl.bintray.com/sbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/artifact.[ext]
sonatype-oss-releases

sonatype-oss-snapshots

sbt 项目引进本地 maven 依赖方式
在这里插入图片描述

国内源常见
阿里云仓库 --> 国内比较火 比价快
http://maven.aliyun.com/nexus/content/repositories/central/
中央仓库1
http://repo1.maven.org/maven2/
中央仓库1
http://repo2.maven.org/maven2/
cloudera 相关包的仓库
https://repository.cloudera.com/artifactory/cloudera-repos/

atlassian http://maven.atlassian.com/repository/public true false
    <repository>
        <id>maven.org.repo2</id>
        <name>Repository of <span class="wp_keywordlink_affiliate"><a href="http://www.iteblog.com/archives/tag/maven" title="" target="_blank" data-original-title="View all posts in Maven">Maven</a></span>.org</name>
        <url>http://search.maven.org/#search</url>
    </repository>

    <repository>
        <id>search.maven.org</id>
        <name>Repository of Maven.org</name>
        <url>http://search.maven.org</url>
    </repository>

    <repository>
        <id>itextpdf.com</id>
        <name>Maven Repository for iText</name>
        <url>http://maven.itextpdf.com</url>
    </repository>

    <repository>
        <id>repository.jboss.com</id>
        <name>Jboss Repository for Maven</name>
        <url>http://repository.jboss.com</url>
    </repository>

    <repository>
        <id>snapshots.jboss.org</id>
        <name>Jboss Snapshot Repository for Maven</name>
        <url>http://snapshots.jboss.org/maven2</url>
    </repository>

    <repository>
        <id>java.net</id>
        <name>Repository of <span class="wp_keywordlink_affiliate"><a href="http://www.iteblog.com/archives/tag/java" title="" target="_blank" data-original-title="View all posts in Java">Java</a></span>.net</name>
        <url>http://download.java.net/maven/1</url>
    </repository>

    <repository>
        <id>deltaset.org</id>
        <name>Repository of Deltaset</name>
        <url>http://deltaset.googlecode.com/svn/maven2</url>
    </repository>

    <repository>
        <id>prime.com</id>
        <name>Repository of PrimeFaces</name>
        <url>http://repository.prime.com.tr/org</url>
    </repository>

    <repository>
        <id>com.springsource.repository.maven.milestone</id>
        <name>Spring Framework Maven Milestone Releases (Maven Central Format)</name>
        <url>http://maven.springframework.org/milestone</url>
    </repository>

    <repository>
        <id>maven-repository2.dev.java.net</id>
        <name><span class="wp_keywordlink_affiliate"><a href="http://www.iteblog.com/archives/tag/java" title="" target="_blank" data-original-title="View all posts in Java">Java</a></span>.net Repository for Maven 2</name>
        <url>http://download.java.net/maven/2</url>
    </repository>

    <repository>
        <id>mvnrepository.com</id>
        <name>mvnrepository.com</name>
        <url>http://mvnrepository.com</url>
    </repository>

    <repository>
        <id>www.mvnbrowser.com</id>
        <name>www.mvnbrowser.com</name>
        <url>http://www.mvnbrowser.com</url>
    </repository>

    <repository>
        <id>objectweb</id>
        <name>Objectweb repository</name>
        <url>http://maven.objectweb.org/maven2</url>
    </repository>

    <repository>
        <id>ops4j.repository</id>
        <name>OPS4J Repository</name>
        <url>http://repository.ops4j.org/maven2</url>
    </repository>

    <repository>
        <id>Codehaus Snapshots</id>
        <url>http://snapshots.repository.codehaus.org/</url>
    </repository>

本文链接地址: 《Maven/SBT常用的repositorie一览表》(http://www.iteblog.com/archives/1082)

maven仓库不支持cdh解决方案

目前maven仓库中没有支持cdh的相关依赖。cloudera自己建立了一个相关的仓库。要想利用maven添加相关依赖,则必须单独添加cloudera仓库。


1
一、项目pom.xml, 添加仓库配置 cloudera https://repository.cloudera.com/artifactory/cloudera-repos/ true true

二、 添加cdh依赖,如hbase-client:

org.apache.hbase hbase-client 1.2.0-cdh5.12.1

三、在国内使用maven中央仓库一般会有网络问题,所以大部分人会使用aliyun仓库或者其他开源的仓库。所以需要修改setting.xml (以下配置中 *,!cloudera 表示除了aliyun仓库还使用cloudera仓库)

nexus-aliyun *,!cloudera Nexus aliyun http://maven.aliyun.com/nexus/content/groups/public

四、若未设置自动更新maven项目,则需更新maven项目,然后等待下载相关依赖。完成之后便可以使用cdh进行开发啦 _

附上官网相关说明地址:

https://www.cloudera.com/documentation/enterprise/release-notes/topics/cdh_vd_cdh5_maven_repo.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值