m_shige1979のささやかな抵抗と欲望の日々

プログラムの勉強をしながら学習したことや経験したことをぼそぼそと書いていきます

なんとなく作ったサイト

http://www.it-check-matome.info/


Github(注意すること)

https://github.com/mshige1979

scalaのsbtをインストール

sbtってなに?

scalaのビルドツールらしい
詳しくは今後調べていく

インストール環境

vangrantのCentOS7.x
※共通のパスではなくユーザー固有の場所にインストールする

今回インストールするバージョン

0.13.5
※最新の1つ前のバージョンにします。最新はなんか不安なので

インストール手順

ダウンロード
wget http://dl.bintray.com/sbt/native-packages/sbt/0.13.5/sbt-0.13.5.tgz

※プロキシを指定している場合は失敗するかも…

解凍
$ tar zxf sbt-0.13.5.tgz
環境変数に追加
$ echo 'export PATH=$PATH:~/sbt/bin' >> ~/.bash_profile
$ source ~/.bash_profile
バージョンを確認する
$ sbt -v
[process_args] java_version = '1.8.0_25'
# Executing command line:
java
-Xms1024m
-Xmx1024m
-XX:ReservedCodeCacheSize=128m
-jar
/home/vagrant/sbt/bin/sbt-launch.jar

Getting org.scala-sbt sbt 0.13.5 ...
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.5/jars/sbt.jar ...
	[SUCCESSFUL ] org.scala-sbt#sbt;0.13.5!sbt.jar (3648ms)
