LoginSignup
14
15

More than 5 years have passed since last update.

giter8でScalaプロジェクトの作成

Posted at

Scalaプロジェクトを作成しようとしたら気づいてしまった。
実は、Scalaプロジェクトってどうやって作るんだっけ?と。

Playだったらactivator newで終了。
でも、Playじゃなくて普通のプロジェクトを作りたいんだ!

しかも、別にJava書かないけど、こういうのが良い!

$ tree                                                                    .
├── main
│   ├── java
│   └── scala
└── test
    ├── java
    └── scala

多分sbtにあるんだなと思ってい調べていたら、 giter8 というのを見つけた。
割と古い投稿ばかりだから最近どうなんだろう?と思ってたけど
今回求めていたモノにばっちりはまったから、使い方メモっておく。

インストール

Mac OS Xでしかやっていない。
なお、scalaとsbtはインストールしてある前提。

$ brew install giter8

プロジェクト作成

$ g8 typesafehub/scala-sbt

・・・なんか色々出てくる・・・

Scala Project Using sbt

name [Scala Project]:
organization [org.example]:
version [0.1-SNAPSHOT]:
scala_version [2.10.2]: 2.11.2

Template applied in ./gatling_test

nameがプロジェクト名、organizationがパッケージ名になるみたい。

なお引数はテンプレートを指定し、以下が指定できるみたい。

giter8 templates

自分でテンプレート作ることも可能のようだ。

plugins.sbtの設定

$ cd [name]
$ vim project/plugins.sbt

以下を書く。EclipseとInteliJ書いておいた。

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0")

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")

これで後は良しなに。

14
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
15