【问题标题】:Leiningen: working with local git repoLeiningen:使用本地 git repo
【发布时间】:2017-08-19 13:00:39
【问题描述】:

我想更改 incanter 中的某些内容,因此我在 github 上创建了一个 fork,并在我的笔记本电脑上对其进行了克隆。现在,当我尝试使用 lein test 运行测试时,出现以下错误:

/Users/me/work/incanter$ lein test
Could not find artifact incanter:incanter-core:jar:1.5.8-SNAPSHOT in clojars (https://clojars.org/repo/)
Could not find artifact incanter:incanter-io:jar:1.5.8-SNAPSHOT in clojars (https://clojars.org/repo/)
Could not find artifact incanter:incanter-charts:jar:1.5.8-SNAPSHOT in clojars (https://clojars.org/repo/)
Could not find artifact incanter:incanter-mongodb:jar:1.5.8-SNAPSHOT in clojars (https://clojars.org/repo/)
Could not find artifact incanter:incanter-pdf:jar:1.5.8-SNAPSHOT in clojars (https://clojars.org/repo/)
Could not find artifact incanter:incanter-svg:jar:1.5.8-SNAPSHOT in clojars (https://clojars.org/repo/)
Could not find artifact incanter:incanter-latex:jar:1.5.8-SNAPSHOT in clojars (https://clojars.org/repo/)
Could not find artifact incanter:incanter-excel:jar:1.5.8-SNAPSHOT in clojars (https://clojars.org/repo/)
Could not find artifact incanter:incanter-sql:jar:1.5.8-SNAPSHOT in clojars (https://clojars.org/repo/)
Could not find artifact incanter:incanter-zoo:jar:1.5.8-SNAPSHOT in clojars (https://clojars.org/repo/)
This could be due to a typo in :dependencies or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment variable.
/Users/me/work/incanter$

我还没有更改project.clj 中的任何内容,这里是:

(defproject incanter "1.5.8-SNAPSHOT"
  :description "Incanter is a Clojure-based, R-like statistical programming and data visualization environment."
  :url "http://incanter.org/"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :scm {:name "git" :url "https://github.com/incanter/incanter"}
  :min-lein-version "2.0.0"
  :dependencies [[incanter/incanter-core "1.5.8-SNAPSHOT"]
                 [incanter/incanter-io "1.5.8-SNAPSHOT"]
                 [incanter/incanter-charts "1.5.8-SNAPSHOT"]
                 [incanter/incanter-mongodb "1.5.8-SNAPSHOT"]
                 [incanter/incanter-pdf "1.5.8-SNAPSHOT"]
                 [incanter/incanter-svg "1.5.8-SNAPSHOT"]
                 [incanter/incanter-latex "1.5.8-SNAPSHOT"]
                 [incanter/incanter-excel "1.5.8-SNAPSHOT"]
                 [incanter/incanter-sql "1.5.8-SNAPSHOT"]
                 [incanter/incanter-zoo "1.5.8-SNAPSHOT"]
                 [org.clojure/clojure "1.5.1"]
                 ]
  :profiles {:dev {:resource-paths ["data"]}
             :debug {:debug true}
             :uberjar {:aot :all
                       :main incanter.main
                       :dependencies [[reply "0.3.0" :exclusions [org.clojure/clojure]]
                                      [swingrepl "1.3.0"
                                       :exclusions [org.clojure/clojure org.clojure/clojure-contrib]]
                                      ]
                       }
             }  
  :repl-options {:init-ns incanter.irepl
                 :resource-paths ["data"]
                 :init (do
                         (set! *print-length* 500)
                         (use 'clojure.repl))
                 }
  :jvm-opts ["-Xmx1g" "-Djsse.enableSNIExtension=false"
             ~(str "-Dincanter.home=" (System/getProperty "user.dir"))]
  )

任何帮助将不胜感激。

【问题讨论】:

  • 您想使用本地的库,我的意思是您的系统?问题是你的 ~/.m2(maven) 中没有这些部门,你会得到那个异常,而 leiningen 会尝试在 clojars 中搜索。
  • 对不起,我是 Clojure 的新手,对 maven 不是很熟悉。您能否详细说明在我的本地 maven 目录中获取 deps 需要做什么?
  • maven 是 leiningen 在下面使用的构建工具,如果不清楚,我已经回答了你的问题,我可以详细编辑它。
  • 您是否从 Incanter 项目的项目根目录的命令行中转到 lein install?这是通常的方式,尽管通常每个项目只有一个 jar。但值得一试。此外,您应该手动查看 .m2 目录以查看其中的内容。
  • 如果你想向 Incanter 提交补丁,我建议使用 develop 分支。并且它支持sub & modules 插件,所以你可以通过lein sub test 对所有模块执行test 任务。

标签: clojure leiningen incanter


【解决方案1】:

我看了看这个项目。您必须在 /modules 下构建任何项目,以便将快照版本 1.5.8-SNAPSHOT 构建在您的本地 .m2/ 上

cd modules
cd incanter-core
lein install
...

那么我认为它应该可以工作。或者,您可以将依赖项减少到 1.5.7。

【讨论】:

    【解决方案2】:

    您可以使用这种方法:

    为这些项目创建 jars(lein uberjar)

    然后对每个 jar 使用命令:

    mvn install:install-file \
     -Dfile=maven_repository/my-project.jar \ ;;path to your jar(this is example)
     -DgroupId= incanter \
     -DartifactId= incanter \
     -Dversion=0.1.0 \
     -Dpackaging=jar \
     -DgeneratePom=true
    

    然后将 deps 添加到您的 project.clj 并刷新 leiningen:

    [incanter/incanter "0.1.0"]
    [groupId/artifactId "your-version"]
    ...
    

    【讨论】:

    • 非常感谢。不幸的是,当我运行lein uberjar 时,我得到了Could not find artifact incanter:incanter-core:jar:1.5.8-SNAPSHOT in clojars (https://clojars.org/repo/) 之类的错误,最终它说:Uberjar aborting because jar failed: Could not resolve dependencies
    • 注意,依赖是incanter的子模块。
    • 你可以去clojars.org/incanter/incanter-core搜索每个模块的最新版本并据此更新并尝试再次运行lein test?让我知道进展如何
    • 那些版本好像已经不存在了
    • 事情是,我想更改其中一个模块(可能更多),所以理想情况下,我希望 lein 从 incanter repo(我的本地克隆)中的源代码构建所有模块并使用它们,而不是来自 clojars 的任何其他版本。
    猜你喜欢
    • 2013-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-01
    • 2017-03-02
    • 2021-07-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多