Reputation:
I've build a clojure lib (lib1) locally and published it to github and clojars, then I've changed its version and published locally.
lein install
# =>
Created /home/me/projects/clojure/my-lib1/target/my-lib1-0.1.0.jar
Wrote /home/me/projects/clojure/my-lib1/pom.xml
Installed jar and pom into local repo.
Then I created another project (project2) and did this in it:
# project.clj:
;;.............
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"]
[my-lib1 "0.1.0"]]
And when I ran "lein deps" I got this:
Could not find artifact my-lib1:my-lib1:jar:0.1.0 in central (https://repo1.maven.org/maven2/)
Could not find artifact my-lib1:my-lib1:jar:0.1.0 in clojars (https://clojars.org/repo/)
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.
Why "cental" and "clojars"? Why isn't it looking for it locally?
in the local repo m2 its full name is and path are:
~/.m2/repository/org/clojars/my_nickname/my-lib1/
Upvotes: 1
Views: 299
Reputation: 6509
Perhaps lein still thinks the jar resource is an external one. The fact that even the name of the directory has 'clojars' in it is quite suspicious in that regard. (My .m2 directories don't have external names like that).
If you use a different filename - for instance putting -SNAPSHOT
on the end and then install that, lein should know that the -SNAPSHOT
file is a local one and look locally for it.
If that works for you then great. I realise it doesn't exactly answer your question. I don't see why lein doesn't always look both externally and locally. But then that 'clojars' is suspicious.
Edit See my other answer - the 'clojars' could well be coming from the name of your lein project.
Upvotes: 0
Reputation: 6509
I just got the same problem and fixed it. In my case it was the defproject of the project.clj file. This is the one that would not look locally:
(defproject org.clojars.cjmurphy/default-db-format "0.1.0"
Putting it back to this made it look locally again:
(defproject default-db-format "0.1.0"
Upvotes: 0
Reputation: 18005
If the path in .m2
is " ~/.m2/repository/org/clojars/my_nickname/my-lib1/", then your project.clj
should look like :
# project.clj:
;;.............
:dependencies [[org.clojure/clojure "1.7.0"]
[my_nickname/my-lib1 "0.1.0"]]
To find the path you can look at the generated data in .m2
.
Taking an arbitrary example since you did not post yours.
For maven-metadata-local.xml
like that :
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>cljsjs</groupId>
<artifactId>react-mdl</artifactId>
<versioning>
<release>1.3.0-0</release>
<versions>
<version>1.3.0-0</version>
</versions>
<lastUpdated>20160202194200</lastUpdated>
</versioning>
</metadata>
Or a .pom
like that :
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cljsjs</groupId>
<artifactId>react-mdl</artifactId>
<version>1.3.0-0</version>
<name>react-mdl</name>
<description>React Components wrapper for Material Design Lite UI http://tleunen.github.io/react-mdl/</description>
<url>http://tleunen.github.io/react-mdl/</url>
...
You would use [cljsjs/react-mdl "1.3.0-0"]
for those, as the syntax is groupId/artifactId. You can put only one (as you first tried) if they are both the same. So, check in your ~.m2
repository what are the correct fields.
Upvotes: 1