From 1e2d9b89563dd72bd8e07f3f61ffad0c93c98e1a Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Mon, 28 Aug 2023 09:13:45 -0700 Subject: [PATCH] Installation: document COURSIER_REPOSITORIES --- docs/configuration.md | 3 +++ docs/installation.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index f220f5d8a7..4d014d08d6 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -91,6 +91,9 @@ formatter, the correct release will be downloaded dynamically. > Since v3.1.0, the `version` parameter is required to be specified explicitly. +Since that requires access to artifact repositories, please see more on that on the +[Installation](installation.md#using-custom-repositories-with-cli) page. + ## Scala Dialects The formatter supports various dialects defined and supported by `scalameta` parser. However, diff --git a/docs/installation.md b/docs/installation.md index a63e494dd5..f077e8ffec 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -378,6 +378,34 @@ println(website.plaintext(org.scalafmt.cli.CliArgParser.buildInfo)) println(website.plaintext(org.scalafmt.cli.CliArgParser.scoptParser.usage)) ``` +### Using custom repositories with CLI + +Under the hood, `scalafmt` uses the `scalafmt-dynamic` library and, in turn, +`coursier`, to download the version (of `scalafmt-core`) specified in +`.scalafmt.conf` file. + +By default, coursier will download from a few standard repositories (including +sonatype, both public and snapshot). However, if you'd like to use instead some +custom repositories within your environment, please specify them using the +`COURSIER_REPOSITORIES` environment variable. + +#### Repository credentials + +Additionally, if your repositories require credentials, please specify them +in the [`COURSIER_CREDENTIALS`](https://get-coursier.io/docs/other-credentials) +environment variable. + +Keep in mind that `coursier` credential format is not the same as, say, `sbt`, +and since multiple entries are allowed and expected, each requires a unique +prefix of your choosing. + +Others have also reported needing to include in their credentials settings such as + +``` +.pass-on-redirect=true +.auto=true +``` + ## Gradle It is possible to use scalafmt in gradle with the following externally