Skip to content

Instantly share code, notes, and snippets.

@francisbautista
Last active April 25, 2016 05:45
Show Gist options
  • Save francisbautista/3e37a02c2e1831428a23a765e287c199 to your computer and use it in GitHub Desktop.
Save francisbautista/3e37a02c2e1831428a23a765e287c199 to your computer and use it in GitHub Desktop.
Bash script to initialize an SBT Project from scratch.
#!/bin/sh
#------------------------------------------------------------------------------
# Name: sbtproject
# Version: 1.0
# Purpose: Create an SBT project directory structure with a few simple options.
# Author: Francis Bautista francisbautista.me
# License: Creative Commons Attribution-ShareAlike 2.5 Generic
# http://creativecommons.org/licenses/by-sa/2.5/
#------------------------------------------------------------------------------
# Set directory name
DIR_NAME=$1
mkdir $DIR_NAME
cd $DIR_NAME
# Create project folders and files
mkdir -p src/{main,test}/{java,resources,scala}
mkdir lib project target
touch README.md
# Get Scala Version
SCALA_VERSION=`scala -version 2>&1 |awk 'NR==1{ gsub(/"/,""); print $5 }'`
# create an initial build.sbt file
echo 'name := "'$DIR_NAME'"
version := "1.0"
scalaVersion := "'$SCALA_VERSION'"' > build.sbt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment