nha
nha

Reputation: 18005

Clojure - require several versions of a library in a project

Everything is in the title, but here is an example use case :

a function had a first parameter like the following :

(my-fn "a.b.c" ...)

Which now in a newer version became :

(my-fn ... ["a", "b", "c"])

Is it possible to :require a specific version of a library ? For instance :

:require my.util.lib :as newlib     ;; new version
:require [email protected] :as lib ;; old library

It would then allow to migrate this library usage file per file.

Upvotes: 4

Views: 162

Answers (1)

leeor
leeor

Reputation: 17771

As mentioned in the comments, I think Osgi is the only true way to accomplish this, and probably not worth the effort in complexity to set it up.

What are the versions of the library you are using? If it is following semantic versioning practices, and it still on a version with breaking changes, you have to be prepared for this sort of thing and will probably just have to update your code.

Upvotes: 3

Related Questions