downloading http://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.4/scala-library-2.10.4.jar ...
	[SUCCESSFUL ] org.scala-lang#scala-library;2.10.4!scala-library.jar (16724ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/main/0.13.5/jars/main.jar ...
	[SUCCESSFUL ] org.scala-sbt#main;0.13.5!main.jar (7999ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/0.13.5/jars/compiler-interface-src.jar ...
	[SUCCESSFUL ] org.scala-sbt#compiler-interface;0.13.5!compiler-interface-src.jar (3044ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/0.13.5/jars/compiler-interface-bin.jar ...
	[SUCCESSFUL ] org.scala-sbt#compiler-interface;0.13.5!compiler-interface-bin.jar (3674ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/precompiled-2_8_2/0.13.5/jars/compiler-interface-bin.jar ...
	[SUCCESSFUL ] org.scala-sbt#precompiled-2_8_2;0.13.5!compiler-interface-bin.jar (3440ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/precompiled-2_9_2/0.13.5/jars/compiler-interface-bin.jar ...
	[SUCCESSFUL ] org.scala-sbt#precompiled-2_9_2;0.13.5!compiler-interface-bin.jar (4763ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/precompiled-2_9_3/0.13.5/jars/compiler-interface-bin.jar ...
	[SUCCESSFUL ] org.scala-sbt#precompiled-2_9_3;0.13.5!compiler-interface-bin.jar (3725ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/actions/0.13.5/jars/actions.jar ...
	[SUCCESSFUL ] org.scala-sbt#actions;0.13.5!actions.jar (3596ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/main-settings/0.13.5/jars/main-settings.jar ...
	[SUCCESSFUL ] org.scala-sbt#main-settings;0.13.5!main-settings.jar (5531ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/interface/0.13.5/jars/interface.jar ...
	[SUCCESSFUL ] org.scala-sbt#interface;0.13.5!interface.jar (3252ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/io/0.13.5/jars/io.jar ...
	[SUCCESSFUL ] org.scala-sbt#io;0.13.5!io.jar (4012ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/ivy/0.13.5/jars/ivy.jar ...
	[SUCCESSFUL ] org.scala-sbt#ivy;0.13.5!ivy.jar (4103ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/launcher-interface/0.13.5/jars/launcher-interface.jar ...
	[SUCCESSFUL ] org.scala-sbt#launcher-interface;0.13.5!launcher-interface.jar (2828ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/logging/0.13.5/jars/logging.jar ...
	[SUCCESSFUL ] org.scala-sbt#logging;0.13.5!logging.jar (4270ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/logic/0.13.5/jars/logic.jar ...
	[SUCCESSFUL ] org.scala-sbt#logic;0.13.5!logic.jar (4161ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/process/0.13.5/jars/process.jar ...
	[SUCCESSFUL ] org.scala-sbt#process;0.13.5!process.jar (69840ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/run/0.13.5/jars/run.jar ...
	[SUCCESSFUL ] org.scala-sbt#run;0.13.5!run.jar (3856ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/command/0.13.5/jars/command.jar ...
	[SUCCESSFUL ] org.scala-sbt#command;0.13.5!command.jar (3912ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/classpath/0.13.5/jars/classpath.jar ...
	[SUCCESSFUL ] org.scala-sbt#classpath;0.13.5!classpath.jar (3643ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/completion/0.13.5/jars/completion.jar ...
	[SUCCESSFUL ] org.scala-sbt#completion;0.13.5!completion.jar (3961ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/api/0.13.5/jars/api.jar ...
	[SUCCESSFUL ] org.scala-sbt#api;0.13.5!api.jar (4048ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-integration/0.13.5/jars/compiler-integration.jar ...
	[SUCCESSFUL ] org.scala-sbt#compiler-integration;0.13.5!compiler-integration.jar (3569ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-ivy-integration/0.13.5/jars/compiler-ivy-integration.jar ...
	[SUCCESSFUL ] org.scala-sbt#compiler-ivy-integration;0.13.5!compiler-ivy-integration.jar (2773ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/relation/0.13.5/jars/relation.jar ...
	[SUCCESSFUL ] org.scala-sbt#relation;0.13.5!relation.jar (5860ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/task-system/0.13.5/jars/task-system.jar ...
	[SUCCESSFUL ] org.scala-sbt#task-system;0.13.5!task-system.jar (4867ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/tasks/0.13.5/jars/tasks.jar ...
	[SUCCESSFUL ] org.scala-sbt#tasks;0.13.5!tasks.jar (3571ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/tracking/0.13.5/jars/tracking.jar ...
	[SUCCESSFUL ] org.scala-sbt#tracking;0.13.5!tracking.jar (3775ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/testing/0.13.5/jars/testing.jar ...
	[SUCCESSFUL ] org.scala-sbt#testing;0.13.5!testing.jar (4513ms)
downloading http://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.10.4/scala-compiler-2.10.4.jar ...
	[SUCCESSFUL ] org.scala-lang#scala-compiler;2.10.4!scala-compiler.jar (24545ms)
downloading http://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.10.4/scala-reflect-2.10.4.jar ...
	[SUCCESSFUL ] org.scala-lang#scala-reflect;2.10.4!scala-reflect.jar (5551ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/control/0.13.5/jars/control.jar ...
	[SUCCESSFUL ] org.scala-sbt#control;0.13.5!control.jar (2994ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/collections/0.13.5/jars/collections.jar ...
	[SUCCESSFUL ] org.scala-sbt#collections;0.13.5!collections.jar (4031ms)
downloading http://repo1.maven.org/maven2/jline/jline/2.11/jline-2.11.jar ...
	[SUCCESSFUL ] jline#jline;2.11!jline.jar (1278ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/incremental-compiler/0.13.5/jars/incremental-compiler.jar ...
	[SUCCESSFUL ] org.scala-sbt#incremental-compiler;0.13.5!incremental-compiler.jar (3753ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compile/0.13.5/jars/compile.jar ...
	[SUCCESSFUL ] org.scala-sbt#compile;0.13.5!compile.jar (3951ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/persist/0.13.5/jars/persist.jar ...
	[SUCCESSFUL ] org.scala-sbt#persist;0.13.5!persist.jar (3585ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/classfile/0.13.5/jars/classfile.jar ...
	[SUCCESSFUL ] org.scala-sbt#classfile;0.13.5!classfile.jar (4805ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbinary/sbinary_2.10/0.4.2/jars/sbinary_2.10.jar ...
	[SUCCESSFUL ] org.scala-tools.sbinary#sbinary_2.10;0.4.2!sbinary_2.10.jar (10308ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/cross/0.13.5/jars/cross.jar ...
	[SUCCESSFUL ] org.scala-sbt#cross;0.13.5!cross.jar (2982ms)
downloading http://repo1.maven.org/maven2/org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar ...
	[SUCCESSFUL ] org.apache.ivy#ivy;2.3.0!ivy.jar (3353ms)
downloading http://repo1.maven.org/maven2/com/jcraft/jsch/0.1.46/jsch-0.1.46.jar ...
	[SUCCESSFUL ] com.jcraft#jsch;0.1.46!jsch.jar (919ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/cache/0.13.5/jars/cache.jar ...
	[SUCCESSFUL ] org.scala-sbt#cache;0.13.5!cache.jar (3956ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/test-agent/0.13.5/jars/test-agent.jar ...
	[SUCCESSFUL ] org.scala-sbt#test-agent;0.13.5!test-agent.jar (4122ms)
downloading http://repo1.maven.org/maven2/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar ...
	[SUCCESSFUL ] org.scala-sbt#test-interface;1.0!test-interface.jar (733ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/apply-macro/0.13.5/jars/apply-macro.jar ...
	[SUCCESSFUL ] org.scala-sbt#apply-macro;0.13.5!apply-macro.jar (3300ms)
:: retrieving :: org.scala-sbt#boot-app
	confs: [default]
	44 artifacts copied, 0 already retrieved (13482kB/86ms)
Getting Scala 2.10.4 (for sbt)...
downloading http://repo1.maven.org/maven2/org/scala-lang/jline/2.10.4/jline-2.10.4.jar ...
	[SUCCESSFUL ] org.scala-lang#jline;2.10.4!jline.jar (908ms)
downloading http://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.4/jansi-1.4.jar ...
	[SUCCESSFUL ] org.fusesource.jansi#jansi;1.4!jansi.jar (642ms)
:: retrieving :: org.scala-sbt#boot-scala
	confs: [default]
	5 artifacts copied, 0 already retrieved (24459kB/62ms)
[info] Set current project to vagrant (in build file:/home/vagrant/)
> exit
[vagrant@localhost ~]$

※初回だけ、なんかのパッケージなどをダウンロードする

ソースを作成してコンパイルしてみる

http://www.scala-sbt.org/0.13/tutorial/ja/Hello.html
↑の通りにする

ディレクトリとソースを作成
$ mkdir hello
$ cd hello
$ echo 'object Hi { def main(args: Array[String]) = println("Hi!") }' > hw.scala
$
コンパイル実行
$ sbt
[info] Set current project to hello (in build file:/home/vagrant/hello/)
> compile
[info] Updating {file:/home/vagrant/hello/}hello...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 1 Scala source to /home/vagrant/hello/target/scala-2.10/classes...
[success] Total time: 4 s, completed 2015/11/02 13:05:30
> run
[info] Running Hi
Hi!
[success] Total time: 0 s, completed 2015/11/02 13:05:33
> exit
$

完成

対話モードではない状態でコンパイルや実行
$ sbt compile
[info] Set current project to hello (in build file:/home/vagrant/hello/)
[success] Total time: 1 s, completed 2015/11/02 13:07:34
$ sbt run
[info] Set current project to hello (in build file:/home/vagrant/hello/)
[info] Running Hi
Hi!
[success] Total time: 1 s, completed 2015/11/02 13:07:40
$

所感

インストール自体はうまくいったけど、初回のダウンロード処理で「ん?失敗?」と思ってしまう。
これからいろいろ検証するかな?

広告を非表示にする