6

Can anyone tell me some working dependencies to get up and running with zeromq and clojure?

I've tried several but leiningen isn't able to fetch them:

(Could not find artifact org.zmq:zmq:jar:2.1.0 in central (http://repo1.maven.org/maven2))

[org.zmq/zmq "2.1.0"] [org.zmq/jzmq "1.0.0"] 

I have compiled jzmq (/usr/local/share/java/jzmq.jar) and added this to my project.clj:

:native-path "/usr/local/lib" 

5 Answers 5

10

There's a 2.0-SNAPSHOT here:

Lein should already have the clojars repo loaded.

Sign up to request clarification or add additional context in comments.

Comments

2

What I propose is a mixture of what's already been proposed, but for the sake of completeness and hopefully to give a final answer I give it a try.

Since the dependency is not in the online repos I would include the jar(s) in the project's directory structure itself, e.g. in the directory repository and keep it in the source control system as the other files of the project. It's an important part of the project and without the dependency it won't run.

In this directory I would save the jar with the help of Maven Install plugin.

mvn install:install-file \ -Dfile=/usr/local/share/java/jzmq.jar \ -DgroupId=org.zeromq \ -DartifactId=jzmq \ -Dversion=2.1.0 \ -Dpackaging=jar \ -DlocalRepositoryPath=repository 

When the jar file gets copied to the local repository, you define it and the dependency in project.clj as follows:

(defproject clojure-interal-repo-test "0.1.0-SNAPSHOT" :dependencies [[org.clojure/clojure "1.4.0"] [org.zeromq/jzmq "2.1.0"]] :repositories [["zeromq-repository" {:url "file:repository" :snapshots false :checksum :ignore :update :never}]]) 

Within the project, run lein2 deps :tree to verify its correctness.

$ lein2 deps :tree Retrieving org/zeromq/jzmq/2.1.0/jzmq-2.1.0.jar (4k) from file:repository/ [org.clojure/clojure "1.4.0"] [org.zeromq/jzmq "2.1.0"] 

Please note that the 4k above is the size of a fake file I created to test it out.

Read the document Repeatability in Leiningen's wiki should you need a bit more.

1 Comment

Thanks, I got it working in the end. The important thing seemed to be adding /usr/bin/lib to java.library.path with :jvm-opts
2

The only way I could get it to work was to use jeromq.

[org.zeromq/jeromq "0.3.2"] 

Jeromq is native Java.

Comments

1

You can create a Maven local repository, install the compiled library into your local repo, and then, add the following to your project.clj

:repositories {"local" ~(str (.toURI (java.io.File. "your_local_repository_path")))} 

Similar question, I have answered earlier here

Comments

1

Unfortunately, ZeroMQ is not present in public repository, at least at the last time I checked (a month ago I think). So you have to install the jar manually:

mvn install:install-file -Dfile=/usr/local/share/java/jzmq.jar -DgroupId=org.zeromq \ -DartifactId=jzmq -Dversion=2.1.0 -Dpackaging=jar 

Then you can use the artifact as [org.zeromq/jzmq "2.1.0"] in your project.clj.

1 Comment

Still getting Could not find artifact org.zeromq:jzmq:jar:2.1.0 in central (repo1.maven.org/maven2) Could not find artifact org.zeromq:jzmq:jar:2.1.0 in clojars (clojars.org/repo) even though I see it in .m2/

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.