首页 > 解决方案 > lein 尝试下载工件,即使它存在于本地

问题描述

lein run导致以下错误:

Could not find artifact foo:common:jar:10.11.0 in central (https://repo1.maven.org/maven2/)                                                                                            
Could not find artifact foo:common:jar:10.11.0 in clojars (https://clojars.org/repo/)

但是,在我的计算机上,该文件~/.m2/repository/foo/common/10.11.0/common-10.11.0.jar存在。似乎 lein 正在尝试从 central 和 clojars 下载该文件,即使它已经存在于我的计算机上。

这个特定的 jar 不存在于 maven central 或 clojars 中,它存在于一个私有存储库中,我只有在某个网络上时才能访问它。我现在不在那个网络上,所以如果lein不尝试下载我的计算机上已经存在的文件,它会非常有帮助。

有谁知道如何解决这一问题?

更新

我得到了你可以lein在离线模式下运行的信息lein -o ...。这导致了以下错误: The repository system is offline but the artifact foo:common:jar:10.11.0 is not available in the local repository.

标签: mavenclojureleiningen

解决方案


以上听起来不错。另请参阅以下内容,您可能希望绕过整个 maven jar 机制并将 jar 放入./resources(至少暂时):

leiningen - 如何为本地 jar 添加依赖项?

仔细注意资源字符串的所需格式!

(defproject test-project "0.1.0-SNAPSHOT"
:description "Blah blah blah"
...
:resource-paths ["resources/Siebel.jar" "resources/SiebelJI_enu.jar"])

另请参阅该链接中另一个答案中进行本地 maven 安装的选项:

mvn deploy:deploy-file -Dfile=jaad-0.8.3.jar -DartifactId=jaad -Dversion=0.8.3 -DgroupId=jaad -Dpackaging=jar -Durl=file:maven_repository

推荐阅读