2016-07-04 5 views
0

私はマルチモジュールSBTプロジェクトを持っています。サブモジュールにアーティファクト(カスタムタスクで生成)を追加したいと思います。 しかし、私はいつもReference to undefined settingエラーがあります。ここではSBTサブプロジェクトへのアーティファクトの追加:未定義設定への参照

Reference to undefined setting: 
    documentation/*:adocPdf from documentation/*:packagedArtifacts ((sbt.BuildExtra) Defaults.scala:1966) 

はSBT 0.13.11のための私のbuild.sbt次のとおりです。

import sbt.Keys._ 
import sbt.Project.projectToRef 
import sbt._ 

lazy val commonSettings = Seq(
    scalaVersion := "2.11.8", 
    [...] 
) 

lazy val adocPdf: TaskKey[File] = taskKey[File]("Generate documentation from Asciidoc") 
adocPdf := { 
    // generate pdf documentation to target/documentation-$version.pdf 
    [...] 
    file(s"${documentation.base.absolutePath}/target/documentation-${version.value}.pdf") 
} 

lazy val docPdfArtifact: Artifact = Artifact("documentation", "pdf", "pdf", None, Configurations.Docs :: Nil, None) 

lazy val api = (project in file("api")) 
    .settings(commonSettings: _*) 

lazy val documentation = (project in file("documentation")) 
    .settings(commonSettings: _*) 
    .settings(addArtifact(docPdfArtifact, adocPdf).settings: _*) 

lazy val myProject = (project in file(".")) 
    .settings(commonSettings: _*) 
    .aggregate(api, documentation) 

間違っているものの任意のアイデア?

答えて

1

私はaddArtifactが上記のやっているかわからないんだけど、あなたは特定のプロジェクトにadocPdf : TaskKey[File]のタスク体を定義するときに作成された設定を割り当てる必要があります:

lazy val adocPdf: TaskKey[File] = taskKey[File]("Generate documentation from Asciidoc") 
lazy val adocPdfSetting = adocPdf := { 
    //.. the task definition - return a `file` 
} 
lazy val documentation = (project in file("documentation")) 
    //apply the setting to the project 
    .settings(adocPdfSetting) 
関連する問題