DEV Community

tanishiking
tanishiking

Posted on

1

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

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay