Adding JDBC drivers to Clojars

316 views
Skip to first unread message

Eddie

unread,
Sep 23, 2016, 10:36:45 AM9/23/16
to Clojure
I have a Clojure project that require the use of the Vertica JDBC driver. When I search for "Vertica" on clojars I see two results. The first (org.clojars.prepor/vertica-jdbc) is a version of the driver that is older than the one I need to use. The second (org.clojars.erp12/jdbc-vertica) is a failed attempt by me to put the jar up there myself.

When trying to host the jar myself I attempted to follow this guide. Unfortunately, I have never used Maven before and ended up building a jar that gave this warning while buildings/deploying:

[WARNING] JAR will be empty - no content was marked for inclusion!

Before building/deploying the jar, I used this page to try and install the jdbc Vertica driver jar to the repo, but I am clearly missing something. I have tried searching around, but it is hard to figure out what where my problems are between Clojars, my maven settings, my local maven project, the vertica jar and being new to all of this (despite being a Clojure developer for years now).

Doe anyone know of some resources to learn how to upload jars to Clojars that weren't developed in Clojure. Is this even possible? Does anyone have any guesses as to how the older org.clojars.prepor/vertica-jdbc was uploaded? Any help is much appreciated. Thanks.

 

Walter van der Laan

unread,
Sep 23, 2016, 11:02:07 AM9/23/16
to Clojure
There is no need to push jdbc drivers to clojars.

I have never used Vertica but perhaps it helps if I show you how to add the two jdbc-drivers that I do use.


Example 1; postgres

The details for the postgres-driver can be found here: http://mvnrepository.com/artifact/org.postgresql/postgresql


This translates to this dependency in my project.clj: [org.postgresql/postgresql "9.4.1211"]


Example 2; h2

The details for the h2-driver can be found here: http://h2database.com/html/download.html


This translates to this dependency in my project.clj: [com.h2database/h2 "1.3.176"]

Eddie

unread,
Sep 23, 2016, 11:19:10 AM9/23/16
to Clojure
Thanks for the reply. 

I was under the impression that the jdbc driver (or any jar you want to use as a dependency) needs to be hosted on some kind of maven repository. Am I wrong about that?

Here is the official download link for the Vertica jdbc driver: https://my.vertica.com/client_drivers/7.2.x/7.2.3-0/vertica-jdbc-7.2.3-0.jar
As far as I can tell, it isn't in a maven repository. Is there still a way to tell lein to look at this address to pull the jar?

Thanks! 

Sean Corfield

unread,
Sep 23, 2016, 11:58:39 AM9/23/16
to Clojure Mailing List

Some JDBC drivers are not available in public Maven-style repositories (such as Microsoft’s Type 4 SQL Server JDBC driver) and that’s usually because there are restrictions on distribution, preventing third party sites from hosting them legally.

 

I searched Maven and you seem to be correct that Vertica does not have its drivers there. Check their licensing agreements because I doubt you could legally put them up on Clojars.

 

If you only need the driver locally for a project you are working on, then download the JAR and use lein-localrepo to put it into your local Maven repository cache (in ~/.m2).

 

If you need to share the driver with colleagues at work, then you’ll either have to have your colleagues do the same (and your build server), or you’ll need a private repository for work.

 

The latter is relatively easy. We run Archiva on an internal server at work and all our builds access it from there (just adding the URL to that repository to our build.boot files – Leiningen also supports this). Or, if you have a private S3 account, you could host it there via S3 Wagon.

 

Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

Eddie

unread,
Sep 23, 2016, 12:02:09 PM9/23/16
to Clojure
Good to know! Thanks for the info on the alternatives. I have used lein-localrepo before, but was hoping for something that could be more easily shared with others. Looks like it is still the best course.

Thanks!

Francis Avila

unread,
Sep 23, 2016, 12:03:26 PM9/23/16
to Clojure
Leinigen uses maven repos to satisfy project clj dependencies, but there is nothing stopping you from putting your jar directly on the classpath. The idiom for local jars is to put them in "libs/". In this case you do not mention this dependency in your project.clj, but the jar will be on the classpath at runtime

If you still want project.clj to mention the dep but do not want to host the jar somewhere, you can make a local maven repository in your project itself (checked-in), and tell leinigen to use it. This stackoverflow answer describes that process: http://stackoverflow.com/a/9917149/1002469

If you really want to host the jar on a remote, non-private repo, use the full 4-arg form of the lein deploy command. See "lein help deploy" However, make sure this HP even lets you redistribute its jar in this way!
Reply all
Reply to author
Forward
0 new messages