linux下scala常用项目管理工具sbt的安装配置;下载到中途出现error:ClassNotFound的原因和解决办法

17 篇文章 1 订阅

sbt的实质是从网上下载项目需要的jar包,所以在配置和使用时必须保证能ping域名,除非再次打包时example.sbt中没有添加新的ar包。

1、sbt解压到指定路径,配置环境变量,source

2、执行sbt package或sbt version,执行后会一直get  ***,并在~目录下产生.sbt目录

3、Ctrl+C退出geting

4、cd ~

5、cd .sbt

6、将sbt默认的国外mvn源换为国内的阿里源和gtan源以及各种其他源?,这样下载速度会比较快

vim repositories

在此new file中添加如下内容:

[repositories]
local
aliyun: http://maven.aliyun.com/nexus/content/groups/public/
repox-maven: http://repox.gtan.com:8078/
repox-ivy: http://repox.gtan.com:8078/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
Nexus osc : https://code.lds.org/nexus/content/groups/main-repo
  Nexus osc thirdparty : https://code.lds.org/nexus/content/groups/plugin-repo/
  typesafe: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly  
  typesafe2: http://repo.typesafe.com/typesafe/releases/
  sbt-plugin: http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/
  sonatype: http://oss.sonatype.org/content/repositories/snapshots  
  uk_maven: http://uk.maven.org/maven2/  
  ibibli: http://mirrors.ibiblio.org/maven2/  
  repo2: http://repo2.maven.org/maven2/

  comp-maven:http://mvnrepository.com/artifact/
  store_cn:http://maven.oschina.net/content/groups/public/
  store_mir:http://mirrors.ibiblio.org/maven2/
  store_0:http://maven.net.cn/content/groups/public/
  store_1:http://repo.typesafe.com/typesafe/ivy-releases/
  store_2:http://repo2.maven.org/maven2/

  sbt-releases-repo: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
  sbt-plugins-repo: http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
  maven-central: http://repo1.maven.org/maven2/

central: http://repo1.maven.org/maven2/

注意:在下一步的sbt package时如果网络不好,会导致重复下载jar包或丢失jar包,很容易产生ClassNotFound的error,或者只删除.ivy2目录也会产生error:ClassNotFound。这时通常把.sbt与.ivy2两个目录(注意两个目录都在~目录下,且目录以“.”开头)删除,因为通过网络下载的jar包通常缓存在这两个目录下。再从第2步重新开始。

7、sbt package,最后成功会出现下图。

参考这里

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值