Skip to content

Instantly share code, notes, and snippets.

@mkows
Forked from maciej/init-scala.sh
Last active June 22, 2018 10:28
Show Gist options
  • Save mkows/b80154941fcf965061db to your computer and use it in GitHub Desktop.
Save mkows/b80154941fcf965061db to your computer and use it in GitHub Desktop.
Init sbt project
#!/bin/bash
# Usage: init-sbt.sh my-new-project
PROJECT_NAME="$1"
SCALA_VERSION="2.11.6"
SCALATEST_VERSION="2.2.4"
mkdir $PROJECT_NAME
cd $PROJECT_NAME
cat > build.sbt << EOF
name := "$PROJECT_NAME"
version := "1.0"
scalaVersion := "$SCALA_VERSION"
libraryDependencies += "org.scalatest" %% "scalatest" % "$SCALATEST_VERSION" % "test"
EOF
mkdir -p "src/main/scala"
mkdir -p "src/test/scala"
mkdir "project"
cat > src/main/scala/Main.scala << EOF
object Main extends App {
println("hello")
}
EOF
cat > project/build.properties << EOF
sbt.version=0.13.8
EOF
cat > .gitignore << EOF
target/
.DS_Store
.idea
.idea_modules
EOF
git init
git add .gitignore
git add build.sbt
git commit -m 'Initial commit'
sbt run
@mkows
Copy link
Author

mkows commented Jun 22, 2018

In 2018 use sbt new scala/scala-seed.g8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment