War*_*rbo 2 configuration command-line scala sbt
与这个问题类似,我想阻止 sbt 用消息和空行向 shell 发送垃圾邮件。如果我使用 option 运行 sbt,它会停止sbt -Dsbt.supershell=false,但我想通过 dotfile in~/.sbt或类似的文件在全局范围内禁用它。我可以用sbt总是添加此选项的包装器替换二进制文件,但这似乎不雅。
我已经在一个名为~/.sbt/1.0/global.sbtand的文件中尝试了以下每一个~/.sbt/1.3/global.sbt,但都没有效果:
sbt.supershell := false
useSuperShell := false
sbt.useSuperShell := false
useSuperShell := false
supershell := false
ThisBuild / useSuperShell := false
Run Code Online (Sandbox Code Playgroud)
作为我试图避免的一个例子,当我开始sbt一个我正在处理的项目时会发生以下情况(在编译、测试等过程中会散布类似数量的垃圾邮件):
$ sbt
[info] Loading settings for project global-plugins from metals.sbt ...
[info] Loading global plugins from /Users/chris/.sbt/1.0/plugins
| => global-plugins / updateCacheName 0s
| => global-plugins / updateCacheName 0s
| => Global / skip 0s
| => global-plugins / updateCacheName 0s
| => Global / skip 0s
| => global-plugins / updateCacheName 0s
| => global-plugins / updateCacheName 0s
| => global-plugins / update 0s
| => global-plugins / Runtime / unmanagedClasspath 0s
| => global-plugins / scalaCompilerBridgeResolvers 0s
| => global-plugins / Compile / externalHooks 0s
| => global-plugins / Compile / externalHooks 0s
| => global-plugins / dependencyPositions 0s
| => global-plugins / update 0s
| => global-plugins / Runtime / unmanagedClasspath 0s
| => global-plugins / moduleSettings 0s
| => global-plugins / csrConfiguration 0s
| => global-plugins / projectDescriptors 0s
| => global-plugins / dependencyPositions 0s
| => global-plugins / update 0s
| => global-plugins / Runtime / unmanagedClasspath 0s
| => global-plugins / csrRecursiveResolvers 0s
| => global-plugins / moduleSettings 0s
| => global-plugins / csrConfiguration 0s
| => global-plugins / projectDescriptors 0s
| => global-plugins / dependencyPositions 0s
| => global-plugins / update 0s
| => global-plugins / Runtime / unmanagedClasspath 0s
| => global-plugins / csrRecursiveResolvers 0s
| => global-plugins / moduleSettings 0s
| => global-plugins / csrConfiguration 0s
| => global-plugins / projectDescriptors 0s
| => global-plugins / dependencyPositions 0s
| => global-plugins / update 0s
| => global-plugins / Runtime / unmanagedClasspath 0s
| => global-plugins / update 0s
| => global-plugins / Runtime / unmanagedClasspath 0s
| => global-plugins / update 0s
| => global-plugins / Runtime / unmanagedClasspath 0s
| => global-plugins / update 0s
| => global-plugins / Runtime / unmanagedClasspath 0s
| => global-plugins / update 0s
| => global-plugins / Compile / previousCompile 0s
| => global-plugins / Compile / compileIncremental 0s
| => global-plugins / Compile / compileIncremental 0s
| => <anon-3eb292cd> 0s
| => <anon-3eb292cd> 0s
| => <anon-3eb292cd> 0s
| => <anon-3eb292cd> 0s
| => <anon-3eb292cd> 0s
| => <anon-3eb292cd> 0s
| => <anon-3eb292cd> 0s
| => <anon-3eb292cd> 0s
| => <anon-3eb292cd> 0s
| => <anon-3eb292cd> 0s
| => <anon-3eb292cd> 1s
| => <anon-3eb292cd> 1s
| => <anon-3eb292cd> 1s
| => <anon-3eb292cd> 1s
| => <anon-3eb292cd> 1s
| => <anon-3eb292cd> 1s
| => <anon-3eb292cd> 1s
| => <anon-3eb292cd> 1s
| => <anon-3eb292cd> 1s
| => <anon-3eb292cd> 2s
| => <anon-3eb292cd> 2s
| => <anon-3eb292cd> 2s
| => <anon-3eb292cd> 2s
| => <anon-3eb292cd> 2s
| => <anon-3eb292cd> 2s
| => <anon-3eb292cd> 2s
| => <anon-3eb292cd> 2s
| => <anon-3eb292cd> 2s
| => <anon-3eb292cd> 2s
| => <anon-3eb292cd> 3s
| => <anon-3eb292cd> 3s
| => <anon-3eb292cd> 3s
| => <anon-3eb292cd> 3s
| => <anon-3eb292cd> 3s
| => <anon-3eb292cd> 3s
| => <anon-3eb292cd> 3s
| => <anon-3eb292cd> 3s
| => <anon-3eb292cd> 3s
| => <anon-3eb292cd> 4s
| => <anon-3eb292cd> 4s
| => <anon-3eb292cd> 4s
| => <anon-3eb292cd> 4s
| => <anon-3eb292cd> 4s
| => <anon-3eb292cd> 4s
| => <anon-3eb292cd> 4s
| => <anon-3eb292cd> 4s
| => <anon-3eb292cd> 4s
| => <anon-3eb292cd> 4s
| => <anon-3eb292cd> 5s
[info] Loading project definition from /Users/chris/repos/scalacheck-demo/project
| => scalacheck-demo-build / bootResolvers 0s
| => scalacheck-demo-build / bootResolvers 0s
| => scalacheck-demo-build / bootResolvers 0s
| => scalacheck-demo-build / bootResolvers 0s
| => scalacheck-demo-build / otherResolvers 0s
| => scalacheck-demo-build / dependencyPositions 0s
| => scalacheck-demo-build / dependencyPositions 0s
| => Global / classpathEntryDefinesClass 0s
| => scalacheck-demo-build / Compile / discoveredSbtPlugins 0s
| => scalacheck-demo-build / csrFallbackDependencies 0s
| => scalacheck-demo-build / Compile / unmanagedSources / allInputPathsAndAttributes 0s
| => scalacheck-demo-build / Compile / externalHooks 0s
| => scalacheck-demo-build / Compile / compileIncremental 0s
[info] Loading settings for project scalacheck-demo from secrets.sbt,build.sbt ...
[info] Set current project to scalacheckdemo (in build file:/Users/chris/repos/scalacheck-demo/)
| => Global / fileTreeView 0s
| => Global / fileTreeView 0s
| => Global / previousCache 0s
| => Global / checkBuildSources 0s
| => Global / fileTreeView 0s
| => Zero / checkBuildSources / dynamicInputs 0s
| => Global / fileTreeView 0s
| => Global / previousCache 0s
| => Global / fileTreeView 0s
| => Global / fileTreeView 0s
| => Global / fileTreeView 0s
| => Global / fileTreeView 0s
| => Global / fileTreeView 0s
| => Global / fileTreeView 0s
| => Global / previousCache 0s
| => Global / fileTreeView 0s
| => Global / fileTreeView 0s
| => Global / fileTreeView 0s
| => Global / previousCache 0s
| => Global / fileTreeView 0s
[info] sbt server started at local:///Users/chris/.sbt/1.0/server/bba992971696ad25eaa9/sock
sbt:scalacheckdemo>
Run Code Online (Sandbox Code Playgroud)
sbt 启动器脚本提供了sbt -help哪个应该打印出运行brew install sbt安装 sbt 1.3.12后在我的机器上给出的全局配置的位置
SBT_OPTS environment variable, if unset uses ""
.sbtopts if this file exists in the current directory, its contents
are prepended to the runner args
/usr/local/etc/sbtopts if this file exists, it is prepended to the runner args
Run Code Online (Sandbox Code Playgroud)
所以试着把
-Dsbt.supershell=false
Run Code Online (Sandbox Code Playgroud)
在/usr/local/etc/sbtopts这SBT的系统范围的配置文件。但是我可以看到源代码中指定的默认位置/etc/sbt/sbtopts然后brew似乎替换了
s.gsub! 'etc_sbt_opts_file="/etc/sbt/sbtopts"', "etc_sbt_opts_file=\"#{etc}/sbtopts\""
Run Code Online (Sandbox Code Playgroud)
因此我认为最安全的方法是运行sbt -h看看你的机器有什么价值。我对 nixpkgs 不熟悉,但您可以查看它的 sbt来源,或者直接分析etc_sbt_opts_file生成的 sbt 启动器脚本中的变量,也许
vim `which sbt`
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
365 次 |
| 最近记录: |