还要注意项目文件 [英] Watch for project files also
问题描述
我以下列方式使用 sbt
:我在 sbt 中运行 ~ test:compile
然后在 IDE 中工作,偶尔观察项目是否仍然编译,因为 IDE 的演示文稿编译器往往有问题.当我 git pull
一些代码时,project/
文件中可能会有变化,所以我想重新加载.有没有办法,如何同时查看源文件和项目文件,这样当项目文件发生变化时,我才真正得到更新?
I use sbt
in the following fashion: I run ~ test:compile
in sbt and then work in IDE, watching occasionaly if the project still compiles, because the IDE's presentation compiler tends to be buggy. When I git pull
some code, there might be changes in the project/
files, so I want to have reload. Is there a way, how to watch both source files and project files, so when there is change in project files, I actually get the update?
推荐答案
你实际上不能使用 ~
并让它立即重建项目本身,因为 ~
需要读取构建定义本身来确定:
You actually can't use ~ <task>
and have it rebuild the project itself right now, because ~ <task>
needs to read the build definition itself to determine:
- 观看哪些源文件
- 如何运行任务.
您正在做的是在项目/更改时更改配置.这需要 sbt 的完整reload
或 reboot
以拉入新配置.
What you're doing is altering the config whe project/ changes. This requires a full reload
or reboot
of sbt to pull in the new configuration.
所以,从 sbt 0.13 开始,这是不可能的.您可以拥有它,以便在 project/
更改时重建您的源代码,但无需重建构建定义,没有太大帮助.
So, as of sbt 0.13, this isn't possible. You can have it so it will rebuild your source code when project/
changes, but without rebuilding the build definition, not much help.
您可以创建一个新的 sbt 提示或任务,运行时可以检查项目/中的源文件是否已更新并发出警告/错误,以便您知道重新启动.这可能是目前最好的选择.
You could create a new sbt prompt, or task, that when run could check to see if source files in project/ are updated and issue a warning/error so you know to reboot. That's probably the best option right now.
这篇关于还要注意项目文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!