sbt/docker-sbt

global plugins doesn't work

chameleon82 opened this issue · 2 comments

Regarding https://www.scala-sbt.org/1.x/docs/Global-Settings.html I'm trying to add global plugins with script

    install -d ~/.sbt/1.0/plugins
    echo 'addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")' > ~/.sbt/1.0/plugins/plugins.sbt
    sbt scalafmtAll

but it doesn't apply and fail with

[error] Not a valid command: scalafmtAll

Are you sure the issue you have is related to the scala-sbt docker image? What image were you using?

docker run -it --rm hseeberger/scala-sbt:8u312_1.6.2_2.13.8 bash
root@0d48c900dec3:~# install -d ~/.sbt/1.0/plugins
root@0d48c900dec3:~# echo 'addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")' > ~/.sbt/1.0/plugins/plugins.sbt
root@0d48c900dec3:~# sbt scalafmtAll
[info] Updated file /root/project/build.properties: set sbt.version to 1.6.2
[info] welcome to sbt 1.6.2 (Oracle Corporation Java 1.8.0_312)
[info] loading settings for project global-plugins from plugins.sbt ...
[info] loading global plugins from /home/sbtuser/.sbt/1.0/plugins
[info] Updating
https://repo1.maven.org/maven2/org/scalameta/sbt-scalafmt_2.12_1.0/2.4.6/sbt-scalafmt-2.4.6.pom
  100.0% [##########] 2.9 KiB (6.5 KiB / s)
https://repo1.maven.org/maven2/org/scalameta/scalafmt-dynamic_2.12/3.3.0/scalafmt-dynamic_2.12-3.3.0.pom
  100.0% [##########] 2.7 KiB (58.3 KiB / s)
https://repo1.maven.org/maven2/org/scalameta/scalafmt-sysops_2.12/3.3.0/scalafmt-sysops_2.12-3.3.0.pom
  100.0% [##########] 2.2 KiB (23.1 KiB / s)
https://repo1.maven.org/maven2/com/googlecode/java-diff-utils/diffutils/1.3.0/diffutils-1.3.0.pom
  100.0% [##########] 2.7 KiB (22.0 KiB / s)
https://repo1.maven.org/maven2/org/scalameta/scalafmt-interfaces/3.3.0/scalafmt-interfaces-3.3.0.pom
  100.0% [##########] 2.1 KiB (66.4 KiB / s)
[info] Resolved  dependencies
[info] Fetching artifacts of
https://repo1.maven.org/maven2/com/googlecode/java-diff-utils/diffutils/1.3.0/diffutils-1.3.0.jar
  100.0% [##########] 33.3 KiB (505.0 KiB / s)
https://repo1.maven.org/maven2/org/scalameta/sbt-scalafmt_2.12_1.0/2.4.6/sbt-scalafmt-2.4.6.jar
  100.0% [##########] 54.4 KiB (788.2 KiB / s)
https://repo1.maven.org/maven2/org/scalameta/scalafmt-sysops_2.12/3.3.0/scalafmt-sysops_2.12-3.3.0.jar
  100.0% [##########] 44.0 KiB (656.4 KiB / s)
https://repo1.maven.org/maven2/org/scalameta/scalafmt-interfaces/3.3.0/scalafmt-interfaces-3.3.0.jar
  100.0% [##########] 5.2 KiB (48.1 KiB / s)
https://repo1.maven.org/maven2/org/scalameta/scalafmt-dynamic_2.12/3.3.0/scalafmt-dynamic_2.12-3.3.0.jar
  100.0% [##########] 136.1 KiB (1.7 MiB / s)
https://repo1.maven.org/maven2/com/typesafe/config/1.4.1/config-1.4.1.jar
  100.0% [##########] 288.3 KiB (1.5 MiB / s)
https://repo1.maven.org/maven2/io/get-coursier/interface/0.0.17/interface-0.0.17.jar
  100.0% [##########] 3.0 MiB (8.6 MiB / s)
[info] Fetched artifacts of
[info] loading project definition from /root/project
[info] set current project to root (in build file:/root/)
[error] scalafmt: File not exists: /root/.scalafmt.conf
[error] scalafmt: File not exists: /root/.scalafmt.conf
[error] scalafmt: File not exists: /root/.scalafmt.conf
[error] (Test / scalafmt) scalafmt: File not exists: /root/.scalafmt.conf
[error] (Compile / scalafmt) scalafmt: File not exists: /root/.scalafmt.conf
[error] (IntegrationTest / scalafmt) scalafmt: File not exists: /root/.scalafmt.conf
[error] Total time: 0 s, completed Feb 12, 2022 1:06:33 PM

Thanks for help. Actually my mistake. We use it in ci template where -Dsbt.global.base point to another location