Help us understand the problem. What is going on with this article?

Install Scala and sbt on Ubuntu 14.04

More than 5 years have passed since last update.

全く関係ないですがQiitaの使い方メモ
Markdown記法 チートシート

Install JDK and Scala

$ sudo apt-get -y install default-jdk
$ sudo apt-get -y install scala

Scala syntax highlight on Vim (Option)

Install Vim and Neobundle

$ sudo apt-get install vim
$ sudo apt-get install git
$ mkdir -p ~/.vim/bundle
$ git clone https://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim

Write something on .vimrc for syntax highlight

.vimrc
set nocompatible
filetype off

if has('vim_starting')
    set runtimepath+=~/.vim/bundle/neobundle.vim
    call neobundle#begin(expand('~/.vim/bundle/'))

    NeoBundle 'Shougo/unite.vim'
    NeoBundle 'derekwyatt/vim-scala'

    call neobundle#end()
endif


filetype plugin on
filetype indent on

Install sbt

Ref: Install sbt

If you install Spark, you don't need to install sbt.
sbt is in Spark.

$ wget https://dl.bintray.com/sbt/debian/sbt-0.13.7.deb
$ sudo apt-get update
$ sudo dpkg -i sbt-0.13.7.deb
$ sbt

($sbt takes a time for first run)

sbt file structure

Ref: sbt file structure

src/
  main/
    resources/
       <files to include in main jar here>
    scala/
       <main Scala sources>
    java/
       <main Java sources>
  test/
    resources
       <files to include in test jar here>
    scala/
       <test Scala sources>
    java/
       <test Java sources>

away from sbt, backspace doesn't work correctly. Use Delete.
(now i using mobaxterm)

シェル
シェル引数

$ touch scalaproj.sh
$ chmod u+x scalaproj.sh
$ vim scalaproj.sh

Shell script to create Scala project on sbt format

scalaproj.sh
#!/bin/sh
if [ $# -ne 1 ]; then
  echo "It need 1 argument" 1>&2
  exit 1
fi

mkdir $1
mkdir $1/src
mkdir $1/src/main
mkdir $1/src/test
mkdir $1/src/main/resources
mkdir $1/src/main/scala
mkdir $1/src/main/java
mkdir $1/src/test/resources
mkdir $1/src/test/scala
mkdir $1/src/test/java
$ ./scalaproj.sh hello

Command about sbt

Type command at project name directory
In this case, in "hello" directory.

$ sbt run
$ sbt compile
$ sbt test

memos

ref
http://mobaxterm.mobatek.net/documentation.html#6_8_7
http://www.scala-sbt.org/0.13/tutorial/ja/Manual-Installation.html

Settings
X11
toggle Unix-compatible keyboard

couldn't ... let's use delete key

scala unit test
http://yomi322.hateblo.jp/entry/2013/02/01/195846
deploy files
ex. build.sbt

create file to test
https://etorreborre.github.io/specs2/website/SPECS2-3.1/quickstart.html

reference
install
http://bach.istc.kobe-u.ac.jp/lect/ProLang/org/scala.html
syntax
http://blog.pg1x.com/entry/2014/08/13/115730-scala-syntax-highlight-with-vim

install neobundle
http://keyamb.hatenablog.com/entry/2013/06/13/164725
new version of neobundle
http://qiita.com/musclemikiya/items/58edc801264aca151446
the place of .vimrc
http://suntree.orsp.net/blog/?p=153

tshimba
このサイトの掲載内容は私自身の見解であり、所属する組織とは関係ありません
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away