2
votes

Should I create a local repository to change the dependencies of a dependency in my project?

I have a clojure project that is using docjure. docjure contains a dependency on poi 3.6.

Because of a bug in generated Excel files I am reading, I have a local version of poi 3.8 that I hacked to workaround the bug.

It's easy enough to stick my poi 3.8 jars into my projects lib/ directory so that my project will run ok at the repl.

But, lein deps (or jar and uberjar) happily cleans the lib/ directory and reinstalls the 3.6 versions of poi, breaking my build.

I think the probable solution is two-fold:

1 - put my hacked poi 3.8 into a local repository 2 - create my own local copy of docjure and update it's dependencies to point to that local repository.

I am looking for confirmation that this is the "right thing" to do in this case or someone to point out that it is much easier to just do something else.

1

1 Answers

3
votes

It is worth reading Leiningen's Repeatability wiki page if you haven't already. To quote part of it:

If the code is public, you should open a bug report with upstream to get them to publish it in a public repository like Clojars, Sonatype, or Maven Central, depending on the project. If they are resistant or too slow it's always possible to publish "Clojars forks"; see lein help deploying for further details there.

The ultimate solution is to try and get your changes pushed upstream. Then you can depend on the version you need, and I think Leiningen will prefer that version if it's higher than the transitive version.


Another option might be to include your jar in a safe (checked-in) directory. Then write a plugin that can hook into a built-in task and copy the jar to your lib directory for you. I really don't know if this will be successful, but it's worth looking into.