有小伙伴向我咨询 play framework 的问题,我就想了解一下 play framework ,按照官方的文档,要使用 SBT 安装,就掉进了 SBT 的坑。

第一坑:国外仓库太慢

安装完成后,执行

$ sbt

命令后,提示:

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384m; support was removed in 8.0
Getting org.scala-sbt sbt 0.13.15  (this may take some time)...
downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.15/jars/sbt.jar ...
	[SUCCESSFUL ] org.scala-sbt#sbt;0.13.15!sbt.jar (22976ms)
downloading https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.6/scala-library-2.10.6.jar ...
	[SUCCESSFUL ] org.scala-lang#scala-library;2.10.6!scala-library.jar (1553281ms)

然后就是漫长的等待!

第二坑:同时只能有一个 sbt 进程操作本地仓库

由于过程太慢,于是就打开新的终端窗口操作,结果不管执行 sbt 相关的什么命令都提示:

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384m; support was removed in 8.0
Waiting for lock on /Users/aven/.sbt/boot/sbt.boot.lock to be available...

原因是有多个sbt终端同时在运行,使得多个进程同时在访问.sbt.ivy.lock。
解决办法是:打开你的资源管理器,将你本机的java进程全部kill掉。

p.p1 {margin: 0.0px 0.0px 2.0px 0.0px; font: 14.0px '.PingFang SC'; color: #454545}
span.s1 {font: 14.0px 'Helvetica Neue'}

第三坑:配置使用国内仓库

既然是构架依赖管理工具,像Maven、yum之类的都可以添加或修改库的位置,于是:

vi ~/.sbt/repositories

添加以下内容:

[repositories]
#local
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](-[classifier]).[ext], bootOnly
ivy-sbt-plugin:http://dl.bintray.com/sbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
sonatype-oss-releases

sonatype-oss-snapshots

第四坑:每次执行 sbt 相关命令都下载依赖包

网上也没见别人遇到这样的问题,我的怎么就这么奇葩呢?

经过很长一段时间的折腾,我日了,原来是上面  repositories 文件内容的原因,看到没:

#local

泥马,local 被注释了,所以每次都使用远程的!

就是由于这个原因,加上下载依赖实现是太慢,所以3天就搞了一个 hello world。

第五坑:依赖真不少

创建一个 hello world 项目,然后就是漫漫的等待。

new sbt/scala-seed.g8
[info] Resolving org.slf4j#slf4j-parent;1.7.20 ...
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/scala-sbt/sbt-giter8-resolver/sbt-giter8-resolver_2.10/0.1.3/sbt-giter8-resolver_2.10-0.1.3.jar ...
[info] 	[SUCCESSFUL ] org.scala-sbt.sbt-giter8-resolver#sbt-giter8-resolver_2.10;0.1.3!sbt-giter8-resolver_2.10.jar (378ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/foundweekends/giter8/giter8_2.10/0.7.2/giter8_2.10-0.7.2.jar ...
[info] 	[SUCCESSFUL ] org.foundweekends.giter8#giter8_2.10;0.7.2!giter8_2.10.jar (449ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/foundweekends/giter8/giter8-lib_2.10/0.7.2/giter8-lib_2.10-0.7.2.jar ...
[info] 	[SUCCESSFUL ] org.foundweekends.giter8#giter8-lib_2.10;0.7.2!giter8-lib_2.10.jar (593ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/com/github/scopt/scopt_2.10/3.5.0/scopt_2.10-3.5.0.jar ...
[info] 	[SUCCESSFUL ] com.github.scopt#scopt_2.10;3.5.0!scopt_2.10.jar (280ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.jar ...
[info] 	[SUCCESSFUL ] ch.qos.logback#logback-classic;1.1.7!logback-classic.jar (575ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/clapper/scalasti_2.10/2.1.2/scalasti_2.10-2.1.2.jar ...
[info] 	[SUCCESSFUL ] org.clapper#scalasti_2.10;2.1.2!scalasti_2.10.jar (251ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/eclipse/jgit/org.eclipse.jgit.pgm/3.7.0.201502260915-r/org.eclipse.jgit.pgm-3.7.0.201502260915-r.jar ...
[info] 	[SUCCESSFUL ] org.eclipse.jgit#org.eclipse.jgit.pgm;3.7.0.201502260915-r!org.eclipse.jgit.pgm.jar (362ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/commons-io/commons-io/2.4/commons-io-2.4.jar ...
[info] 	[SUCCESSFUL ] commons-io#commons-io;2.4!commons-io.jar (371ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-archiver/2.7.1/plexus-archiver-2.7.1.jar ...
[info] 	[SUCCESSFUL ] org.codehaus.plexus#plexus-archiver;2.7.1!plexus-archiver.jar (323ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/clapper/grizzled-scala_2.10/3.1.0/grizzled-scala_2.10-3.1.0.jar ...
[info] 	[SUCCESSFUL ] org.clapper#grizzled-scala_2.10;3.1.0!grizzled-scala_2.10.jar (1142ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/clapper/classutil_2.10/1.1.0/classutil_2.10-1.1.0.jar ...
[info] 	[SUCCESSFUL ] org.clapper#classutil_2.10;1.1.0!classutil_2.10.jar (765ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/antlr/ST4/4.0.8/ST4-4.0.8.jar ...
[info] 	[SUCCESSFUL ] org.antlr#ST4;4.0.8!ST4.jar (959ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm/5.1/asm-5.1.jar ...
[info] 	[SUCCESSFUL ] org.ow2.asm#asm;5.1!asm.jar (505ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-commons/5.1/asm-commons-5.1.jar ...
[info] 	[SUCCESSFUL ] org.ow2.asm#asm-commons;5.1!asm-commons.jar (677ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-util/5.1/asm-util-5.1.jar ...
[info] 	[SUCCESSFUL ] org.ow2.asm#asm-util;5.1!asm-util.jar (809ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/ow2/asm/asm-tree/5.1/asm-tree-5.1.jar ...
[info] 	[SUCCESSFUL ] org.ow2.asm#asm-tree;5.1!asm-tree.jar (1024ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/antlr/antlr-runtime/3.5.2/antlr-runtime-3.5.2.jar ...
[info] 	[SUCCESSFUL ] org.antlr#antlr-runtime;3.5.2!antlr-runtime.jar (1680ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/args4j/args4j/2.0.12/args4j-2.0.12.jar ...
[info] 	[SUCCESSFUL ] args4j#args4j;2.0.12!args4j.jar (798ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/apache/commons/commons-compress/1.6/commons-compress-1.6.jar ...
[info] 	[SUCCESSFUL ] org.apache.commons#commons-compress;1.6!commons-compress.jar (1251ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/eclipse/jgit/org.eclipse.jgit.archive/3.7.0.201502260915-r/org.eclipse.jgit.archive-3.7.0.201502260915-r.jar ...
[info] 	[SUCCESSFUL ] org.eclipse.jgit#org.eclipse.jgit.archive;3.7.0.201502260915-r!org.eclipse.jgit.archive.jar (660ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/eclipse/jgit/org.eclipse.jgit/3.7.0.201502260915-r/org.eclipse.jgit-3.7.0.201502260915-r.jar ...
[info] 	[SUCCESSFUL ] org.eclipse.jgit#org.eclipse.jgit;3.7.0.201502260915-r!org.eclipse.jgit.jar (11511ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/eclipse/jgit/org.eclipse.jgit.ui/3.7.0.201502260915-r/org.eclipse.jgit.ui-3.7.0.201502260915-r.jar ...
[info] 	[SUCCESSFUL ] org.eclipse.jgit#org.eclipse.jgit.ui;3.7.0.201502260915-r!org.eclipse.jgit.ui.jar (647ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/tukaani/xz/1.4/xz-1.4.jar ...
[info] 	[SUCCESSFUL ] org.tukaani#xz;1.4!xz.jar (1077ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/osgi/org.osgi.core/4.3.1/org.osgi.core-4.3.1.jar ...
[info] 	[SUCCESSFUL ] org.osgi#org.osgi.core;4.3.1!org.osgi.core.jar (1438ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/com/googlecode/javaewah/JavaEWAH/0.7.9/JavaEWAH-0.7.9.jar ...
[info] 	[SUCCESSFUL ] com.googlecode.javaewah#JavaEWAH;0.7.9!JavaEWAH.jar(bundle) (933ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/apache/httpcomponents/httpclient/4.1.3/httpclient-4.1.3.jar ...
[info] 	[SUCCESSFUL ] org.apache.httpcomponents#httpclient;4.1.3!httpclient.jar (1858ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/apache/httpcomponents/httpcore/4.1.4/httpcore-4.1.4.jar ...
[info] 	[SUCCESSFUL ] org.apache.httpcomponents#httpcore;4.1.4!httpcore.jar (1661ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar ...
[info] 	[SUCCESSFUL ] commons-logging#commons-logging;1.1.1!commons-logging.jar (956ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/commons-codec/commons-codec/1.4/commons-codec-1.4.jar ...
[info] 	[SUCCESSFUL ] commons-codec#commons-codec;1.4!commons-codec.jar (769ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.jar ...
[info] 	[SUCCESSFUL ] org.codehaus.plexus#plexus-container-default;1.0-alpha-9-stable-1!plexus-container-default.jar (2315ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.18/plexus-utils-3.0.18.jar ...
[info] 	[SUCCESSFUL ] org.codehaus.plexus#plexus-utils;3.0.18!plexus-utils.jar (2259ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-io/2.2/plexus-io-2.2.jar ...
[info] 	[SUCCESSFUL ] org.codehaus.plexus#plexus-io;2.2!plexus-io.jar (1426ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7.jar ...
[info] 	[SUCCESSFUL ] ch.qos.logback#logback-core;1.1.7!logback-core.jar (3638ms)
[info] downloading http://maven.aliyun.com/nexus/content/groups/public/org/slf4j/slf4j-api/1.7.20/slf4j-api-1.7.20.jar ...
[info] 	[SUCCESSFUL ] org.slf4j#slf4j-api;1.7.20!slf4j-api.jar (1770ms)

