Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation: document COURSIER_REPOSITORIES #3621

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
28 changes: 28 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```
<prefix>.pass-on-redirect=true
<prefix>.auto=true
```

## Gradle

It is possible to use scalafmt in gradle with the following externally
Expand Down
Loading