Maven 本地存储库与 leiningen 的依赖关系
我正在 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 (.toURI (java.io.File. "maven-repo")))}
和 [local/goose "2.1 .6"]
在:依赖项
中。现在,当我执行 lein deps 时,我将 goose-2.1.6.jar 文件添加到 lib 目录中,但没有添加 goose 的依赖项。它们列在鹅的 pom.xml
文件中。
除了在我的 project.clj
中列出 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
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 lein-localrepo 代替冗长的 mvn 命令:
https://github.com/kumarshantanu/lein-localrepo
像这样安装:
lein localrepo 坐标目标/goose-2.1.6.jar | xargs lein localrepo install
但是,仅此并不能帮助在存储库中安装 POM 文件。您还应该运行以下命令:
cp pom.xml ~/.m2/repository/goose/goose/2.1.6/goose-2.1.6.pom
请注意,在此示例中 Goose 将安装为 <代码>groupId=goose,
artifactId=goose
。如果您愿意,您可以覆盖它,也许您应该这样做。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.