问题描述
对于一个项目,我需要使用特定的 JVM 选项(-Dfile.encoding=UTF-8
和一些memory/gc 选项) - 但我不一定想将这些相同的选项应用于我拥有的每个 SBT 项目.
For a project, I need to start SBT with specific JVM options (-Dfile.encoding=UTF-8
and a number of memory/gc options) - but I don't necessarily want to apply those same options to every SBT project I have.
我看过参考文献(在sbt-extras)到 .sbtopts
(特定于项目的 SBT 命令行选项)和 .jvmopts
(特定于项目的 SBT JVMoptions) 文件,如果在 SBT 项目的根目录中找到,但 SBT 的标准 Windows 版本(我使用的是 0.13.1 版本)似乎忽略了它们.
I've seen references (in sbt-extras) to the .sbtopts
(project-specific SBT command line options) and .jvmopts
(project-specific SBT JVM options) files that are supposed to support this, if found in the root directory of an SBT project, but the standard Windows version of SBT (I'm using version 0.13.1) seems to ignore them.
(sbt-extras 方法对我很有吸引力,因为假设 .sbtopts
和 .jvmopts
在版本控制中被跟踪,有希望构建项目的人需要零 SBT 配置.)
(The sbt-extras approach appeals to me because, assuming that .sbtopts
and .jvmopts
are tracked in version control, there is zero SBT configuration required for people wishing to build the project.)
当前是否有一种机制来指定跨平台工作的特定于项目的 SBT 选项?
Is there a current mechanism to specify project-specific SBT options that works cross platform?
UPDATE:自从我最初提出这个问题以来,.sbtopts
和 .jvmopts
现在是标准 Linux 的一部分em> 版本的 SBT,不再需要 sbt-extras.但是,Windows 版本只支持.jvmopts
,不支持.sbtopts
.
UPDATE: Since I originally raised this question, .sbtopts
and .jvmopts
are now part of the standard Linux version of SBT, and sbt-extras is no longer required. However, the Windows version only supports .jvmopts
and does not recognize .sbtopts
.
推荐答案
这是当前版本的 SBT(在撰写本文时为 v1.0.3)对 的公认限制Windows(它无法识别项目根目录中的 .sbtopts
).现在所有版本都支持 .jvmopts
文件.
This is a recognized limitation with the current version of SBT (v1.0.3, at the time of writing) on Windows (it doesn't recognize .sbtopts
in the project's root directory). All versions now support the .jvmopts
file.
您可以在 sbt-launcher 上跟踪此问题的状态-package 的 _GitHub 问题跟踪器.
You can track the status of this issue on sbt-launcher-package's _GitHub issue tracker.
更新:这个问题已于 2019 年 10 月修复.感谢 @conny 指出这一点.
UPDATE: This issue was fixed in Oct. 2019. Thanks to @conny for pointing that out.
这篇关于特定于项目的 SBT JVM 选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!