gpt4 book ai didi

scala - 全局禁用 sbt supershell

转载 作者:行者123 更新时间:2023-12-04 16:40:12 26 4
gpt4 key购买 nike

类似于this question我想阻止 sbt 使用消息和空行向 shell 发送垃圾邮件。如果我使用选项 sbt -Dsbt.supershell=false 运行 sbt,它会停止,但我想通过 ~/.sbt 或类似的点文件全局禁用它.我可以用总是添加此选项的包装器替换 sbt 二进制文件,但这似乎不够优雅。

我在名为 ~/.sbt/1.0/global.sbt~/.sbt/1.3/global.sbt 的文件中尝试了以下各项,但都没有效果:

sbt.supershell := false
useSuperShell := false
sbt.useSuperShell := false
useSuperShell := false
supershell := false
ThisBuild / useSuperShell := false

作为我试图避免的一个例子,当我为我正在处理的项目启动 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>

最佳答案

sbt launcher script提供 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

所以试着把

-Dsbt.supershell=false

/usr/local/etc/sbtopts 中,这是 sbt 的系统范围配置文件。但是我可以看到 source 中指定的默认位置code 是 /etc/sbt/sbtopts 然后 brew 似乎是 replace

s.gsub! 'etc_sbt_opts_file="/etc/sbt/sbtopts"', "etc_sbt_opts_file=\"#{etc}/sbtopts\""

因此我认为最安全的做法是运行 sbt -h 来查看您机器上的值是多少。我不熟悉 nixpkgs,但你可以看看它的 source对于 sbt,或者直接分析生成的 sbt 启动器脚本中的 etc_sbt_opts_file 变量

vim `which sbt`

关于scala - 全局禁用 sbt supershell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62230806/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com