sbt 插件不是从子模块中提取的吗? [英] sbt plugins isn't picked up from submodules?
问题描述
我正在尝试将单个模块项目转换为两个具有根聚合.感觉很正常.
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
然后在 myproject 中添加一个 build.sbt 就像
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: 错误:未找到:值 lessSettingsseq(lessSettings:_*)
[myproject]/core/build.sbt:22: error: not found: value lessSettings seq(lessSettings:_*)
这是在project/plugins.sbt中添加的插件的设置原始项目现在在
which is the settings for a plugin added in project/plugins.sbt of the original project now in
[myproject]/core/project/plugins.sbt
这个怎么没人接?我不能让插件只存在于子模块?cd: 进入核心子模块并运行 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?
推荐答案
您的 plugin.sbt
文件被忽略,因为子项目中不能有 project
子文件夹多项目构建.
Your plugin.sbt
file is ignored because you cannot have a project
subfolder in a sub-project of a multi-project build.
在多项目构建中,
根项目的
.sbt
文件,以及所有子项目的所有.sbt
文件,都是单个 构建定义.子项目中定义的设置只是自动限定在该项目范围内.
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.
由于只有一个构建定义,因此只有一个项目可以构建该构建定义,并且位于根项目的 project/
文件夹中.子项目的所有 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.
在您的情况下,将您的 plugin.sbt
移动到构建根 project
文件夹应该会使您的插件再次出现.
In your case, moving your plugin.sbt
to the build root project
folder should make your plugin appear again.
此外,如果你只在core
项目上工作,而不是在core中运行sbt
,你可以在根项目中运行sbt
并键入 project core
以移动"(实际上,将您所做的所有事情的范围)移动"到核心子项目.
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.
这篇关于sbt 插件不是从子模块中提取的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!