简体   繁体   English

Leiningen 1.3升级插件类路径

[英]Leiningen 1.3 Upgrade Plugin Classpath

I have a plugin that used to use command-line from contrib with the following in ns, 我有一个用于在ns中使用contrib命令行的插件,

(:use  [leiningen.compile :only [eval-in-project]]
       [clojure.contrib command-line logging])

that used to work, I am guessing since leiningen also uses clojure and contrib it is automatically on its classpath with the new contrib structure above becomes, 我猜这是可行的,因为leiningen也使用clojure和contrib,它自动在其类路径上与上面的新contrib结构成为,

(:use  [leiningen.compile :only [eval-in-project]]
       [clojure.tools cli logging])

it seems leiningen does not include jars from the lib/ on its class path and this fails, is there a workaround this? 似乎leiningen在其类路径中不包含来自lib /的jar,这会失败,是否有解决方法?

Right. 对。 Unless you use eval-in-project , your code runs in Leiningen's classpath. 除非使用eval-in-project ,否则代码将在Leiningen的类路径中运行。 Any code on lein's classpath is thus available to your project. 因此,您项目中可以使用lein的classpath上的任何代码。 These, however, are not. 但是,事实并非如此。

Is the code that uses cli and logging inside of the eval-in-project call? 使用cli并在eval-in-project调用中记录日志的代码吗? If so, those jars need to be dependencies on the projects that you call the plugin in, and the use call must be passed to eval-in-project (see the documentation of eval-in-project for more info). 如果是这样,则这些jar需要依赖于您在其中调用该插件的项目,并且必须将use调用传递给eval-in-project(有关更多信息,请参见eval-in-project的文档)。

If the code that uses cli and logging is not inside of an eval-in-project call, then you can add those dependencies to your plugin project and it should just work. 如果使用cli和日志记录的代码不在eval-in-project调用的内部,则可以将这些依赖项添加到插件项目中,并且它应该可以正常工作。 If you try to test the plugin inside of the plugin project itself, you'll need to add :eval-in-leiningen true to your project.clj. 如果您尝试在插件项目本身内部测试插件,则需要在项目中添加:eval-in-leiningen true

If this doesn't help, please expand your question with more details/code. 如果这样做没有帮助,请使用更多详细信息/代码扩展您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM