Project-level Leiningen Plugin

前端 未结 2 1067
有刺的猬
有刺的猬 2021-02-14 05:26

In Leiningen versions 1.x.x I was able to define a lein foo task valid only in a single project by putting the following in that project\'s project.clj

相关标签:
2条回答
  • 2021-02-14 05:52

    The short answer is "no", but it is still fairly easy to define a project level task: Add :eval-in-leiningen true to your defproject definition and move the task definition to src/leiningen/foo.clj.

    0 讨论(0)
  • 2021-02-14 05:52

    You can do this by using .lein-classpath to point to a directory outside of src containing the tasks. For example, if you have the plugin in src/leiningen/foo.clj, you can do, at the project root:

    $ mkdir tasks
    $ mv src/leiningen tasks/
    $ echo tasks > .lein-classpath
    

    The reason you might want to avoid :eval-in-leiningen true is that it has some funny behaviors when you're trying to do AOT compilation for a main class. Specifically, you get:

    Compilation failed: java.io.IOException: No such file or directory, compiling:(testproj/core.clj:1)
    

    When trying to compile/run a even a simple test example. More information at:

    https://github.com/technomancy/leiningen/issues/769

    0 讨论(0)
提交回复
热议问题