25 August 2012

Adding jars to local repository with Leiningen

Last night I thought I should experiment a little with Enlive, an html library written in Clojure. Enlive makes it very easy to scrape web-pages, apparently.
However, I could not find a jar for Enlive in the central Maven repository, neither was there one in Clojars. I did find some that other people had built, but I never trust strangers on the net. ;) So I figured I should build it myself and put it in my local Maven repository. This is how I did it:

First clone the repository from Github

git clone https://github.com/cgrand/enlive.git
Then build it with Leiningen

cd enlive
lein install
Now, this install the pom-file to my local repository, but it won't put the jar in the repository. At this point I was contemplating using Maven to install the jar, or even manually renaming and copying the jar to the correct folder in the repository but I thought that surely Leiningen must have a way to do this.

So I found a plugin to do it. Shantanu Kumar has made a plugin (lein-localrepo) for exactly this purpose. I am using Leiningen 2 so I added lein-localrepo to my ~/.lein/profiles.clj:

{:user {:plugins [[lein-localrepo "0.4.0"]]}}
After that I could use the handy coords command pointed at my generated jar to find Maven coordinates for the jar and pipe them into the install command to put the jar at the correct position in my local repository.

> lein localrepo coords target/enlive-1.0.1.jar
target/enlive-1.0.1.jar enlive/enlive 1.0.1

> lein localrepo coords target/enlive-1.0.1.jar | xargs lein localrepo install

WARNING: using numeric exit values in plugins is deprecated.
Plugins should use leiningen.core.main/abort instead.
Support for this will be removed before the stable 2.0.0 release.
localrepo failed.
I do get an error message, but the install command completed successfully anyway. Now on to scraping some web pages.

31 comments:

  1. I already somehow experimented in this way!))) That then I could not open any jar file! I had to immediately seek a solution on the Internet. Thank God, that I found a good website, with the help of which I managed to open jar file https://wikiext.com/jar. After that I decided, that I will no longer be so experiment!)))

    ReplyDelete
  2. This is a good post. This post give truly quality information. I’m definitely going to look into it. Really very useful tips are provided here. thank you so much. Keep up the good works.
    python Online training in chennai
    python Online training in bangalore
    python interview question and answers

    ReplyDelete
  3. Some us know all relating to the compelling medium you present powerful steps on this blog and therefore strongly encourage contribution from other ones on this subject while our own child is truly discovering a great deal. Have fun with the remaining portion of the year.
    Data Science Training in Chennai
    Data Science course in anna nagar
    Data Science course in chennai
    Data science course in Bangalore
    Data Science course in marathahalli

    ReplyDelete
  4. Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
    rpa training in bangalore
    best rpa training in bangalore
    rpa training in pune | rpa course in bangalore
    rpa training in chennai

    ReplyDelete
  5. Some us know all relating to the compelling medium you present powerful steps on this blog and therefore strongly encourage contribution from other ones on this subject while our own child is truly discovering a great deal. Have fun with the remaining portion of the year.
    hadoop training in chennai

    hadoop training in omr

    salesforce training in chennai

    salesforce training in omr

    c and c plus plus course in chennai

    c and c plus plus course in omr

    machine learning training in chennai

    machine learning training in omr

    ReplyDelete
  6. Wow what a Great Information about World Day its exceptionally pleasant educational post. a debt of gratitude is in order for the post.
    data science course in India

    ReplyDelete
  7. Thank you for sharing your info. I really appreciate your efforts and I am waiting for your next post thank you once again.
    AWS certification course in Chennai

    ReplyDelete
  8. First of all, download Adobe XD CC Crack. · Extract the archive using Winrar software on your PC. · Run the setup.exe file from the extracted files. · Continue .Adobe XD Crack Version

    ReplyDelete
  9. Better Half Wife Birthday Card - Birthday Wishes For Better Half Wife, HD Png Download is free transparent png image. To explore more similar hd image on .Birthday Beautiful Quotes

    ReplyDelete
  10. Little says that some people will argue that certain candle colors work best for certain needs. “Brown is great for grounding, green is great .How-To-Manifest-With-Candles/

    ReplyDelete