Thanks, I'll fix reported those problems, soon :-) Thanks!
On 12월13일, 오전7시31분, Rob Wolfe <r...@smsnet.pl> wrote: > Mike K <mbk.li...@gmail.com> writes: > > All, > > > I tried to use this script on Windows and it blew up real good! I'm a > > Clojure, Java, and Leiningen newbie, so perhaps a kind soul can help > > me out. > > > 1. lein self-install "worked". It downloaded leiningen-1.0.0- > > standalone.jar. However, that contradicts the description at > >http://zef.me/2470/building-clojure-projects-with-leiningenwhich > > indicates that self-install should download several jars, including > > clojure itself. That didn't happen, and it looks like it would never > > happen according to the python script. Also, I'd rather use one and > > only one clojure, clojure-contrib, etc. for everything rather than > > Leiningen using its own. Is this possible? > > As you have already found out you need only standalone leiningen jar, > which is downloaded by "lein.py". > > > > > > > 2. Any other lein command seems to require the clojure jar in the > > repository ~/.m2/repository/org/clojure/clojure/1.1.0-alpha-SNAPSHOT/ > > clojure-1.1.0-alpha-SNAPSHOT.jar. Since I don't have one there, I > > modified CLOJURE_JAR to point to my existing jar. Everything still > > fails with this sort of error: > > > lein help > > java.lang.NoClassDefFoundError: Files > > Caused by: java.lang.ClassNotFoundException: Files > > at java.net.URLClassLoader$1.run(URLClassLoader.java:200) > > at java.security.AccessController.doPrivileged(Native Method) > > at java.net.URLClassLoader.findClass(URLClassLoader.java:188) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:303) > > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:248) > > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316) > > Could not find the main class: Files. Program will exit. > > Exception in thread "main" > > > I suspect the suspicious "Files" class name is coming from the fact > > that I now have CLOJURE_JAR set as follows: > > > CLOJURE_JAR = expanduser("C:\\Program Files (x86)\\Clojure Box\\clojure > > \\clojure-1.0.0.jar") > > > Looks like I'm getting bit by spaces in the path name. This would not > > be an issue if lein had downloaded its own clojure jar during step 1 > > (no spaces in that path). > > Yes, there are some escaping problems on Windows. I changed a little bit > "lein.py" and this worked for me on Windows and Linux: > > <lein.py> > #!/usr/bin/env python > > import sys > from glob import glob > from os import makedirs, system, getenv > from os.path import expanduser, dirname, exists > from urllib import urlretrieve > > ### inits > > VERSION = "1.0.0" > > if sys.platform == "win32": > CP_SEP = ";" > else: > CP_SEP = ":" > > LEIN_JAR = > expanduser("~/.m2/repository/leiningen/leiningen/%s/leiningen-%s-standalone > .jar" % (VERSION, VERSION)) > > CLOJURE_JAR = > expanduser("~/.m2/repository/org/clojure/clojure/1.1.0-alpha-SNAPSHOT/cloju > re-1.1.0-alpha-SNAPSHOT.jar") > > CPS = glob("lib/*") > > LEIN_URL = "http://repo.technomancy.us/leiningen-%s-standalone.jar"; % > (VERSION) > > # leiningen installation checks > > LEIN_BIN_DIR = dirname(sys.argv[0]) > > if exists(LEIN_BIN_DIR + "../src/leiningen/core.clj"): > # running from source-checkout > LEIN_LIBS = glob(LEIN_BIN_DIR + "/*") > CLASSPATH = CPS + [LEIN_LIBS] > if len(LEIN_LIBS) < 1 and sys.argv[1] != 'self-install': > print "Your Leiningen development checkout is missing its > dependencies." > print "Please download a stable version of Leiningen to fetch the > deps." > print "See the \"Hacking\" section of the readme for details." > exit(1) > else: > # not running from a checkout > CLASSPATH = CPS + [LEIN_JAR] > if not exists(LEIN_JAR) and sys.argv[1] != 'self-install': > print "Leiningen is not installed. Please run \"lein self-install\"." > exit(1) > > if getenv("DEBUG"): > print CP_SEP.join(CLASSPATH) > > ### defs > > def quote_cp(cp): > return CP_SEP.join("\"%s\"" % p for p in cp) > > def download_lein_jar(): > # TODO: wget / curl? > print("downloading %s -> %s ..." % (LEIN_URL, LEIN_JAR)), > sys.stdout.flush() > LEIN_JAR_DIR = dirname(LEIN_JAR) > if not exists(LEIN_JAR_DIR): > makedirs(LEIN_JAR_DIR) > # 'urlretrieve' is incrediblly slow! but it is portable anyway... > urlretrieve(LEIN_URL, LEIN_JAR) > print("done") > > def start_repl(argv): > # TODO: rlwrap? > cp = ['src', 'classes'] + CLASSPATH > CMD = 'java -cp %s clojure.main %s' % (quote_cp(cp), " ".join(argv)) > system(CMD) > > def run_leiningen(argv): > def escape_arg(s): > return s.replace("\\", "\\\\").replace("\"", "\\\"") > > ARGS = " ".join([ '"' + escape_arg(s) + '"' for s in argv ]) > CMD = "java -Xbootclasspath/a:%s -client -cp %s clojure.main -e \"(use > 'leiningen.core) (-main \\\"%s\\\")\"" \ > % (quote_cp([CLOJURE_JAR]), quote_cp(CLASSPATH), ARGS) > system(CMD) > > ### main > > if __name__ == '__main__': > if len(sys.argv) > 1 and sys.argv[1] == 'self-install': > download_lein_jar() > elif len(sys.argv) > 1 and sys.argv[1] == 'repl': > start_repl(sys.argv[2:]) > else: > run_leiningen(sys.argv[1:]) > > ### EOF > </lein.py> > > > > > 3. My clojure jar is clojure-1.0.0.jar from clojure org. The script > > uses clojure-1.1.0-alpha-SNAPSHOT.jar, but a comment from the link > > implies that this has been supplanted by 1.1.0-master.jar. In any > > event, I don't know where either of these two things are. I tried > > going to build.clojure.org, but all the build artifiacts there are > > named clojure.jar. > > > 4. BTW, what's the deal with this ".m2" directory (i.e., where does > > the name come from)? > > It comes from maven world:http://maven.apache.org/ > > > > > Thanks for any help you can provide! > > > Mike > > HTH, > Rob -- 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