我定义:profile.clj中的资源路径包含一些特殊的jar(vertica jdbc)文件.然后我运行lein uberjar:尝试将该jar文件打包到独立的jar文件中,但是在我运行它并解压缩之后,我找不到vertica jdbc文件.
Leiningen可以创建jar文件,但它唯一可以选择它们的是你的maven存储库(在.m2你机器上的一个目录下).一旦你的特殊jar在maven中,你需要将它作为project.clj文件中的依赖项引用.
如果您的jar文件在clojars中,这将非常简单 - 只需放入依赖项 - lein会将其提取到您的maven存储库中.另一方面,如果它是您自己的源代码,您首先需要lein install从该源代码项目的目录中获取.
但是我猜你的文件只是一个jar文件,这不是clojars中的工件.在这种情况下,您可以使用此maven命令将其安装到maven存储库中(此处假设my-deps.jar您的文件为):
mvn install:install-file -Dfile=./my-deps.jar -DgroupId=my-deps -DartifactId=my-deps -Dversion=1.0.0 -Dpackaging=jar
Run Code Online (Sandbox Code Playgroud)
然后,您可以将其称为uberjar项目中的依赖项,然后lein uberjar.
编辑 - 如果你不想使用原始maven命令,那么考虑使用这个为你抽象出来的leiningen库:https://github.com/kumarshantanu/lein-localrepo.
小智 5
An alternative is to add to project.clj:
:repositories {"local" "file:lib"}
Create a lib directory in your project and add the jar there.
Add the lib reference in the :dependencies tag in project.clj.
This lib directory has the same structure as .m2/repository but is inside your project and local to your project
| 归档时间: |
|
| 查看次数: |
644 次 |
| 最近记录: |