Skip to content
Brandon JeongYeol Choi edited this page Jul 11, 2013 · 3 revisions

SBT

SBT에서 프로젝트 생성

  1. 원하는 디렉토리 생성
  2. 디렉토리로 이동 후 build.sbt 파일 생성

build.sbt

sbt 프로젝트 설정파일

scalaVersion := "2.10.2"
 
name := "testSbt"
 
version := "0.1"
  • scalaVersion : 스칼라의 버전
  • name : 프로젝트의 이름
  • version : 프로젝트 버전

Dependencies 추가

각각의 dependency를 한 라인씩 추가(주의 : 각각에는 한 라인씩 공백이 존재해야 함)

libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % "test"

libraryDependencies += "junit" % "junit" % "4.10" % "test"

각각의 라인 사이에는 공백이 존재해야 함. 단 다음과 같이 붙여 쓸 수 있음(주의 : 한라인씩 작성할 때 += 을 사용하는데 반해, ++=를 사용함을 유의한다)

추가형식

  • SBT는 dependency 관리로 Apache Ivy를 사용
libraryDependencies += groupID % artifactID % revision % configuration
libraryDependencies ++= Seq(
  "org.scalatest" %% "scalatest" % "1.9.1" % "test",
  "junit" % "junit" % "4.10" % "test"
)

%%

libraryDependencies += "org.scala-tools" % "scala-stm_2.9.1" % "0.3"

다음 코드의 %% "scala-stmscala-stm_2.9.0 도 인식함 libraryDependencies += "org.scala-tools" %% "scala-stm" % "0.3"

플러그인 추가

/project/plugins.sbt 에 다음을 추가(이클립스 플러그인) addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.2.0")

ScalaTest, JUnit이 추가 된 build.sbt 예제

SBT command

  • compile : 컴파일
  • run : 실행
  • test : 테스트 수행
  • test-only : 지정한 테스트만을 수행
  • update : 의존성 업데이트
  • ~ : 소스변경 감시
  • 예를 들어 ~ run 이라고 입력하고 소스를 수정하면, 이를 감지하고 실행

참고

Scala Test

http://www.scalatest.org/

FPPiS Week 2 - Higher Order Functions

1. Higher-Order Functions

// TODO

2. Currying

// TODO

3. Example: Finding Fixed Points

Clone this wiki locally