lein uberjar没有将jar下的jar文件打包到最终的jar中

lein uberjar没有将jar下的jar文件打包到最终的jar中

问题描述:

我定义:profile.clj中的resource-paths包含一些特殊的jar(vertica jdbc)文件。然后我运行lein uberjar:尝试打包该jar文件到独立的jar文件,但在我运行它,并解压缩它,我找不到vertica jdbc文件。

I defined :resource-paths in profile.clj to include some special jar (vertica jdbc) file. and then I run lein uberjar: trying to pack that jar file into the standalone jar file, but after I run it, and uncompressed it, I can't find that vertica jdbc file.

Lein可以创建jar文件,但是它选择的唯一的地方是你的maven仓库(在 .m2 目录)。一旦您的特殊jar 在maven中,您需要在 project.clj 文件中将其引用为依赖项。

Lein can create jar files, but the only place it picks them up from is your maven repository (under an .m2 directory on your machine). Once your special jar is in maven you need to refer to it as a dependency in your project.clj file.

如果你的jar文件在clojars这将是很容易 - 只是放在一个依赖 - lein将它提取到你的maven仓库。另一方面,如果它是你自己的源代码,你首先需要从该源代码项目的目录中 lein install

If your jar file was in clojars this would be quite easy - just put in a dependency - lein will fetch it into your maven repository. On the other hand if it was your own source code you would first need to lein install from the directory of that source code project.

但是我猜你的文件只是一个jar文件,你不是clojars中的工件。在这种情况下,您可以使用此maven命令将其安装到您的maven存储库:

However I'm guessing your file is just a jar file you have, which is not an artifact in clojars. In this case you can install it into your maven repository using this maven command:

mvn install:install-file -Dfile=./my-deps.jar -DgroupId=my-deps -DartifactId=my-deps -Dversion=1.0.0 -Dpackaging=jar

然后,您可以在 uberjar项目中引用它作为依赖项,然后在 lein uberjar 中引用它。

You can then refer to it as a dependency in the uberjar project, and then lein uberjar.