如何在sbt子项目构建文件中启用插件?我知道如何在main build.sbt文件中执行此操作。
例如,考虑以下项目结构
root/
app1
build.sbt
project
src/
app2
build.sbt
project
src/
build.sbt
project
所以我的root / build.sbt就像:
lazy val commonSettings = Seq(
organization := "com.someorg",
version := "0.1.0",
scalaVersion := "2.11.7"
)
lazy val app1 = (project in file("app1")).
//enablePlugins(Plugin1,Plugin2). I WANT TO ENABLE THIS IN app1/build.sbt
settings(commonSettings: _*).
settings(name := "app1")
lazy val app2 = (project in file("app2")).
//enablePlugins(Plugin1,Plugin2). I WANT TO ENABLE THIS IN app2/build.sbt
settings(commonSettings: _*).
settings(name := "app2")
lazy val root = (project in file(".")).
settings(commonSettings: _*).
settings(
name := "aaaMain"
).
aggregate(app1,app2).
dependsOn(app1,app2)
目前我的app1 / build.sbt就像:
libraryDependencies ++= Seq(
dependency1,
dependency2
)
如何在app1 / build.sbt中启用Plugin1和Plugin2?
解决方案:
只需在app1 / build.sbt中直接添加enablePlugins(Plugin1,Plugin2)
即可。
Intellij可能会将此标记为语法错误,但在从终端编译时,它会编译并正常工作。
感谢@sjrd帮助我。
答案 0 :(得分:0)
只需直接在enablePlugins(Plugin1,Plugin2)
中添加app1/build.sbt
。
Intellij可能会将其标记为语法错误,但是在从终端进行编译时,它可以编译并正常工作。
感谢@sjrd为我提供帮助。