DEV Community

tanishiking
tanishiking

Posted on

import $ivy, $dep, and using directive

In scala-cli, external libraries can be easily downloaded and used in scripts and REPLs using a convenient notation called using directive.

On the other hand, the worksheet functionality provided by IDEs such as Metals allows you to download external libraries in the same way using import $ivy or import $dep.
However, worksheets cannot make use of the using directive (at least as of mdoc v2.3.7) (mdoc is the library used behind the scenes to provide the worksheet functionality).

Which notations can be used in which environments? It's a bit confusing, so I'll leave a note.

// using dep import $ivy import $dep
scala-cli ⭕️
Ammonite ⭕️
IntelliJ worksheet (Ammonite) ⭕️
Metals Worksheet ⭕️ ⭕️

Note

Top comments (0)