Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use library in maven repo for clojure project?

I use Leiningen to manage my CLJ project. When I want to wrap a Java library, I found that I have to introduce it to my project firstly.

How can I use a library in a Maven repo in my project?

like image 896
qiuxiafei Avatar asked Jul 11 '12 09:07

qiuxiafei


People also ask

How do I add dependencies to Clojure?

Edit project. clj and add the dependency (the vector of project-identifying info and version) to the :dependencies vector in project. clj. The dependency declaration looks like this: [seesaw "1.4.

What is Library in Maven?

Maven local repository is a folder location on your machine. It gets created when you run any maven command for the first time. Maven local repository keeps your project's all dependencies (library jars, plugin jars etc.).


1 Answers

You just need to add it to your project.clj dependencies as any other clojure lib. The small difference is that java libraries have a groupId apart from the artifactId. For example to import the active-mq library you will need to add to your :dependencies

[org.apache.activemq/activemq-core "5.5.0"] 

The first bit is the groupId, the second is the artifactId.

Also, if the library is not in the central maven repository, you will need to add the repository configuration to your project. For example, to add the sonatype snapshot repository:

:repositories {"sonartype snapshots" "https://oss.sonatype.org/content/repositories/snapshots"} 
like image 63
DanLebrero Avatar answered Sep 26 '22 23:09

DanLebrero