• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

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

武飞扬头像
AlexNightC
帮助1

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

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

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

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

  1.  
    # sbt configuration file for Windows
  2.  
     
  3.  
    # Set the java args
  4.  
     
  5.  
    #-mem 1024 was added in sbt.bat as default
  6.  
     
  7.  
    -Xms1024m
  8.  
    -Xmx1024m
  9.  
    -Xss4M
  10.  
    -XX:ReservedCodeCacheSize=128m
  11.  
     
  12.  
    # Set the extra sbt options
  13.  
     
  14.  
    -Dsbt.log.format=true
  15.  
    -Dsbt.boot.directory=D:/scala/sbt/boot/
  16.  
    -Dsbt.global.base=D:/scala/sbt/.sbt
  17.  
    -Dsbt.ivy.home=D:/scala/sbt/.ivy2
  18.  
    -Dsbt.repository.config=D:/scala/sbt/conf/repo.properties
  19.  
    -Dsbt.override.build.repos=true
学新通

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

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

  1.  
    [repositories]
  2.  
    local
  3.  
    aliyun-central: https://maven.aliyun.com/repository/central
  4.  
    aliyun-public: https://maven.aliyun.com/repository/public
  5.  
    jcenter: https://jcenter.bintray.com/
  6.  
    repo1: https://repo1.maven.org/maven2/
  7.  
    store_2: https://repo2.maven.org/maven2/
  8.  
    aliyun-releases: https://maven.aliyun.com/repository/releases
  9.  
    aliyun-apache-snapshots: https://maven.aliyun.com/repository/apache-snapshots
  10.  
    aliyun-谷歌: https://maven.aliyun.com/repository/谷歌
  11.  
    aliyun-jcenter: https://maven.aliyun.com/repository/jcenter
  12.  
    aliyun-spring: https://maven.aliyun.com/repository/spring
  13.  
    aliyun-spring-plugin: https://maven.aliyun.com/repository/spring-plugin
  14.  
    sbt-plugin: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/
  15.  
    sonatype: https://oss.sonatype.org/content/repositories/snapshots
  16.  
    typesafe: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
  17.  
    typesafe2: https://repo.typesafe.com/typesafe/releases/
  18.  
    atlassian: https://packages.atlassian.com/content/repositories/atlassian-public/
  19.  
    spring-plugin: https://repo.spring.io/plugins-release/
  20.  
    hortonworks: https://repo.hortonworks.com/content/repositories/releases/
学新通

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

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

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgabecf
系列文章
更多 icon
同类精品
更多 icon
继续加载