Search code examples
clojureleiningen

Is there an equivalent in Leiningen to `clj -m`


Is there an equivalent in Leiningen to this clj command :

clj -m project.core

Looks like if I use Leiningen I need to create project.clj before I could run it with

lein run -m project.core

Could I run it without creating project.clj ?

*Example of the project which doesn't have project.clj file: https://github.com/mogenslund/microliquid


Solution

  • This does not appear to be possible. I've tried running commands like

    lein run -m test/-main
    

    And I get errors that suggest it can't find a main. Looking through lein help, pretty much everything, including things like lein clean, throw errors if a project.clj isn't found.

    In the tutorial for leiningen is the chunk:

    Leiningen works with projects. A project is a directory containing a group of Clojure (and possibly Java) source files, along with a bit of metadata about them. The metadata is stored in a file named project.clj in the project's root directory, which is how you tell Leiningen about things like

    ...

    Most Leiningen tasks only make sense in the context of a project. Some (for example, repl or help) can also be called from any directory.

    Emphasis mine.

    It seems leiningen is project focused, and is expecting the meta-data held in a project.clj to function.