简体   繁体   English

在启动Clojure中使用本地Maven存储库

[英]using local Maven repository in boot Clojure

I'd like to use the local Maven repository (at ~/.m2/repository by default) to find a dependency for a Clojure project built by boot . 我想使用本地Maven存储库(默认为~/.m2/repository )来查找boot生成的Clojure项目的依赖项。

I am quite certain that the dependency is in the repository: 我非常确定依赖项在存储库中:

$ ls ~/.m2/repository/ags799/boot-docker/0.0.0-7-gd5196b9-dirty/
_maven.repositories
boot-docker-0.0.0-7-gd5196b9-dirty.jar
boot-docker-0.0.0-7-gd5196b9-dirty.pom

I'm quite certain that my project properly refers to the dependency. 我非常确定我的项目正确地引用了依赖项。 This is my build.boot 这是我的build.boot

(set-env! :dependencies `[[org.clojure/clojure ~(clojure-version)]
                          [ags799/boot-docker "0.0.0-7-gd5196b9-dirty.jar"]])

(task-options!
  pom {:project 'example
       :version "0.0.0"}
  aot {:namespace #{'example.core}}
  jar {:main 'example.core})

However, when I run boot repl , I get this: 但是,当我运行boot repl ,我得到了:

                                                    java.lang.Thread.run                    Thread.java:  745
                      java.util.concurrent.ThreadPoolExecutor$Worker.run        ThreadPoolExecutor.java:  617
                       java.util.concurrent.ThreadPoolExecutor.runWorker        ThreadPoolExecutor.java: 1142
       org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run    RunnableErrorForwarder.java:   60
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run  WagonRepositoryConnector.java:  669
     org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap  WagonRepositoryConnector.java:  941
     org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap  WagonRepositoryConnector.java:  947
      org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact ags799:boot-docker:jar:0.0.0-7-gd5196b9-dirty.jar in clojars (https://repo.clojars.org/)
      artifact: #object[org.sonatype.aether.util.artifact.DefaultArtifact 0xa82                      java.util.concurrent.ThreadPoolExecutor$Worker.run        ThreadPoolExecutor.java:  61to                       java.util.concurrent.ThreadPoolExecutor.runWorker        ThreadPoolExecutor.java: 114he       org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run    RunnableErrorForwarder.java:   6rtorg.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run  WagonRepositoryConnector.java:  66ul     org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap  WagonRepositoryConnector.java:  94ot     org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap  WagonRepositoryConnector.java:  94:1      org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact ags799:boot-docker:jarlu      artifact: #object[org.sonatype.aether.util.artifact.DefaultArtifact 0xa82                      java.util.concurrent.ThreadPoolExecutor$Worker.run        ThreadPoolExecirty.jar in clojars (https://repo.clojars.org/)
    result: #object[org.sonatype.aether.resolution.DependencyResult 0x5a37d3ed "[org.clojure:clojure:jar:1.8.0 < maven-central (https://repo1.maven.org/maven2, releases+snapshots), null < null]"]
                                  clojure.lang.ExceptionInfo: Could not find artifact ags799:boot-docker:jar:0.0.0-7-gd5196b9-dirty.jar in clojars (https://repo.clojars.org/)
    line: 3

I have also tried manually setting boot's path to the local Maven repository by including :local-repo "~/.m2/repository" in the set-env! 我还尝试通过在set-env!包含:local-repo "~/.m2/repository"来手动设置引导到本地Maven存储库的路径set-env! command. 命令。 This does not change the output. 这不会更改输出。

I have also tried replacing ~ in this path with the explicit $HOME path ( /Users/andrew ). 我还尝试用显式$HOME路径( /Users/andrew )替换此路径中的~ This does not change the output. 这不会更改输出。

This is my project's boot.properties : 这是我项目的boot.properties

BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_CLOJURE_VERSION=1.8.0
BOOT_VERSION=2.7.2

How can my project use the local Maven repository for finding dependencies? 我的项目如何使用本地Maven存储库查找依赖项? Many thanks. 非常感谢。

The dependency declaration, should it include .jar at the end? 依赖项声明,是否应在末尾包含.jar

ie Shouldn't it be like this? 即不是这样吗?

(set-env! :dependencies `[[org.clojure/clojure ~(clojure-version)]
                          [ags799/boot-docker "0.0.0-7-gd5196b9-dirty"]])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM