This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-14
Channels
- # announcements (2)
- # aws (12)
- # aws-lambda (5)
- # beginners (42)
- # calva (56)
- # cider (16)
- # clj-kondo (1)
- # cljs-dev (45)
- # cljsjs (1)
- # cljsrn (25)
- # clojure (171)
- # clojure-europe (3)
- # clojure-italy (16)
- # clojure-losangeles (2)
- # clojure-nl (49)
- # clojure-spec (2)
- # clojure-sweden (3)
- # clojure-uk (11)
- # clojurescript (84)
- # component (11)
- # core-async (12)
- # core-logic (2)
- # cursive (8)
- # datomic (41)
- # events (2)
- # fulcro (48)
- # graalvm (1)
- # graphql (1)
- # hoplon (12)
- # jackdaw (1)
- # jobs (1)
- # jobs-discuss (45)
- # joker (5)
- # keechma (10)
- # nyc (3)
- # off-topic (14)
- # pathom (16)
- # qa (1)
- # re-frame (22)
- # reagent (12)
- # reitit (4)
- # remote-jobs (1)
- # shadow-cljs (40)
- # spacemacs (3)
- # timbre (3)
- # tools-deps (29)
@jmv305 yes, set the :mvn/local-repo attribute at the root of deps.edn (or in -Sdeps on command line) - takes a string that is a path to the root
clj -Sdeps '{:mvn/local-repo "/right/here"}'
I’m getting an error when I put clojure 1.10.1 in my extra-deps. I wanted the dependency to be there in my maven repo during test time, since I’m analyzing the source code.
;; org.clojure/clojure {:mvn/version "1.10.1"}
The error being:
Running tests in #{"test"}
Syntax error (ClassNotFoundException) compiling at (clj_kondo/core_test.clj:1:1).
clojure.core$with_meta__5405
I didn’t want to declare that clojure version at my top level, since I don’t want to force that version on other people
Does anyone know how to publish a deps.edn-based library to Clojars? Its docs do not mention it https://github.com/clojars/clojars-web/wiki/Pushing
I'm using maven for that. clj -Spom
and then mvn deploy
.
So you probably need to read through https://github.com/clojars/clojars-web/wiki/Pushing#maven
Yup that's how I do it too. With depstar to create the JAR.
The pom generated by clj is minimal -- you'll need to add a bunch of stuff and edit things. See the pom.xml
file in the depstar repo. Without all the extra stuff Clojars won't know how to refer back to your source repo and you won't be able to import your library on http://cljdoc.org either.
next.jdbc
is also published this way.
this is good to know. I currently still mirror my deps in a project.clj and then call lein deploy
good question. I wonder where the version comes from since that’s not present in deps.edn?
Yes, I update the pom.xml
<version>
tag manually. But the the SCM <tag>
is updated by my deploy
shell script when I make a release.
So my process the first time is clj -Spom
and add all the SCM stuff etc into the skeletal pom.xml
(by copying from another project and editing all the URLs etc).
Subsequent times: do the edits to prepare for the release, push to GH, create a new release on GH with release notes, pull (to ensure I have the latest master locally), then clj -Spom && clj -A:jar project.jar && git status
(to verify the pom.xml
didn’t change again). Then I usually re-run the test suite at this point. Then deploy project
, which updates the pom.xml
from the HEAD SHA, commits & pushes it, then uses mvn deploy
to push it up to http://clojars.org
This is how I update the pom.xml
in my deploy
script
sha=`git rev-parse HEAD`
version=`fgrep '<version>' pom.xml | head -1 | sed 's;.*<version>\(.*\)</version>.*;\1;'`
echo "Setting tag to ${sha} for version ${version}..."
cp pom.xml /tmp/${1}.pom.xml
sed "s;<tag>[0-9a-f]*</tag>;<tag>${sha}</tag>;" < /tmp/${1}.pom.xml > pom.xml
This is the deploy line:
mvn deploy:deploy-file -Dfile=${1}.jar -DpomFile=pom.xml -DrepositoryId=clojars -Durl=
The automated commit looks like this https://github.com/seancorfield/next-jdbc/commit/43f74637996ffeaef51bb1965374c784c9ec5b28 but the actual release — whatever was tagged by GH — is what Clojars points to, e.g., https://github.com/seancorfield/next-jdbc/commit/9280b9ab4753a62e14b564df0797c124af14e4ad (which is one before that).
However, it’s the <tag>
in the pom.xml
that drives http://cljdoc.org when it fetches the project from GH to analyze — and that means it gets the deployed version (which is one commit ahead of the release). Just something to bear in mind.
Thanks!
An example that doesn't use mvn: https://github.com/juxt/pack.alpha#uploading-to-clojars-or-maven