Dependencies install questions

Hello

I know I can put the dependencies declaration into build.sbt for auto management packages in the project.

But sometimes I just want to write a script (not a project), how do I install the package globally?

for instance, in ruby I can install the package in a project via bundle, also can install the package via gem command line to the system path.

Thanks.

Well, Java and Scala developers just don’t normally work that way or think that way (installing things globally). It just isn’t the culture on the JVM.

Does your script use scala-cli or Ammonite? If so, you can declare your dependencies right in the script itself and they’ll be fetched on demand as needed.

And if you’re writing scripts in Scala, you’re really limiting yourself if you don’t use scala-cli or Ammonite. They were created exactly because the default Scala script runner has so few features.

3 Likes