如何使用corporate proxy或maven mirror背后的模板启动新的Clojure lein项目

如何使用corporate proxy或maven mirror背后的模板启动新的Clojure lein项目,clojure,proxy,leiningen,Clojure,Proxy,Leiningen,我试图在公司代理或本地maven镜像后利用lein新模板构建,但失败如下: C:\development\clojure> lein new luminus guestbook +h2 Failed to resolve version for luminus:lein-template:jar:RELEASE: Could not find metadata luminus:lein-template/maven-metadata.xml in local (C:\Users\usern

我试图在公司代理或本地maven镜像后利用lein新模板构建,但失败如下:

C:\development\clojure> lein new luminus guestbook +h2
Failed to resolve version for luminus:lein-template:jar:RELEASE: Could not find metadata luminus:lein-template/maven-metadata.xml in local (C:\Users\username\.m2\repository)
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.
Could not find template luminus on the classpath.
在profiles.clj中放置以下行似乎没有效果:

:mirrors {"central" {:name "central" 
  :url "http://server.company_name.com:8080/artifactory/maven.central/"}} 
环境变量(大写/小写似乎也没有影响):

注意:我还指定了没有用户名和密码的HTTP/S代理,这会导致相同的失败

我还无法确定如何生成调试级日志以帮助故障排除

Java 1.8.0_144 Java HotSpot(TM)64位服务器虚拟机上的Leiningen 2.7.0


Clojure 1.8.0

我在clojars.org上找到了luminus:lein模板:2.9.11.90工件,并使用Maven将其手动检索到本地M2存储库中

C:\development\clojure> mvn dependency:get -DremoteRepositories=https://clojars.org/repo -Dartifact=luminus:lein-template:2.9.11.90
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:get (default-cli) @ standalone-pom ---
[INFO] Resolving luminus:lein-template:jar:2.9.11.90 with transitive dependencies
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.160 s
[INFO] Finished at: 2017-09-30T16:58:11-04:00
[INFO] Final Memory: 11M/216M
[INFO] ------------------------------------------------------------------------
一旦这个工件在本地可用,我就能够成功地使用模板创建项目:

C:\development\clojure> lein new luminus guestbook +h2
Generating a Luminus project.
完成此操作并移动到新的项目目录后,我成功地下载了依赖项并使用“lein run”运行了项目


这并不能解决lein在从模板创建项目时使用代理配置的问题,但提供了一种解决方法。

我更新了文件~.m2/settings.xml,其中包含Maven配置设置,如下所示:

<settings ...>
  ...
  <profiles>
    ...
    <profile>
      <id>alwaysActive</id>
      <repositories>
        ...
        <repository>
          <id>clojars</id>
          <name>Repository for Clojure builds</name>
                    <snapshots> 
                        <enabled>false</enabled> 
                    </snapshots> 
          <url>https://clojars.org/repo</url>
          <layout>default</layout>
        </repository>
      </repositories>
    </profile>

  </profiles>

  <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
  </activeProfiles>

</settings>

...
...
总是积极的
...
clojars
Clojure构建的存储库
假的
https://clojars.org/repo
违约
alwaysActiveProfile
这个版本的Lein似乎添加了Clojars存储库搜索路径,用于解析依赖项,但不用于项目模板。通过对Maven配置进行更改,Lein调用的Maven可以自动搜索其他Clojars存储库。这似乎是不一致的行为,有望在未来版本的Lein中得到解决

<settings ...>
  ...
  <profiles>
    ...
    <profile>
      <id>alwaysActive</id>
      <repositories>
        ...
        <repository>
          <id>clojars</id>
          <name>Repository for Clojure builds</name>
                    <snapshots> 
                        <enabled>false</enabled> 
                    </snapshots> 
          <url>https://clojars.org/repo</url>
          <layout>default</layout>
        </repository>
      </repositories>
    </profile>

  </profiles>

  <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
  </activeProfiles>

</settings>