Minimum Scala build. 

name [My Something Project]: hello

Template applied in ./hello

第六坑:国内仓库包不全

虽然把仓库配置改为了使用国内的,但是有很多包还是会去 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}
span.s1 {font-variant-ligatures: no-common-ligatures}

https://repo1.maven.org/

下载。

第七坑:遇到再来更

《Scala入坑笔记》缘起 3天就搞了一个 hello world的更多相关文章

  1. react 入坑笔记(四) - React 事件绑定和传参

    React 事件处理 建议:在了解 js 的 this 取值后食用更佳. 一.react 与 Html 中用法的异同和注意点 html 中的绑定事件的写法: <button onclick=&q ...

  2. Linux探索之路1---CentOS入坑笔记整理

    前言 上次跟运维去行方安装行内环境,发现linux命令还是不是很熟练.特别是用户权限分配以及vi下的快捷操作.于是决定在本地安装一个CentOS虚拟机,后面有时间就每天学习一点Linux常用命令. 作 ...

  3. react 入坑笔记(三) - Props

    React Props props - 参数. 组件类 React.Component 有个 defaultProps 属性,以 class xxx extend React.Component 形式 ...

  4. es6 入坑笔记(三)---数组,对象扩展

    数组扩展 循环 arr.foreach(){ //回调函数 function(val,index,arr){ //val:当前读取到的数组的值,index:当前读取道德数组的索引,arr:当前的数组名 ...

  5. es6 入坑笔记(二)---函数扩展,箭头函数,扩展运算符...

    函数扩展 1.函数可以有默认值 function demo( a = 10,b ){} 2.函数可以使用解构 function demo( { a = 0,b = 0 } = {} ){ } 3.函数 ...

  6. es6 入坑笔记(一)---let,const,解构,字符串模板

    let  全面取代var 大概相似于C++的定义,一个变量必须得先定义后使用,没有预编译 注意let的作用域,一个{}就是一个作用域,上述规则须在一个作用于内 坑:for(let i =0;i < ...

  7. react 入坑笔记(六) - 组件的生命周期

    React 组件生命周期 详细参考: react 组件生命周期 组件的生命周期可分为三个状态: 1.Mounting:已经挂载/插入到真实 DOM 树上: 2.Updating:正在被重新渲染: 3. ...

  8. react 入坑笔记(五) - 条件渲染和列表渲染

    条件渲染和列表渲染 一.条件渲染 条件渲染较简单,使用 JavaScript 操作符 if 或条件运算符来创建表示当前状态的元素,然后让 React 根据它们来更新 UI. 贴一个小栗子: funct ...

  9. react 入坑笔记(二) - State

    React State 一. state 大致思想:在 react 中,每个组件都是一个状态机,通过与用户的交互,实现不同状态,然后渲染 UI,让用户界面和数据保持一致.React 里,只需更新组件的 ...

随机推荐

  1. MySQL 单表查询(Day42)

    阅读目录 一,查询语法 二,简单查询 三,where约束 四,having过滤 五,分组查询 group by 六,关键字的执行优先级 七,查询排列 order by 八,使用聚合函数查询 九,whe ...

  2. day2 笔记

    while 条件:           # 循环体       # 如果条件为真,那么循环体则执行     # 如果条件为假,那么循环体不执行         循环中止语句 如果在循环的过程中,因为某 ...

  3. cache工作原理

    转:http://www.360doc.com/content/11/0307/21/3791508_99049437.shtml

  4. CSS 初级攻略

    内容来自html dog. css的格式为 ‘property: value’ 给html插入css样式的方式有三种:内联.内部css.外部css文件,如下所示: <p style=" ...

  5. MySQL-5.7 创建及查看触发器

    触发器的作用是当表上有对应SQL语句发生时,则触发执行. 1.语法 CREATE [DEFINER = { user | CURRENT_USER }] TRIGGER trigger_name tr ...

  6. 20162326 《Java程序设计》第3周学习总结

    20162326 <Java程序设计>第3周学习总结 教材学习内容总结 这周我通过课堂学习了VIM的列编辑crtl+v,shift+i shift+a·分别是左侧插入和右侧插入.还学习了使 ...

  7. React生命周期及事件详解

    引用原文:http://blog.csdn.net/limm33/article/details/50942808 一.组件的详细说明和生命周期ComponentSpecs and Lifecycle ...

  8. Kali Linux学习笔记

    1. 重装grub 重装windows后MBR被覆盖导致linux无法启动,通过U盘进入live后执行以下命令: mount /dev/sda5 /mnt //此处是将linux系统根目录挂载到mnt ...

  9. Aggregate Services

    https://stackoverflow.com/questions/7199097/constructor-injection-into-a-base-class-using-autofac Ca ...

  10. C#470多例winform 界面特效的源码

    一共470多例winform 界面特效的源码. 窗体与界面设计... 9 实例001  带历史信息的菜单    10 实例002  菜单动态合并    12 实例003  像开始菜单一样漂亮的菜单.. ...