Reb.Cabin
Reb.Cabin

Reputation: 5567

How to use current builds of rxjava in clojure with leiningen

I want to use some of the latest features being built frequently at https://github.com/Netflix/RxJava in Clojure, but am having some difficulties getting Leiningen to reference the local .jar that I build. The last version of rxjava released to Clojars was 0.9.0, which I can successfully reach with the following in my projects.clj

:dependencies [[org.clojure/clojure               "1.5.1"]
             [com.netflix.rxjava/rxjava-clojure "0.9.0"]]

Now, I do a successful build of the current rxjava sources, which produces the following files

/Users/rebcabin/Documents/RxJava/language-adaptors/rxjava-clojure/build/libs/rxjava-clojure-0.9.1-SNAPSHOT-javadoc.jar
/Users/rebcabin/Documents/RxJava/language-adaptors/rxjava-clojure/build/libs/rxjava-clojure-0.9.1-SNAPSHOT-sources.jar
/Users/rebcabin/Documents/RxJava/language-adaptors/rxjava-clojure/build/libs/rxjava-clojure-0.9.1-SNAPSHOT.jar

In my Clojure project directory, I do the following

mvn deploy:deploy-file \
    -DgroupId=local \
    -DartifactId=rxjava-clojure \
    -Dversion=0.9.1-SNAPSHOT \
    -Dpackaging=jar \
    -Dfile=/Users/rebcabin/Documents/RxJava/language-adaptors/rxjava-clojure/build/libs/rxjava-clojure-0.9.1-SNAPSHOT.jar \
    -Durl=file:maven_repository

following the instructions given here: https://gist.github.com/stuartsierra/3062743 (see the bottom) via http://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/ and leiningen - how to add dependencies for local jars?.

That reports success and produces the following:

$ find maven_repository/
maven_repository/
maven_repository//local
maven_repository//local/rxjava-clojure
maven_repository//local/rxjava-clojure/0.9.1-SNAPSHOT
maven_repository//local/rxjava-clojure/0.9.1-SNAPSHOT/maven-metadata.xml
maven_repository//local/rxjava-clojure/0.9.1-SNAPSHOT/maven-metadata.xml.md5
maven_repository//local/rxjava-clojure/0.9.1-SNAPSHOT/maven-metadata.xml.sha1
maven_repository//local/rxjava-clojure/0.9.1-SNAPSHOT/rxjava-clojure-0.9.1-20130628.172154-1.jar
maven_repository//local/rxjava-clojure/0.9.1-SNAPSHOT/rxjava-clojure-0.9.1-20130628.172154-1.jar.md5
maven_repository//local/rxjava-clojure/0.9.1-SNAPSHOT/rxjava-clojure-0.9.1-20130628.172154-1.jar.sha1
maven_repository//local/rxjava-clojure/0.9.1-SNAPSHOT/rxjava-clojure-0.9.1-20130628.172154-1.pom
maven_repository//local/rxjava-clojure/0.9.1-SNAPSHOT/rxjava-clojure-0.9.1-20130628.172154-1.pom.md5
maven_repository//local/rxjava-clojure/0.9.1-SNAPSHOT/rxjava-clojure-0.9.1-20130628.172154-1.pom.sha1
maven_repository//local/rxjava-clojure/maven-metadata.xml
maven_repository//local/rxjava-clojure/maven-metadata.xml.md5
maven_repository//local/rxjava-clojure/maven-metadata.xml.sha1

I now fix my projects.clj file to contain the following:

:dependencies [[org.clojure/clojure               "1.5.1"]
             [com.netflix.rxjava/rxjava-clojure "0.9.1"]]
:repositories {"local" ~(str (.toURI (java.io.File. "maven_repository")))}

but lein deps fails to find the local repo

$ lein deps
Could not find artifact com.netflix.rxjava:rxjava-clojure:jar:0.9.1 in central (http://repo1.maven.org/maven2/)
Could not find artifact com.netflix.rxjava:rxjava-clojure:jar:0.9.1 in clojars (https://clojars.org/repo/)
Could not find artifact com.netflix.rxjava:rxjava-clojure:jar:0.9.1 in local (file:/Users/rebcabin/Documents/ClojureProjects/rxjava/expt1/maven_repository/)
This could be due to a typo in :dependencies or network issues.

The following guesses in project.clj also do not work:

:dependencies [[org.clojure/clojure               "1.5.1"]
             [com.netflix.rxjava/rxjava-clojure "0.9.1-SNAPSHOT"]]
:repositories {"local" ~(str (.toURI (java.io.File. "maven_repository")))}

:dependencies [[org.clojure/clojure               "1.5.1"]
             [com.netflix.rxjava/rxjava-clojure "0.9.1--20130628.172154-1"]]
:repositories {"local" ~(str (.toURI (java.io.File. "maven_repository")))}

any ideas how to proceed, please & thanks?

Upvotes: 1

Views: 312

Answers (2)

Dave Ray
Dave Ray

Reputation: 40005

(I also answered on the mailing list where you asked this)

The groupId in your deploy-file command is incorrect. It should be com.netflix.rxjava. Then in your project.clj, use [com.netflix.rxjava/rxjava-clojure "0.9.1-SNAPSHOT"] for your dependency. Also note that you'll need to do the same with rxjava.core.

Upvotes: 2

Arthur Ulfeldt
Arthur Ulfeldt

Reputation: 91617

from the rxjava project directory run

mvn install

to install the jars to your system's local maven repo.
from your Clojure project's directory add 0.9.1-SNAPSHOT as a dependency and then

lein deps :tree

and make sure you see the correct version used.

Upvotes: 1

Related Questions