如何使用签入的瓶子与leiningen [英] How do I use checked-in jars with leiningen

查看:161
本文介绍了如何使用签入的瓶子与leiningen的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一些第三方罐子签到我们的项目。我们想将它们添加到类路径。而已。我们不想建立一个本地Maven仓库(因为这将打破我们的检查和运行的哲学)。每个开发人员必须设置自己的maven仓库,不同于项目。

We have some 3rd-party jars checked-in to our project. We'd like to add them to the classpath. That's it. We don't want to set up a local maven repo (because that would break our 'check out and run' philosophy). Each developer would have to set up their own maven repo, distinct from the project.

有办法做到这一点吗?我看到的大多数答案说,我们建立一个本地的maven,我们不想要或只需要添加一个jar到类路径。

Is there a way to do this or is this? Most of the answers I've seen say to set up a local maven which we don't want or need just to add a jar to a classpath.

推荐答案

您将需要设置一个本地maven存储库,但它可以是一个简单的目录,在您的项目目录,然后签入源控件。

You will need to setup a local maven repository, but that can be a simple directory, in your project directory, that you then check in to source control. (Which will maintain your 'check out and run' policy)

从Leiningen 2.2.0开始,部署jars的功能内置了lein deploy 任务。

As of Leiningen 2.2.0 the functionality to deploy jars is built-in with the lein deploy task. So, the task has simplified from previous versions.

在您的项目中创建一个目录,在这个例子中, myrepo 。 (名称是任意的)

Create a directory inside your project called, in this example, myrepo. (The name is arbitrary)

project.clj中添加:repositories

:repositories [["localrepo1" "file:myrepo"]]

将您的免费浮动jar部署到仓库。

Deploy your free floating jar to the repo.

lein deploy localrepo1 com.blueant/fancypants 1.0.1 fancypants.jar

然后,将您的依赖关系添加到您的project.clj :dependencies 向量中。

And, add your dependency to your project.clj :dependencies vector as normal.

:dependencies [[com.blueant/fancypants "1.0.1"]]

部署任务将生成所需的校验和和目录结构,以适应lein依赖性解析。您可以使用 lein deps:tree 命令验证您的jar是否正确加载。

The deploy task will generate the checksums and directory structure required to to tie into the lein dependency resolution. You can verify your jar is loaded correctly with the lein deps :tree command.

注意: / strong> :repositories 中的文件路径格式化为URL。因此, / Users / user1 / Desktop file:/// Users / user1 / Desktop 项目中的目录, myrepo 文件:myrepo

Note: File paths in :repositories are formatted as URLs. So, /Users/user1/Desktop is file:///Users/user1/Desktop, and, a local directory within the project, myrepo is file:myrepo.

这篇关于如何使用签入的瓶子与leiningen的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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