Spark学习随笔(一)sbt安装-源的配置

安装Scala后,因为笔者使用idea进行编译,所以大概是需要新建项目才能新建类,所以打算安装sbt为后期项目管理做准备。但是下载依赖时出现了错误,在查询的时候发现网络上没有很好的解决问题的方法以及对相关组件的解释,现将安装过程和需要配置的各部分进行适当说明,以供参考。

Scala和sbt下载不再赘述,主要说一下sbt的配置。

笔者安装位置:D:\scala\sbt

安装完成后,打开安装目录下的conf文件夹(笔者路径为D:\scala\sbt\conf)的sbtconfig.txt

# sbt configuration file for Windows
 
# Set the java args
 
#-mem 1024 was added in sbt.bat as default
 
-Xms1024m
-Xmx1024m
-Xss4M
-XX:ReservedCodeCacheSize=128m
 
# Set the extra sbt options
 
-Dsbt.log.format=true
-Dsbt.boot.directory=D:/scala/sbt/boot/
-Dsbt.global.base=D:/scala/sbt/.sbt
-Dsbt.ivy.home=D:/scala/sbt/.ivy2
-Dsbt.repository.config=D:/scala/sbt/conf/repo.properties
-Dsbt.override.build.repos=true

如图,关键点在最下六行,配置日志文件、依赖包、资源地址等的存储位置

配置完成后,新建上图中的资源文件repo其实还不存在,我们在当前目录下新建一个,可以使用idea等编辑器进行编辑,内容是依赖包等的下载地址资源,这里我们选用国内的相关地址为好,如阿里。其他博主给出了丰富的选择,不再赘述。下面放上笔者所选用的:

[repositories]
    local
    aliyun-central: https://maven.aliyun.com/repository/central
    aliyun-public: https://maven.aliyun.com/repository/public
    jcenter: https://jcenter.bintray.com/
    repo1: https://repo1.maven.org/maven2/
    store_2: https://repo2.maven.org/maven2/
    aliyun-releases: https://maven.aliyun.com/repository/releases
    aliyun-apache-snapshots: https://maven.aliyun.com/repository/apache-snapshots
    aliyun-google: https://maven.aliyun.com/repository/google
    aliyun-jcenter: https://maven.aliyun.com/repository/jcenter
    aliyun-spring: https://maven.aliyun.com/repository/spring
    aliyun-spring-plugin: https://maven.aliyun.com/repository/spring-plugin
    sbt-plugin: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/
    sonatype: https://oss.sonatype.org/content/repositories/snapshots  
    typesafe: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
    typesafe2: https://repo.typesafe.com/typesafe/releases/
    atlassian: https://packages.atlassian.com/content/repositories/atlassian-public/
    spring-plugin: https://repo.spring.io/plugins-release/
    hortonworks: https://repo.hortonworks.com/content/repositories/releases/

注意:sbt应该是进行了更新,新的协议不支持http,需要使用https,记得更改,否则会出现如[error] insecure HTTP request is unsupported 'http://repo1.m……这般的错误。

完成后打开cmd,输入sbt,可能会有一段下载依赖包的过程,成功后会进入命令行,即sbt安装成功。

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值