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



On Jun 23, 7:55 pm, Lee Spector <lspec...@hampshire.edu> wrote:
> I wrote (below) about being unable to get "load" to work from the slime repl 
> after completing the emacs/cake/swank/slime setup that Sam presented in 
> helpful video.
>
> Now I think it's a more general problem of not setting the classpath 
> correctly. If I try to :use something in the ns form in a file, for which I 
> have a .clj file in the same directory as the core.clj that cake created, 
> then when I evaluate the buffer in emacs the required file is not found.
>
> How and where do I set up the classpath so that this will work (using 
> emacs/cake/swank/slime)? If possible I'd like to set it up so that it always 
> finds anything anywhere in the cake project directory, including .clj files 
> in src/.
>
> Thanks,
>
>  -Lee
>
>
>
>
>
>
>
> >> On Jun 21, 11:09 pm, Lee Spector <lspec...@hampshire.edu> wrote:
> >>> On Jun 16, 2011, at 11:16 AM, Sam Aaron wrote:
>
> >>>> I just finished making a screencast primarily for new Overtone users on 
> >>>> how to get set up with Emacs as a primary editor:
>
> >>>>http://vimeo.com/25190186
>
> >>> - I also can't get (load "core"), or any variant that I could think of, 
> >>> when typed in the REPL to find the file. When I look at the classpath 
> >>> with (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))) I see 
> >>> some of my project's files there, so it "knows" about the project, but it 
> >>> doesn't find my file in the src directory that cake created.

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