项目级Leiningen插件 [英] Project-level Leiningen Plugin
问题描述
在Leiningen版本1.xx中,我能够定义一个 lein foo
任务仅在单个项目中有效,方法是在项目的 project.clj
:
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
:
(defproject tester "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.4.0"]])
;; Create a task, "foo"
(ns leiningen.foo
(:require (leiningen [uberjar :as uberjar])))
(defn foo [project & args]
(println "Do something here first, then make the uberjar.")
(uberjar/uberjar project))
您可以在这里获得更多相关信息:
You can get a little more information about this here:
http://nakkaya.com/2010/02/25/writing-leiningen-plugins-101/
在2.xx中,我不能这样做(即,我得到'foo'不是一个任务。
这似乎是方式,对我来说,overkill对于这个任务必须启动一个单独的项目。是否仍然可以在project.clj中为leiningen 2.xx定义一个任务
In 2.x.x, I'm not able to do this anymore (i.e., I get 'foo' is not a task.
It seems way, way overkill for me to have to start a separate project for this task. Is it still possible to define a task within project.clj for leiningen 2.x.x?
推荐答案
简短的回答是no,但是仍然很容易定义项目级别的任务:添加:eval-定义并将任务定义移动到
src / leiningen / foo.clj $
c $ c>。
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
.
这篇关于项目级Leiningen插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!