I am no expert at this, but this is what I have done

1. lein new mytestprj
2. go into the newly created dir and edit the project.clj and rename
from 'leiningen' to mytestprj (I think this is why your jar was
getting named leiningen.jar).
3. then do a 'lein deps' to copy the required libs into the lib
directory
4. then do a lein install that installs mytestprj.jar.

I agree that it will be nice if lein was more like 'mvn
archetype:generate' and would ask all the required info and create but
its a new project so go easy on it ;-)

-Devender

On Dec 7, 6:05 am, B Smith-Mannschott <bsmith.o...@gmail.com> wrote:
> I'm finding the behavior of leiningen new to be broken. It looks like
> the initial implementation isn't clear about what exactly the project
> name given as argument to lein new denotes. I'd like to fix this, but
> before i hack on a patch, I'd be curious to know how this subcommand
> was intended to work in the first place.
>
> It seems like lein new really needs thee pieces of information:
>
> (1) what directory should be created to contain the project?
> (2) what should the project's name (artifactId) be?
> (3) what should the project's group (groupId) be?
>
> It seems like it's trying to synthesize this out of a single piece of
> information:a string which can't decide if it's #1 or #2 and that's
> not working. Also, the otherwise empty .clj file created by lein new
> seems to have a mangled ns declaration.
>
> // ben
>
> Please feel free to skip the rant that follows if the above is
> sufficiently clear.
>
> The documentation of lein new leaves me guessing:
>
> smit...@wesley:~/w/VJS-88$ lein help new
> Create a new project skeleton.
>
> Thus I consult the source.
>
> The Implementation of "lein new PROJECTNAME" uses mkdirs to make the
> directories for PROJECTNAME, so it stands to reason that PROJECTNAME
> can be a path, not just a simple name.
>
> ;; leiningen/new.clj
> (defn new [project-name & [args]]
>   (.mkdirs (file project-name))
>   ...
>
> Indeed, this appears to work, but doesn't since the clj file that's
> generated by default has a gibberish namespace:
>
> smit...@wesley:~/w/VJS-88$ lein new Foo/Bar
> Created new project: Foo/Bar
> smit...@wesley:~/w/VJS-88$ cat Foo/Bar/src/Foo/Bar.clj
> (ns Foo/Bar.core)
>
> So simple names it is:
>
> smit...@wesley:~/w/VJS-88$ lein new Foo
> Created new project: Foo/Bar
> smit...@wesley:~/w/VJS-88$ cat Foo/src/Foo.clj
> (ns Foo.core)
>
> But this still doesn't look right. Shouldn't the file be named
> Foo/src/Foo/core.clj if it's going to declare its namespace as
> Foo.core? How else will the classloader know where to find it?
>
> Ok, well, let's move on and build a jar.
>
> smit...@wesley:~/w/VJS-88/Foo$ lein jar
> [INFO] snapshot org.clojure:clojure:1.1.0-alpha-SNAPSHOT: checking for
> updates from internal
> [INFO] snapshot org.clojure:clojure-contrib:1.0-SNAPSHOT: checking for
> updates from internal
>      [copy] Copying 2 files to /home/smithma/w/VJS-88/Foo/lib
> smit...@wesley:~/w/VJS-88/Foo$ ls
> classes  leiningen.jar  lib  project.clj  README  src  test
>
> Oh. That's odd, the JAR is named leiningen.jar, despite the fact that
> I've told lein that my project is named Foo. (Remember we've already
> established that the argument to lein isn't primarily answering the
> question "where do I put the project" (otherwise it would not break
> when given a path). Therefore, the primary meaning of the argument
> might logically be "what should the project be called.") But, clearly
> that's not it, because the project just get's called "leiningen", no
> matter what I ask for on the command line.
>
> Now, to cut a long story short, it took me a while to figure out that
> I could use a name-space qualified symbol as the project name a-la:
> my.group.id/artifactId to get both a sane file jar file name out of
> "lein jar" and a sane install location from "lein install". Is this
> documented somewhere? I gleaned it from the source. (of course we
> can't do that from the command line because we've established that
> slashes in that context == broken).

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