有小伙伴向我咨询 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. 前端基础之JavaScript(Day53)

    阅读目录 一.JavaScript基础 二.JavaScript对象 三.BOM对象 一.JavaScript基础 http://www.cnblogs.com/yuanchenqi/articles ...

  2. image_Magic

    http://www.charry.org/docs/linux/ImageMagick/ImageMagick.html mogrify -sample 25% *.jpg  批量处理图片 conv ...

  3. IO阻塞模型 非阻塞模型

       IO阻塞模型(blocking IO) 在linux中,默认情况下所有的socket都是blocking,一个典型的读操作流程大概是这样:  所以,blocking IO的特点就是在IO执行的两 ...

  4. 子元素绝对定位absolute后,自动撑开宽度

    position: absolute;   white-space: nowrap;

  5. springmvc ExceptionHandler

    /** * 1. 在 @ExceptionHandler 方法的入参中可以加入 Exception 类型的参数, 该参数即对应发生的异常对象 * 2. @ExceptionHandler 方法的入参中 ...

  6. python之路 线程、进程、协程、队列、python-memcache、python-redis

    一.线程 Threading用于提供线程相关的操作,线程是应用程序中工作的最小单元. #!/usr/bin/env python # -*- coding:utf-8 -*- import threa ...

  7. UVALive 6906 A - Cluster Analysis

    思路:排个序,依次选就好了. #include <bits/stdc++.h> #define PB push_back #define MP make_pair using namesp ...

  8. LVS原理详解以及部署

    linux virtual server简称LVS,Internet的快速增长使多媒体网络服务器面对的访问数量快速增加,服务器需要具备提供大量并发访问服务的能力,因此对于大负载的服务器来讲, CPU. ...

  9. Microservice 概念

    一天我司招财猫姐(HR 大人)问我,你给我解释一下 Microservice 是什么吧.故成此文.一切都是从一个创业公司开始的. 故事 最近的创业潮非常火爆,我禁不住诱惑也掺和了进去,创建了一家公司. ...

  10. LigerUI v1.2.4 LigerGrid 横轴滚动条

    1.设置隐藏列的宽度,不要等于0 2.设置body样式添加overflow: hidden;