Thanks. I didn’t even know that leinengen has plugins.
If tools.* is the language maintainers’ preferred method, I think there is value in having a single command to set up a “simple/default Clojure project” in a folder, even if that only cuts the commands down from four to one.
I don’t understand where that deps.edn comes from in a fresh project. It’d be great to have “clj create hello-world” build one for me in ./hello-world, use my running Clojure version as a dependency (if that’s how “clj” works), create the child src/ (and /test if that’s a best practice) folders, etc. The idea being to generate a local library on-demand with sane boilerplate defaults and almost no knowledge. I can learn later what Else I might need if I can get it up and running quickly first.
Leinengen looks easier to me for my admittedly trivial use cases, because I don’t need a library or plugins at all. And again, I might be in the minority. But if folks keep saying “lein handles 90% and is easier,” and if we can make tools.* handle those same 90% cases trivially, it seems worthwhile.
If you're using the latest (prerelease) version of the Clojure CLI:
# this is a one-off step to install the clj-new tool:
(! 646)-> clojure -Ttools install com.github.seancorfield/clj-new '{:git/tag "v1.1.324"}' :as new
Installed new
# now you can run it anywhere to create new app or lib projects:
(! 647)-> clojure -Tnew app :name myname/myapp
Generating a project called myapp based on the 'app' template.
(! 648)-> tree myapp
myapp
|____.gitignore
|____.hgignore
|____CHANGELOG.md
|____deps.edn
|____doc
| |____intro.md
|____LICENSE
|____pom.xml
|____README.md
|____resources
| |____.keep
|____src
| |____myname
| | |____myapp.clj
|____test
| |____myname
| | |____myapp_test.clj
This is already set up with testing and JAR building for you:
(! 649)-> cd myapp
(! 650)-> clojure -X:test
Running tests in #{"test"}
Testing myname.myapp-test
FAIL in (a-test) (myapp_test.clj:7)
FIXME, I fail.
expected: (= 0 1)
actual: (not (= 0 1))
Ran 1 tests containing 1 assertions.
1 failures, 0 errors.
(! 651)-> clojure -X:uberjar
[main] INFO hf.depstar.pom - Synchronizing pom.xml
Skipping paths: resources
[main] INFO hf.depstar.aot - Compiling myname.myapp ...
[main] INFO hf.depstar.uberjar - Building uber jar: ./myapp.jar
[main] INFO hf.depstar.uberjar - Processing pom.xml for {net.clojars.myname/myapp {:mvn/version "0.1.0-SNAPSHOT"}}
(! 652)-> java -jar myapp.jar
Hello, World!
If tools.* is the language maintainers’ preferred method, I think there is value in having a single command to set up a “simple/default Clojure project” in a folder, even if that only cuts the commands down from four to one.
I don’t understand where that deps.edn comes from in a fresh project. It’d be great to have “clj create hello-world” build one for me in ./hello-world, use my running Clojure version as a dependency (if that’s how “clj” works), create the child src/ (and /test if that’s a best practice) folders, etc. The idea being to generate a local library on-demand with sane boilerplate defaults and almost no knowledge. I can learn later what Else I might need if I can get it up and running quickly first.Leinengen looks easier to me for my admittedly trivial use cases, because I don’t need a library or plugins at all. And again, I might be in the minority. But if folks keep saying “lein handles 90% and is easier,” and if we can make tools.* handle those same 90% cases trivially, it seems worthwhile.