sbt plugins isn't picked up from submodules?

为君一笑 提交于 2019-12-07 01:48:55

问题


I'm trying to convert a single module project into two modules with a root aggregate. Feels like a normal thing to do.

So, to simplify I have removed the second project that I added, but I do something like:

cd myproject
mkdir core
mv * core

and then add a build.sbt in myproject like

lazy val root = project.in( file(".") ).aggregate(core)
lazy val core = project in file("core")

However, trying to build core I get:

[myproject]/core/build.sbt:22: error: not found: value lessSettings seq(lessSettings:_*)

which is the settings for a plugin added in project/plugins.sbt of the original project now in

[myproject]/core/project/plugins.sbt

How come this is not picked up? Can't I have plugins living only in submodules? cd:ing into core submodule and running sbt it works just fine. Do I have to move my plugins to root/project? Pretty please, it can't be so?


回答1:


Your plugin.sbt file is ignored because you cannot have a project subfolder in a sub-project of a multi-project build.

In a multi-project build,

  • The .sbt files of the root project, and all .sbt files of all sub-projects, are all part of a single build definition. The settings defined in a sub-project are just automatically scoped to that project.

  • Since there is only one build definition, there is only one project to build that build definition, and that is in the project/ folder of the root project. All project/ folders of sub-projects will be ignored.

In your case, moving your plugin.sbt to the build root project folder should make your plugin appear again.

Furthermore, if you only work on the core project, instead of running sbt in core, you can run sbt in the root project and type project core to "move" (actually, scope everything you do) to the core sub-project.



来源:https://stackoverflow.com/questions/28222060/error-not-found-value-playscala

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!