如何在leiningen项目中打包资源 [英] how to package resources in a leiningen project

查看:218
本文介绍了如何在leiningen项目中打包资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在示例项目中,

https://github.com/technomancy/leiningen/blob/master/sample.project.clj

line 217 ,有一个包含非代码文件的指令:

on line 217, there is a directive for including non-code files :

:resource-paths ["src/main/resource"] ; non-code files included in classpath/jar

我有一个 code>我的项目中的文件夹和我的project.clj中的这一行

I have a resources folder in my project and this line in my project.clj

:resource-paths ["resources"] ; non-code files included in classpath/jar


$ b jar
生成 .jar 文件,它不打包资源文件夹。

however, when I run lein jar to generate the .jar file, it does not package up the resources folder.

有没有什么我缺少的?

推荐答案

它确实得到包装。我只是不在正确的地方:

Actually, it did get packaged. I just was not looking in the right spot:

从:
Clojure应用程序中的资源


'Leiningen从maven中借用资源约定,文件夹布局稍有不同。规则规定resources文件夹必须用作编译时类classpath根,意味着leiningen是正确的将所有文件放在jar文件夹根目录下的resources文件夹中。'

'Leiningen borrows the convention for resources from maven, with slightly different folder layouts. The rule states that the resources folder must be used as a compile time classpath root, meaning that leiningen is right in putting all the files inside resources folder in the root location inside the jar.'

我认为一个资源目录会用jar本身创建,但 lein jar 将resources目录中的所有文件复制到

I thought that a resources directory would get created with the jar itself but lein jar copied all the files in the resources directory to the root of the jar.

这篇关于如何在leiningen项目中打包资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