Say I'm using a library in a leiningen project, hosted on Clojars. And I run into a bug. I fork the project on Github, and fix the bug. Now what?
What's the most appropriate way to use my version of the library in my leiningen project?
P.S. I'm coming from the Ruby world, so I've obviously got Bundler on the mind...
If you only want your modified version available locally, you can follow Arthur's process up to the "Test my program" step. This is fine if you're working on an application which you'll package together with its dependencies for deployment (with lein uberjar
, say). You might also want to use Leiningen's checkouts feature to work on your main project and the modified library in parallel (documented in Leiningen's tutorial -- link to the version from the current 2.2.0 release).
If you want your modified version to be accessible in a public Maven repository, the accepted thing to do (indeed, encouraged for this specific use case and no other) is to release a version of the project with the original artefact id and a group id of org.clojars.{your-clojars-account-name}
.
For example, if you wanted to release your own version of project foo
with (defproject foo "upstream-version" ...)
in its project.clj
, you'd change its defproject
form to (defproject org.clojars.kendallb/foo "your-version" ...)
before release. Then you could depend on [org.clojars.kendallb/foo "your-version"]
in your projects.
This way there won't be any conflict either with the original artefact id or any other forks.
As for getting your change merged upstream, Arthur's process is perfectly reasonable.
my process:
Tt's tempting to apply lots of "style fixes" to a project when you're just in there digging around to fix a bug. If you want to do this do try to work with the project maintainer because they are in it for the long haul and more emotionally invested in the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With