Question

I want to organize my Scala packages and love how Python solves this issue with pip.

Can you recommend a similar tool for the management of Scala packages?

EDIT: I am looking for an easy installation of new packages with all it's dependencies like

 >>> pip install <a_package> # installs a_package with all dependencies.
Was it helpful?

Solution

The most directly similar is probably Scala Build Tool. Specifically, Library Dependencies. The Java ecosystem includes many libraries and build tools, Scala is built on Java. So you gain the ability to leverage things like -

Further, because everything is run inside a virtual machine; there is no "system" level install. You can start with your CLASSPATH and for more investigate class loading.

#!/bin/sh
# From http://www.scalaclass.com/node/10 - CLASSPATH
L=`dirname $0`/../lib
cp=`echo $L/*.jar|sed 's/ /:/g'`
exec scala -classpath "$cp" "$0" "$@"
!#
import com.my.Goodness
val goodness = new Goodness
world.hello

OTHER TIPS

Pythonistas install system wide packages which are then used by all of the python projects. This lead to a bunch of problems which virtualenv tries to solve. Scala guys and in general Java people have per-project definition which is written for dependency management tool -- either mvn (xml), sbt (scala), gradle (groovy), etc.

Most of these tools have system-wide cache, so usually it downloads some version of dependency only once, then puts it in a particular place on your disk. When you need to run/assemble your java or scala program it constructs so called CLASSPATH variable which is consists of patches to required libraries. Then CLASSPATH variable (aka PYTHONPATH in python world) is used by runtime environment to lookup required parts. Again, CLASSPATH varies a lot from project to project, whereas PYTHONPATH is quite constant. I do believe there are might be tools that do the very same job pip does, but it isn't accepted way in JVM world.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top