Laurent, that is outstanding. Thank you so much. Yup, I am working from the particular to the general here, so having a working example really makes a big difference. I must say that this is a really helpful community. Thanks evryone
Chris On Monday, October 21, 2013 7:15:38 AM UTC-5, Laurent PETIT wrote: > > Hello Christopher, > > I will try to address exactly your example, with Counterclockwise, and > hopefully you'll get the general view of how to do things on the go. > > So you want to instanciate a new namespace like this : > > (ns play.xml-example > (:require [clojure.zip :as zip] > [clojure.data.zip :as zf] > [clojure.xml :as xml]) > (:use clojure.data.zip.xml)) > > > Code be taken from examples on the web generally have a lot of > assumptions. Here, for instance, the assumption was that > clojure.data.zip namespace is already in the classpath, and for this > to happen, it should either be shipped with the clojure library (which > it isn't), or installed in the classpath via one of the declared > dependencies of your project. > > A small search of the String "clojure.data.zip" in Google directs me > to https://github.com/clojure/data.zip/ (2d search entry for me, but > this could vary for you) > This page is the README for project "clojure.data.zip", with a > "Releases and Dependency Information" section. > This section contains : > > Leiningen dependency information: > [org.clojure/data.zip "0.1.1"] > > There we are: you need the artifact named data.zip (member of the > artifacts group named org.clojure). Its current stable version is > 0.1.1. Those artifact id + group id + version are called "coordinates" > in Leiningen. Leiningen inherits this terminology from Maven > (http://www.apache.org) which is a Java project management / build > tools with which Leiningen shares the way to store / retrieve > "artifacts" from Internet. > > The easiest way to continue from here, if you already have Eclipse + > Counterclockwise installed, is to just create a new Clojure project by > following CCW's documentation for creating a new project ( > > https://github.com/laurentpetit/ccw/blob/master/doc/src/main/asciidoc/documentation.adoc#create-a-new-project > > ) > > In the `Package Explorer View` (by default opened on the left side of > the editors) you should see your project. > > Open the project's file `project.clj`, it should look like this: > > project.clj > ---- > (defproject foo "0.1.0-SNAPSHOT" > :description "FIXME: write description" > :url "http://example.com/FIXME" > :license {:name "Eclipse Public License" > :url "http://www.eclipse.org/legal/epl-v10.html"} > :dependencies [[org.clojure/clojure "1.5.1"]]) > ---- > > You should also see inside your project a node named `Leiningen > Dependencies`. If you expand it, you should see the clojure jar > (`clojure-1.5.1.jar`) > > Add the dependency for `clojure.data.zip` so that it then looks like this: > > project.clj > ---- > (defproject foo "0.1.0-SNAPSHOT" > :description "FIXME: write description" > :url "http://example.com/FIXME" > :license {:name "Eclipse Public License" > :url "http://www.eclipse.org/legal/epl-v10.html"} > :dependencies [[org.clojure/clojure "1.5.1"] > [org.clojure/data.zip "0.1.1"]]) ; <1> > ---- > > <1> Addition of the clojure.data.zip dependency > > Save the `project.clj` file. > > Eclipse will work a little bit in the background to fetch the > dependency from Internet (and the next times, from a hidden cached > location in `~/.m2/repository`). > And then you should see inside the `Leiningen Dependencies` project > node a new entry: `data.zip-0.1.1.jar` > > Now is time to start a REPL and play : in your project's contextual > menu, select `Run as > Clojure Application`. A REPL will open, you'll > be able to paste the namespace declaration into it ( Ctrl + Enter to > send for evaluation): > > ---- > ;; Clojure 1.5.1 > => (ns play.xml-example > (:require [clojure.zip :as zip] > [clojure.data.zip :as zf] > [clojure.xml :as xml]) > (:use clojure.data.zip.xml)) > nil > ---- > > HTH, > > -- > Laurent > > > > > 2013/10/18 Christopher Bird <seab...@gmail.com <javascript:>>: > > I know this is a pretty old thread, but my questions are quite > > similar/related, so I figured here would be a good place for them. > > > > I am seriously struggling with both the Eclipse/Kepler-CounterClockwise > > version in general and the command prompt versions of lein. > > My major issue is how to tell the environments which libraries, etc. to > > load. For example, one of the libraries I really want to use is the > whole > > zipper approach for dealing with xml. > > > > From this location http://grokbase.com/t/gg/clojure/11ccz70h0y/xml-zipI see > > the following code: > > > > (ns play.xml-example > > (:require [clojure.zip :as zip] > > [clojure.data.zip :as zf] > > [clojure.xml :as xml]) > > (:use clojure.data.zip.xml)) > > And this is what I get: > > > > C:\Users\Christopher Bird>lein repl > > nREPL server started on port 64784 on host 127.0.0.1 > > REPL-y 0.2.1 > > Clojure 1.5.1 > > Docs: (doc function-name-here) > > (find-doc "part-of-name-here") > > Source: (source function-name-here) > > Javadoc: (javadoc java-object-or-class-here) > > Exit: Control+D or (exit) or (quit) > > > > user=> (ns play.xml-example > > #_=> (:require [clojure.zip :as zip] > > #_=> [clojure.data.zip :as zf] > > #_=> [clojure.xml :as xml] > > #_=> ) > > #_=> (:use clojure.data.zip.xml)) > > > > FileNotFoundException Could not locate clojure/data/zip__init.class or > > clojure/data/zip.clj on classpath: clojure.lang > > .RT.load (RT.java:443) > > user=> > > So, clearly I need to get the libs onto the classpath. The questions > are > > what libs, where and how? > > > > Thanks in advance for any/all help > > > > Chris > > > > On Wednesday, September 7, 2011 2:09:01 PM UTC-5, Joseph Li wrote: > >> > >> hi all, > >> > >> I have a bare bone Clojure project created in Eclipse with > >> Counterclockwise plugin and am trying to (use clojure.java.jdbc). > >> I tried adding the jar file downloaded from Maven repo to the > >> project's build path but everytime it runs the (use) line from the > >> repl it will give a ClassNotFoundException. > >> > >> I ended up downloading the source and put it right there along with my > >> own but still have to fully qualify with the ns name to use anything > >> there. > >> > >> Is Maven/Leiningen pretty much the only way to obtain clojure lib > >> properly? > >> > >> Thanks, > >> Joseph > >> > > -- > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clo...@googlegroups.com<javascript:> > > Note that posts from new members are moderated - please be patient with > your > > first post. > > To unsubscribe from this group, send email to > > clojure+u...@googlegroups.com <javascript:> > > For more options, visit this group at > > http://groups.google.com/group/clojure?hl=en > > --- > > You received this message because you are subscribed to the Google > Groups > > "Clojure" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to clojure+u...@googlegroups.com <javascript:>. > > For more options, visit https://groups.google.com/groups/opt_out. > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.