Fork me on GitHub
#tools-deps
<
2019-06-14
>
alexmiller02:06:27

@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

jmv14:06:52

thank you alex, that worked!

alexmiller02:06:02

clj -Sdeps '{:mvn/local-repo "/right/here"}'

borkdude08:06:45

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"}

borkdude08:06:07

The error being:

Running tests in #{"test"}
Syntax error (ClassNotFoundException) compiling at (clj_kondo/core_test.clj:1:1).
clojure.core$with_meta__5405

borkdude08:06:05

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

borkdude08:06:33

trying a repro

borkdude08:06:40

I can force the download in another way, never mind

holyjak09:06:58

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

delaguardo09:06:42

I'm using maven for that. clj -Spom and then mvn deploy.

seancorfield16:06:11

Yup that's how I do it too. With depstar to create the JAR.

seancorfield16:06:26

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.

seancorfield16:06:59

next.jdbc is also published this way.

borkdude16:06:42

this is good to know. I currently still mirror my deps in a project.clj and then call lein deploy

jmv16:06:15

do you update the version in the pom by hand?

borkdude16:06:31

good question. I wonder where the version comes from since that’s not present in deps.edn?

seancorfield17:06:01

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.

seancorfield17:06:53

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).

seancorfield17:06:22

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

seancorfield17:06:10

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

seancorfield17:06:31

This is the deploy line:

mvn deploy:deploy-file -Dfile=${1}.jar -DpomFile=pom.xml -DrepositoryId=clojars -Durl=

jmv17:06:19

thanks sean, this is helpful to see

seancorfield17:06:49

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).

seancorfield17:06:54

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.

jmv17:06:56

right that makes sense