Thanks Gary. With this I'm able to get :use to work correctly -- FWIW the part 
I wasn't getting right (again :-() was the association between the namespace 
names and the directory structure. In the context of your example I was doing 
something like (ns core ...) rather than (ns overtone-test.core ...), for a 
file in the same location. I now see that I can name it just core (or whatever 
I want) if I put it up one level, just in src/ rather than in 
src/overtone-test. FWIW I've been down a similar path and figured out something 
about the namespace/directory structure mapping before, in the context of some 
other tools, but forgot... I guess I still don't find this very intuitive.

One thing that I'd like to know more about: when you say "Start a JVM in this 
directory with the classpath set to contain and files in src or lib" I'm not 
100% sure that I know how you mean to do that. I am starting a JVM in that 
directory by saying "cake swank", and this seems to work now that I have the 
namespace names and file locations matched up. But how? Is the classpath being 
set to contain files in src and lib automatically by cake? Where does one 
specify this? It's not in my project.clj or anywhere else that I see. So even 
though it's currently working it still seems mysterious.

BTW also I still can't seem to get "load" to work... it never seems to find the 
files.... I'd sort of like to know how to do that, to help dispel more of the 
foggy classpath mysteries, but I guess that now that I can get :use to work I 
can have a reasonable workflow one way or another.

 -Lee


On Jun 24, 2011, at 4:11 PM, lambdatronic wrote:

> The way that cake and lein behave is generally this:
> 
> 1) Search up the file tree starting from the directory in which cake
> or lein is called until a project.clj file is encountered.  Consider
> this to be the project root.
> 
> 2) Start a JVM in this directory with the classpath set to contain any
> files in src or lib.
> 
> When you are starting a new library, place it under the src directory
> of your project.  Then give it a namespace name in the ns form that
> corresponds to its position beneath src, using . as a directory
> separator.
> 
> So if your project file tree looks like this:
> 
> |-- LICENSE
> |-- build
> |-- classes
> |-- lib
> |   |-- byte-spec-0.2.0-20100821.141701-1.jar
> |   |-- clojure-1.2.0.jar
> |   |-- clojure-contrib-1.2.0.jar
> |   |-- deps.clj
> |   |-- java-osc-cvs-20100502.112537-4.jar
> |   |-- jna-3.2.4.jar
> |   |-- midi-clj-0.2.0-20100821.141701-1.jar
> |   |-- miglayout-3.7.3.1.jar
> |   |-- osc-clj-0.3.0-20101217.045604-1.jar
> |   |-- overtone-0.1.5.jar
> |   |-- scsynth-jna-0.1.2-20100502.112537-1.jar
> |   `-- vijual-0.2.1.jar
> |-- pom.xml
> |-- project.clj
> |-- src
> |   `-- overtone_test
> |       `-- core.clj
> `-- test
> 
> Then your core.clj file should begin with an ns form like this:
> 
> (ns overtone-test.core
>  (:use [overtone.live]
>        [overtone.inst.synth]))
> 
> At compile-time, the Clojure compiler will look for your libraries
> beneath your classpath (as established by lein or cake in the way I
> described above) with names like overtone/live.clj and overtone/inst/
> synth.clj.
> 
>  And that, as they say, is that.
>    ~Gary

-- 
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

Reply via email to