Thanks Stuart, That's a good simplification, and everything seem kosher in terms of loading from the REPL. I would like to structure my libs (package1, package2 in the example) such that they span multiple files. So the main file for the namespace/lib still needs to have "load" operations to get the other files for that namespace (clojure/core.clj does this, for example).
It works for "require" and for calling functions in the package(s), but the problem now is that it doesn't work for AOT from the REPL. (compile 'package1) crashes with: java.io.IOException: No such file or directory (package.clj:4) Where line 4 is the first "load" operation (and the load works fine if I execute it directly). If I remove the load operation altogether as a test (making a single-file package), now I get: java.io.IOException: No such file or directory (NO_SOURCE_FILE:0) As far as I can tell, this is now identical to the example that Rich gave in one of the two threads that I referenced in my earlier post. I'm not really sure how go about tracing "NO_SOURCE_FILE:0"... -Greg On Jan 6, 7:56 pm, Stuart Sierra <the.stuart.sie...@gmail.com> wrote: > Hi Greg, > I think you may be working at too low a level with "load". You should > be able to accomplish the same thing with: > > (ns my-app > (:require package1 package2)) > > (package2/start-app) > > my_app, package1, and package2 all need to be immediately under a > directory (or JAR file) on the Java classpath. Also check out the Ant > build.xml files from Clojure core and clojure-contrib. > > -Stuart Sierra > > On Jan 6, 1:11 pm, Greg Harman <ghar...@gmail.com> wrote: > > > Hi all, > > > I'm struggling a bit with how best to organize and bootstrap a > > multiple-source file project so that it can be run either command-line > > (java -cp clojure.jar:myapp.jar ...) or by running a load method from > > the REPL without having to explicitly change the classpath in my > > user.clj before running. > > > Currently my file structure looks like this: > > > /bootstrap.clj > > /package1/foo.clj > > /package2/bar.clj > > > And bootstrap.clj looks something like: > > > (def *namespaces* > > '("package1/foo" "package2/bar")) > > > (defn load [] > > (for [namespace *namespaces*] > > (load namespace))) > > > This seems to work sometimes, if my REPL's "working directory" is / > > (relative to my project), but not if it's anything else (get a > > java.io.FileNotFoundException). > > > So, I guess my question is: is this whole approach silly and is there > > a better way to bootstrap a multiple file/package project? If not, how > > best to tweak this? > > > -Greg --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---