Skip to content

Commit

Permalink
Mention the url dependency user param in the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Gedochao committed Apr 11, 2022
1 parent 9a004cc commit 6f18f42
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
6 changes: 6 additions & 0 deletions website/docs/guides/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ scala-cli compile Hello.scala \
--dependency org.scala-lang.modules::scala-parallel-collections:1.0.4
```

You can also add a URL fallback for a JAR dependency, if it can't be fetched otherwise:
```bash
scala-cli compile Hello.scala \
-- dependency "org::name::version,url=https://url-to-the-jar"
```

Note that `--dependency` is only meant as a convenience.
You should favor adding dependencies in the sources themselves via [using directives](./guides/configuration.md#special-imports).
<!-- TODO #344
Expand Down
5 changes: 3 additions & 2 deletions website/docs/guides/using-directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ The only exceptions are `using target` directives, which only apply to the given
Below is a list of the most important `using` directives that Scala CLI supports. The full list can be found in the [Reference section of this documentation](./reference/directives.md).

- `//> using scala "<scala-version>"` - defines version of Scala used
- `//> using lib "org::name:version"` - defines dependency to given library [more in dedicated guide](./guides/dependencies.md)
- `//> using lib "org::name:version"` - defines dependency to a given library [more in dedicated guide](./guides/dependencies.md)
- `//> using lib "org::name:version,url=url"` - defines dependency to a given library with a fallback to its jar url
- `//> using resourceDir "<dir>"` - marks directory as source of resources. Resources accessible at runtime and packaged together with compiled code.
- ``//> using `java-opt` "<opt>"`` - use given java options when running application or tests
- `//> using target ["test"|"main"]` used to marked or unmarked given source as test
Expand Down Expand Up @@ -171,4 +172,4 @@ In such cases we suggest to use triple `/` for single line comments, or use `//`
*/
```

Generally, our recommendation is to not use keyword based directives until scala-cli will stop supporting plain comments-based directives.
Generally, our recommendation is to not use keyword based directives until scala-cli will stop supporting plain comments-based directives.
3 changes: 2 additions & 1 deletion website/docs/reference/dependency.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ sidebar_position: 4

- second `:` — scala platform suffix
- single `:` — no platform suffix
- double `::` — platform suffix, if any
- double `::` — platform suffix, if any
- user parameters can be passed after a comma `,`
6 changes: 5 additions & 1 deletion website/docs/reference/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,17 @@ Manually add JAR(s) to the class path

Add dependencies

`//> using lib "`_org_`:`name`:`ver"
`//> using lib "`_org_`:`name`:`ver`"`

`//> using lib "`_org_`:`name`:`ver`,url=`url`"`

#### Examples
`//> using lib "org.scalatest::scalatest:3.2.10"`

`//> using lib "org.scalameta::munit:0.7.29"`

`//> using lib "tabby:tabby:0.2.3,url=https://github.com/bjornregnell/tabby/releases/download/v0.2.3/tabby_3-0.2.3.jar"`

### Java home

Sets Java home used to run your application or tests
Expand Down

0 comments on commit 6f18f42

Please sign in to comment.