2012-02-15 155 views
1

我读的是sbt tutorial,我想了解依赖于其他任务的任务部分。问题是,我创建了从该教程以下,但它不工作:具有依赖关系的Sbt任务

import sbt._ 
import Keys._ 
import sys.process._ 

object HelloBuild extends Build { 
    val hwsettings = Defaults.defaultSettings ++ Seq (
    scalaVersion := "2.9.1", 
    name := "sbt-build" 
) 
    val intt = TaskKey[Int]("int-task") 
    val intTask = intt := 1 
    val sample = TaskKey[Int]("sample-task") 
    val sampleTask = sample <<= intTask map { _ + 1 } 

    lazy val project = Project (
    "project", 
    file("."), 
    settings = hwsettings ++ Seq(intTask) 
) 
} 

它说:

[error] /home/platon/Tor/sbt-build/project/Build.scala:21: type mismatch; 
[error] found : Int(1) 
[error] required: String 
[error] val sampleTask = sample <<= intTask map { _ + 1 } 

我在做什么错?

回答

3

以任务键intt开头;不是该任务密钥的初始化。

val sampleTask = sample <<= intt map { _ + 1 } 
+0

啊,愚蠢的错误:) – Rogach 2012-02-15 15:53:47