Clojure的工具.deps解析远程Maven仓库,并且通常遵循Maven的settings.xml配置。不幸的是,在以下设置示例中,它将无法拾取镜像的认证。根据Maven的惯例,应使用镜像的ID来确定服务器设置,在本例中为"planetmirror.com"。
<settings>
<servers>
<server>
<id>planetmirror.com</id>
<username>my_login</username>
<password>my_password</password>
<configuration></configuration>
</server>
</servers>
<mirrors>
<mirror>
<id>planetmirror.com</id>
<name>PlanetMirror Australia</name>
<url>http://downloads.planetmirror.com/pub/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
原因是tools.alpha.util.maven.clj中的代码使用了存储库的名称来查找服务器设置
以下补丁修复了此问题
modified src/main/clojure/clojure/tools/deps/alpha/util/maven.clj
@@ -77,7 +77,7 @@
(let [mirrors (.getMirrors settings)
selector (DefaultMirrorSelector.)]
(run! (fn [^Mirror mirror] (.add selector
- (.getName mirror)
+ (.getId mirror)
(.getUrl mirror)
(.getLayout mirror)
false
@@ -110,7 +110,8 @@
maybe-repo (.build builder)
mirror (select-mirror settings maybe-repo)
proxy (select-proxy settings (or mirror maybe-repo))
- ^Server server-setting (->> (.getServers settings) (filter #(= name (.getId ^Server %))) first) ]
+ server-id (-> (or mirror maybe-repo) (.getId))
+ ^Server server-setting (->> (.getServers settings) (filter #(= server-id (.getId ^Server %))) f irst)]
(->
(cond-> builder
mirror (.setUrl (.getUrl mirror))