Skip to content

Commit

Permalink
Add docs to classifiers and exclude dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
lwronski committed Feb 28, 2023
1 parent f9c4925 commit 112fcd3
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions website/docs/guides/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,48 @@ For example:
org.postgresql:postgresql:42.2.8
```

### Excluding Transitive Dependencies

To exclude a transitive dependency from a Scala CLI project use the `exclude` parameter:

- `exclude=org%%name` - for Scala modules
- `exclude=org%name` - for Java modules

It requires passing the organization and module name of the dependency to be excluded. For example, let's say you have
the following Scala code:

```scala title=Main.scala
//> using dep "com.lihaoyi::pprint:0.8.1"
object Main extends App {
println("Hello")
}
```

If you want to compile it with the `pprint` library but exclude its `sourcecode` dependency, you can use
the `exclude` parameter as follows:

```scala title=Main.scala
//> using dep "com.lihaoyi::pprint:0.8.1,exclude=com.lihaoyi%%sourcecode"
object Main extends App {
println("Hello")
}
```

### Dependency classifiers

To specify a classifier of a dependency in a Scala CLI project, use the `classifier` parameter:

- `classifier={classifier_name}`

If you want to use `pytorch` dependency with classifier `linux-x86_64`, use the `classifier` parameter as follows:

```scala title=Main.scala
//> using dep "org.bytedeco:pytorch:1.12.1-1.5.8,classifier=linux-x86_64"
object Main extends App {
println("Hello")
}
```

## Specifying dependencies from the command line

You can add dependencies on the command line, with the `--dependency` option:
Expand Down

0 comments on commit 112fcd3

Please sign in to comment.