簡體   English   中英

Clojure with Leiningen:如何包含本地依賴項?

[英]Clojure with Leiningen: how to get local dependencies included?

我正在通過《 Clojure 編程》一書學習 Clojure,但很早就試圖從書中獲取示例。

我從書中下載了代碼示例; 目錄結構是

examples/

並且里面還有一堆.clj的文件,包括一個叫introduction.clj。

我試圖運行的代碼開始於

(require 'examples/introduction')

......但我無法讓它發揮作用。

我已經嘗試添加一個checkouts目錄並符號鏈接其中的示例目錄。 我試過用 Manifest.txt 制作一個 .jar 文件,給它版本 1.0.0 ....

但是跑步

lein repl

到目前為止總是給出錯誤,比如

在中央( https://repo1.maven.org/maven2/ )找不到工件示例:介紹:jar:1.0.0 在clojars( https://repo )中找不到工件示例:介紹:jar:1.0.0 .clojars.org/ ) 這可能是由於:依賴項、文件系統權限或網絡問題中的拼寫錯誤。

project.clj文件是這樣的:

  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url "https://www.eclipse.org/legal/epl-2.0/"}
  :dependencies [[org.clojure/clojure "1.10.1"]
                 [clj-http "2.0.0"]
         [examples/introduction "1.0.0"]]
  :main ^:skip-aot my-stuff.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all
                       :jvm-opts ["-Dclojure.compiler.direct-linking=true"]}})

我錯過了什么? 非常感謝您的任何指導!

在 leetwinski 的有用評論之后更新的 project.clj 文件:

  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url "https://www.eclipse.org/legal/epl-2.0/"}
  :dependencies [[org.clojure/clojure "1.10.1"]
                 [clj-http "2.0.0"]]
  :source-paths ["/home/mark/src/cloj/code/src/examples"]
  :main ^:skip-aot my-stuff.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all
                       :jvm-opts ["-Dclojure.compiler.direct-linking=true"]}})

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM