Reputation: 507
I am attempting to utilize lein new template build-out behind a corporate proxy or local maven mirror with following failure:
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.
Placing the following lines in profiles.clj appear to have no effect:
:mirrors {"central" {:name "central"
:url "http://server.company_name.com:8080/artifactory/maven.central/"}}
Environment variables (upper / lower case appears to also have no impact):
HTTP_PROXY=http://username:[email protected]_name.com:8080
HTTPS_PROXY=https://username:[email protected]_name.com:8080
HTTP_NO_PROXY=*.company_name.com
HTTP_CLIENT=wget --no-check-certificate -O
Note: I have also specified HTTP/S proxy without username and password which results in same failure.
I have also not been able to determine how to produce debug level logging to assist in troubleshooting failure.
Leiningen 2.7.0 on Java 1.8.0_144 Java HotSpot(TM) 64-Bit Server VM
Clojure 1.8.0
Upvotes: 1
Views: 1245
Reputation: 507
I updated the file ~.m2/settings.xml which contains Maven configuration settings as follows:
<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>
It appears that this version of Lein adds Clojars repository search path for resolving dependencies but not for project templates. By making this Maven configuration change it causes Maven called by Lein to search the additional Clojars repository automatically. This appears to be inconsistent behavior which will hopefully be resolved in a future version of Lein.
Upvotes: 1
Reputation: 507
I found the luminus:lein-template:2.9.11.90 artifact at clojars.org and retrieved it manually using Maven into my local M2 repository.
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] ------------------------------------------------------------------------
Once this artifact was available locally I was able to successfully use the template to create the project:
C:\development\clojure> lein new luminus guestbook +h2
Generating a Luminus project.
After this completed and moving to the new project directory, I was successfully able to download dependencies and run the project using "lein run".
This does not solve the problem of lein using a proxy configuration when creating a project from a template but does provide a workaround.
Upvotes: 0