Open alza-bitz opened 6 years ago
Looks like a missing maven repository
I solve it by adding "central" {:url "https://repo1.maven.org/maven2/"}
into :mvn/repos
And I believe it is duplicate of https://github.com/luchiniatwork/cambada/issues/15
Ah whoops I didn't realise this is a known issue!
Thanks for the tip - I solved by placing the following in my deps.edn
map:
:mvn/repos {"central" {:url "https://repo1.maven.org/maven2/"}
"clojars" {:url "https://repo.clojars.org/"}}
I needed clojars in addition, otherwise metosin/spec-tools
could not be found.
I didn't think I even had a "system" deps.edn
file, but then I found it: /usr/local/lib/clojure/deps.edn
. I guess the Clojure installer puts it there!
I have an issue like that. Uberjar produced ok when I use cheshire 5.8.0, but falis with 5.8.1. The difference between 5.8.0 and 5.8.1 is Jaskson 2.9.0 and 2.9.6.
I just encountered the same problem as @maxp. In this case it doesn’t seem to be related to the system deps.edn
(although I’m not 100% sure).
I was able to work around this by forcing all Jackson artifacts to 2.9.8 by adding them to the root :deps
map in my deps.edn
:
com.fasterxml.jackson.core/jackson-core {:mvn/version "2.9.8"}
com.fasterxml.jackson.dataformat/jackson-dataformat-cbor {:mvn/version "2.9.8"}
com.fasterxml.jackson.dataformat/jackson-dataformat-smile {:mvn/version "2.9.8"}
(YMMV)
If anyone has any idea whether this issue with Jackson 2.9.6 is rooted in Cheshire, Jackson, or tools.deps, I’d be happy to report it to the most likely candidate. I myself just have no idea.
@maxp @aviflax the problem is in the way how cambada reads deps.edn. It doesn't know the location of system-level deps.edn so it can read only project-level file.
Solution is to include all :mvn/repos
listed in global deps file into your project's deps.edn.
{:deps {metosin/spec-tools {:mvn/version "0.9.1"}}
:aliases {:cambada
{:extra-deps
{luchiniatwork/cambada
{:mvn/version "1.0.0"}}}}
:mvn/repos {"central" {:url "http://central.maven.org/maven2/"}
"clojars" {:url "https://repo.clojars.org/"}}
:paths ["src"]}
(ns min.core
(:require [spec-tools.swagger.core :as swagger]
[clojure.spec.alpha :as s])
(:gen-class))
(s/def ::id string?)
(s/def ::name string?)
(s/def ::street string?)
(s/def ::city #{:tre :hki})
(s/def ::address (s/keys :req-un [::street ::city]))
(s/def ::user (s/keys :req-un [::id ::name ::address]))
(defn -main [& args]
(println
(swagger/swagger-spec
{:swagger "2.0"
:info {:version "1.0.0"
:title "Sausages"
:description "Sausage description"
:termsOfService "http://helloreverb.com/terms/"
:contact {:name "My API Team"
:email "foo@example.com"
:url "http://www.metosin.fi"}
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}}
:tags [{:name "user"
:description "User stuff"}]
:paths {"/api/ping" {:get {:responses {:default {:description ""}}}}
"/user/:id" {:post {:summary "User Api"
:description "User Api description"
:tags ["user"]
::swagger/parameters {:path (s/keys :req [::id])
:body ::user}
::swagger/responses {200 {:schema ::user
:description "Found it!"}
404 {:description "Ohnoes."}}}}}})))
personal/min [master●] » clj -R:cambada -m cambada.uberjar
Cleaning target
Creating target/classes
Compiling min.core
Creating target/min-1.0.0-SNAPSHOT.jar
Updating pom.xml
Creating target/min-1.0.0-SNAPSHOT-standalone.jar
Including min-1.0.0-SNAPSHOT.jar
Including spec-tools-0.9.1.jar
Including clojure-1.9.0.jar
Including spec.alpha-0.2.176.jar
Including jackson-databind-2.9.8.jar
Including core.specs.alpha-0.1.24.jar
Including jackson-annotations-2.9.0.jar
Including jackson-core-2.9.8.jar
Done!
personal/min [master●] » java -cp target/min-1.0.0-SNAPSHOT-standalone.jar min.core
{:swagger 2.0, :info {:version 1.0.0, :title Sausages, :description Sausage description, :termsOfService http://helloreverb.com/terms/, :contact {:name My API Team, :email foo@example.com, :url http://www.metosin.fi}, :license {:name Eclipse Public License, :url http://www.eclipse.org/legal/epl-v10.html}}, :tags [{:name user, :description User stuff}], :paths {/api/ping {:get {:responses {:default {:description }}}}, /user/:id {:post {:summary User Api, :description User Api description, :tags [user], :parameters [{:in path, :name min.core/id, :description , :type string, :required true} {:in body, :name min.core/user, :description , :required true, :schema {:type object, :properties {id {:type string}, name {:type string}, address {:type object, :properties {street {:type string}, city {:enum [:tre :hki], :type string}}, :required [street city], :title min.core/address}}, :required [id name address], :title min.core/user}}], :responses {200 {:schema {:type object, :properties {id {:type string}, name {:type string}, address {:type object, :properties {street {:type string}, city {:enum [:tre :hki], :type string}}, :required [street city], :title min.core/address}}, :required [id name address], :title min.core/user}, :description Found it!}, 404 {:description Ohnoes.}}}}}}
@delaguardo thank you! Very helpful!
🤔 I wonder if we should/could modify Cambada such that it checks whether deps.edn
contains :mvn/repos
— and if not, add in a default value. I think I like this idea, but it might violate the principle of least surprise. At the very least it seems we should add something to the docs to address this.
@aviflax I wonder if this is the behavior that the clojure script has under the hood because, even though cambada depends on tools.deps
(which is what the clojure script should be using), this behaviour we are seeing on cambada is triggered by tools.deps
For me the error was:
Execution error (MetadataNotFoundException) at org.eclipse.aether.internal.impl.DefaultMetadataResolver/resolve (DefaultMetadataResolver.java:233).
Could not find metadata org.clojure:clojure/maven-metadata.xml in local (~/.m2/repository)
Adding :mvn/repos {"central" {:url "https://repo1.maven.org/maven2/"}}
also solved it for me.
Having the solution mentioned in the readme would have saved me some time.
Hi there,
I'm trying to make an uberjar for a project that depends on
metosin/spec-tools
version0.8.0
, and I am getting the following error:Why is it unable to find this pom artifact? I can see
com.fasterxml.jackson:jackson-base:pom:2.9.7
in my~/.m2
directory.My
deps.edn
:The dependency tree: