sbt, the interactive build tool
Go to file
Alexandre Archambault e5780e602e Rework README 2015-11-27 01:21:42 +01:00
bootstrap/src/main/scala/coursier launch command should be fine 2015-11-22 23:50:33 +01:00
cli/src/main Better help messages 2015-11-24 21:11:27 +01:00
core Enable fetch-from-cache-first by default 2015-11-24 22:18:24 +01:00
files/src/main/scala/coursier Add fetchLocalFirst, fix in the way local repo are handled 2015-11-23 22:55:30 +01:00
notes Update release notes 2015-06-28 18:14:53 +02:00
project Update Travis CI scripts 2015-11-21 14:28:17 +01:00
web/src/main Edit repository list from web app 2015-07-04 17:51:30 +02:00
.gitignore Initial commit 2015-06-16 20:32:17 +02:00
.travis.yml Fix in Travis config 2015-11-21 14:23:06 +01:00
README.md Rework README 2015-11-27 01:21:42 +01:00
USAGE.md Update USAGE 2015-06-26 18:16:04 +02:00
appveyor.yml Update appveyor config 2015-11-21 15:26:47 +01:00
build.sbt launch command should be fine 2015-11-22 23:50:33 +01:00
coursier Add launcher 2015-11-23 01:12:00 +01:00
version.sbt Setting version to 0.1.0-SNAPSHOT 2015-06-28 16:08:11 +02:00

README.md

Coursier

Pure Scala Artifact Fetching

A pure Scala substitute for Aether

Build Status Build status (Windows) Join the chat at https://gitter.im/alexarchambault/coursier

coursier is a dependency resolver / fetcher à la Maven / Ivy, entirely rewritten from scratch in Scala. It aims at being fast and easy to embed in other contexts. Its very core (core module) aims at being extremely pure, and should be approached with a mathsy / algebraic mindset.

The files module handles caching of the metadata and artifacts themselves, and is less so pure than the core module, in the sense that it happily does IO as a side-effect (although it naturally favors immutability for all that's kept in memory).

It handles fancy Maven features like

It can be used either from the command-line, via its API, or from the browser.

Command-line

Download and run it with

$ curl -L -o coursier https://git.io/vBkT9; chmod +x coursier; ./coursier --help

The first time it is run, it will download the artifacts required to launch coursier. You'll be fine the next times :-).

$ ./coursier --help

lists the available coursier commands. The most notable ones are launch, fetch, and classpath. Type

$ ./coursier command --help

to get a description of the various options the command command (replace with one of the above command) accepts.

launch

The launch command fetches a set of Maven coordinates it is given, along with their transitive dependencies, then launches the "main main class" from it if it can find one (typically from the manifest of the first coordinates). The main class to launch can also be manually specified with the -M option.

For example, it can launch:

$ ./coursier launch com.lihaoyi:ammonite-repl_2.11.7:0.5.0
  • the REPLs of various JVM languages like ** Frege,
$ ./coursier launch -r central -r https://oss.sonatype.org/content/groups/public org.frege-lang:frege-repl-core:1.3 -M frege.repl.FregeRepl

** clojure,

$ ./coursier launch org.clojure:clojure:1.7.0 -M clojure.main

** jruby,

$ wget https://raw.githubusercontent.com/jruby/jruby/master/bin/jirb && \
  ./coursier launch org.jruby:jruby:9.0.4.0 -M org.jruby.Main -- -- jirb

** jython,

$ ./coursier launch org.python:jython-standalone:2.7.0 -M org.python.util.jython

** Groovy,

$ ./coursier launch org.codehaus.groovy:groovy-groovysh:2.4.5 -M org.codehaus.groovy.tools.shell.Main commons-cli:commons-cli:1.3.1

etc.

  • various programs, like Proguard, or its utility, Retrace,
$ ./coursier launch net.sf.proguard:proguard-base:5.2.1 -M proguard.ProGuard
$ ./coursier launch net.sf.proguard:proguard-retrace:5.2.1 -M proguard.retrace.ReTrace

fetch

The fetch command simply fetches a set of dependencies, along with their transitive dependencies, then prints the local paths of all their artefacts.

Example

$ ./coursier fetch org.apache.spark:spark-sql_2.11:1.5.2
...

classpath

The classpath command transitively fetches a set of dependencies like fetch does, then prints a classpath that can be handed over directly to java, like

$ java -cp "$(./coursier classpath com.lihaoyi:ammonite-repl_2.11.7:0.5.0 | tail -n1)" ammonite.repl.Repl
Loading...
Welcome to the Ammonite Repl 0.5.0
(Scala 2.11.7 Java 1.8.0_60)
@

API

This @larsrh gist illustrates how the API of coursier can be used to get transitives dependencies and fetch the corresponding artefacts

More explanations to come :-)

Scala JS demo

coursier is also compiled to Scala JS, and can be tested in the browser via its demo.

To do / missing

  • Snapshots metadata / artifacts, once in cache, are not automatically updated for now. #41
  • File locking could be better (none for metadata, no re-attempt if file locked elsewhere for artifacts) #71
  • Handle "configurations" like Ivy does, instead of just the standard (hard-coded) Maven "scopes" #8
  • SBT plugin #52, requires Ivy-like configurations #8

Contributors

  • Your name here :-)

Projects using coursier

  • @larsrh's libisabelle fetches some of its requirements via coursier,
  • jupyter-scala should soon allow to add dependencies in its sessions with coursier (initial motivation for writing coursier),
  • Your project here :-)

Released under the Apache license, v2.