best practice with forked libraries

214 views
Skip to first unread message

Bobby Bobble

unread,
Nov 17, 2015, 8:21:43 AM11/17/15
to Clojure
Say there's a dependency that I fork and add some features I need for my team's project. I can use my fork locally with lein install no problem, and so can others if they clone my fork and do the same. It would be more convenient if I could publish my fork to Clojars and depend on that, and maybe down the line I can return to depending on the original if my PR is accepted. What's the best thing to do here ?

Ray Miller

unread,
Nov 17, 2015, 1:54:43 PM11/17/15
to clo...@googlegroups.com
On 17 November 2015 at 13:21, Bobby Bobble <bpb...@gmail.com> wrote:
Say there's a dependency that I fork and add some features I need for my team's project. I can use my fork locally with lein install no problem, and so can others if they clone my fork and do the same. It would be more convenient if I could publish my fork to Clojars and depend on that, and maybe down the line I can return to depending on the original if my PR is accepted. What's the best thing to do here ?

There's a convention in Clojars of deploying a non-canonical fork by renaming the project to org.clojars.USERNAME/PROJ_NAME and deploying that to Clojars.


Paul deGrandis

unread,
Nov 17, 2015, 2:48:54 PM11/17/15
to Clojure
In addition to Ray's response (which I would also suggest), I'd encourage you to reach out to the project maintainer/author with your additions - it's always nice to see how your project is being used and the shortcomings that others are hacking around.

Cheers,
Paul

Mimmo Cosenza

unread,
Nov 17, 2015, 2:58:19 PM11/17/15
to clo...@googlegroups.com
A lot of time ago I wrote the following tutorial on this topic.


HIH

mimmo

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Herwig Hochleitner

unread,
Nov 18, 2015, 9:45:48 AM11/18/15
to clo...@googlegroups.com
2015-11-17 19:54 GMT+01:00 Ray Miller <r...@1729.org.uk>:

There's a convention in Clojars of deploying a non-canonical fork by renaming the project to org.clojars.USERNAME/PROJ_NAME and deploying that to Clojars.


That convention is pretty awkward in practice, because leiningen and maven won't recognize that it's another version of the same artifact and you'll need to take extra care that the original isn't included transitively. Otherwise you will get hard-to-track classpath collisions. Use https://github.com/webnf/lein-collisions to uncover such collisions.

Max Gonzih

unread,
Nov 18, 2015, 9:48:16 AM11/18/15
to Clojure
I think lein deps :tree should be enough to spot issues like that.
Also :exclusions should be used to remove original library from other dependencies.

Herwig Hochleitner

unread,
Nov 18, 2015, 10:19:49 AM11/18/15
to clo...@googlegroups.com
2015-11-18 15:48 GMT+01:00 Max Gonzih <gon...@gmail.com>:
I think lein deps :tree should be enough to spot issues like that.

If you're into skimming pages of transitive dependencies (or know how to use grep ;), sure. But lein-collisions also helps you find unexpected collisions (i.e. not related to renamed packages).
Speaking of that, has `lein deps :tree` been broken for anybody else lately?
 
Also :exclusions should be used to remove original library from other dependencies.

Sure, but that's no fun at all. Overall seems pretty awkward to me, still.

Michael Blume

unread,
Nov 18, 2015, 3:41:13 PM11/18/15
to clo...@googlegroups.com
If you have an internal maven repo, you can publish artifacts to it with updated version string and with group/artifact unchanged.

--

Max Gonzih

unread,
Nov 18, 2015, 4:31:47 PM11/18/15
to clo...@googlegroups.com

Should also work with locally installed jar.

You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/3W0LVsTMJDk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages