使用leiningen的maven本地存储库中的依赖 [英] Dependencies in maven local repositories with leiningen

查看:280
本文介绍了使用leiningen的maven本地存储库中的依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始在clojure中创建 lein new 项目,并希望使用 goose 文章提取库。遗憾的是,我在任何公开的maven存储库中找不到该库的jar,所以我开始将它添加到本地maven存储库。



在项目目录,我复制了goose jar及其 pom.xml 文件并执行了

  mkdir maven-repo 
mvn install:install-file -Dfile = goose-2.1.6.jar -DartifactId = goose -Dversion = 2.1.6 \
-DgroupId = local -Dpackaging = jar - DlocalRepositoryPath = maven-repo -DpomFile = pom.xml

并将以下内容添加到 project.clj

 :repositories {local〜(str。 io.File。maven-repo))} 

local / goose2.1.6] :dependencies 。现在当我做一个 lein deps ,我得到goose-2.1.6.jar文件添加到lib目录,但不是依赖的鹅。它们列在goose的 pom.xml 文件中。



有没有办法goose的依赖项在我的 project.clj

解决方案

-localrepo而不是冗长的mvn命令:
https://github.com/kumarshantanu/lein-localrepo



安装方式如下:



lein localrepo coords target / goose-2.1.6 .jar | xargs lein localrepo install



然而,单单不会有助于在repo中安装POM文件。您还应该运行此操作:



cp pom.xml〜/ .m2 / repository / goose / goose / 2.1.6 / goose-2.1。注意,在这个例子中,Goose将安装为 groupId = goose artifactId = goose 。你可以覆盖它,如果你愿意,也许你应该。


I am starting lein new project in clojure and want to use the goose article extraction library. Unfortunately I couldn't find the jar of that library on any publicly available maven repository, so I set out to add it to a local maven repository.

In the project directory, I copied the goose jar and its pom.xml files and did

mkdir maven-repo
mvn install:install-file -Dfile=goose-2.1.6.jar -DartifactId=goose -Dversion=2.1.6 \
    -DgroupId=local -Dpackaging=jar -DlocalRepositoryPath=maven-repo -DpomFile=pom.xml

And added the following to project.clj

:repositories {"local" ~(str (.toURI (java.io.File. "maven-repo")))}

and [local/goose "2.1.6"] in :dependencies. Now when I do a lein deps, I get the goose-2.1.6.jar file added to lib directory, but not the dependencies of goose. They are listed in the goose's pom.xml file.

Is there a way I can fix this other than listing goose's dependencies in my project.clj?

解决方案

You can use lein-localrepo instead of the lengthy mvn command: https://github.com/kumarshantanu/lein-localrepo

Install like this:

lein localrepo coords target/goose-2.1.6.jar | xargs lein localrepo install

However, that alone will not help to install the POM file in the repo. You should additionally run this:

cp pom.xml ~/.m2/repository/goose/goose/2.1.6/goose-2.1.6.pom

Note that in this example Goose will be installed as groupId=goose, artifactId=goose. You can override that if you wish, and probably you should.

这篇关于使用leiningen的maven本地存储库中的依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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