Skip to content

Instantly share code, notes, and snippets.

@eldritchideen
Forked from stuartsierra/lein2-issue.md
Last active August 29, 2015 14:20
Show Gist options
  • Save eldritchideen/025d8336522a53b1e339 to your computer and use it in GitHub Desktop.
Save eldritchideen/025d8336522a53b1e339 to your computer and use it in GitHub Desktop.

Sample Project

Starting from:

lein new foo
cd foo

Say I have a random JAR file that is not available in any repository:

touch README.md
jar cf bar.jar README.md

Let's assume I've installed it in a project-local repository like this:

mkdir repo
mvn install:install-file -DgroupId=local -DartifactId=bar \
    -Dversion=1.0.0 -Dpackaging=jar -Dfile=bar.jar \
    -DlocalRepositoryPath=repo

And I write my project.clj like this:

(defproject foo "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [local/bar "1.0.0"]]
  :repositories {"project" "file:repo"})

With Lein 2.0.0-preview4

Making sure my local cache is clean:

$ rm -rf ~/.m2/repository/local

The first time, Leiningen prints errors:

$ lein deps
Could not find artifact local:bar:pom:1.0.0 in central (http://repo1.maven.org/maven2)
Could not find artifact local:bar:pom:1.0.0 in clojars (http://clojars.org/repo/)
Retrieving local/bar/1.0.0/bar-1.0.0.pom (1k)from file:repo/
no supported algorithms found
Could not find artifact local:bar:jar:1.0.0 in central (http://repo1.maven.org/maven2)
Could not find artifact local:bar:jar:1.0.0 in clojars (http://clojars.org/repo/)
Retrieving local/bar/1.0.0/bar-1.0.0.jar (1k)from file:repo/
no supported algorithms found

But the second time it works:

$ lein deps
$ 

Some inspection shows that local/bar has been copied to my ~/.m2/repository cache:

$ find ~/.m2/repository/local
~/.m2/repository/local
~/.m2/repository/local/bar
~/.m2/repository/local/bar/1.0.0
~/.m2/repository/local/bar/1.0.0/_maven.repositories
~/.m2/repository/local/bar/1.0.0/bar-1.0.0.jar
~/.m2/repository/local/bar/1.0.0/bar-1.0.0.pom

With Lein 2.0.0-preview5 through preview7

Starting from scratch:

$ rm -rf ~/.m2/repository/local

Try running Leiningen:

$ lein deps
Could not find artifact local:bar:pom:1.0.0 in central (http://repo1.maven.org/maven2)
Could not find artifact local:bar:pom:1.0.0 in clojars (https://clojars.org/repo/)
Retrieving local/bar/1.0.0/bar-1.0.0.pom (1k)from file:repo/
Could not transfer artifact local:bar:pom:1.0.0 from/to project (file:repo): no supported algorithms found
Failed to collect dependencies for [#<Dependency org.clojure:clojure:jar:1.4.0 (compile)> #<Dependency local:bar:jar:1.0.0 (compile)>]

No matter how many times I run it, I get the same results. My ~/.m2/repository cache has the correct directories, but no files have been copied:

$ find ~/.m2/repository/local
~/.m2/repository/local
~/.m2/repository/local/bar
~/.m2/repository/local/bar/1.0.0

The Repository URL

Variations on the repository URL like file://repo have no positive effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment