如何在多模块构建中从不同模块引用 SBT 设置 [英] How to reference a SBT Setting from a different module in a multi-module build

查看:29
本文介绍了如何在多模块构建中从不同模块引用 SBT 设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在带有子模块 server 的多模块构建中,我在 server/build.sbt 中编写了一个自定义任务,我想在其中引用 baseDirectory 根项目.这是任务:

In a multi-module build with a sub module server I have written a custom task in server/build.sbt in which I would like to reference the baseDirectory of the root project. Here is the task:

lazy val genData = taskKey[Unit]("generate files")

genData := {
    List(
        Generator(baseDirectory.value.getParentFile, (resourceDirectory in Compile).value)
    ).foreach(_.makeData())
}

而不是 baseDirectory.value.getParentFile 我想写一些像 (baseDirectory in root).value 的东西,但这不起作用.有什么建议吗?

Instead of baseDirectory.value.getParentFile I would like to write somehing like (baseDirectory in root).value but this doesn't work. Any suggestions?

推荐答案

(baseDirectory in LocalRootProject).value

这篇关于如何在多模块构建中从不同模块引用 SBT 设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