How declare dependency starting from a jar version onward?

(Luca Arzeni) #1

I would like to say that a project of mine has a dependency from servlet-api. I cannot accept 2.3, but if would be fine to use 2.4 or 2.5 (eg. javax.servlet:servlet-api:2.4 or javax.servlet:servlet-api:2.5).

So I would like to say something similar to: “use servlet-api FROM 2.4 and newer”

I understand that I can write: javax.servlet:servlet-api:2.+ but this, in turn could cause to select release 2.3, that I don’t want.

I tryied with a regexp javax.servlet:servlet-api:2.[45] but this doesn’t work.

Is there a way to express this dependency? What is the best practice for this issue?

Thanks, Luca


You should be able to use an ivy “Version Range Matcher” as describe here. This works for an ivy repository, and in theory should work for a maven repository as well.

(Luca Arzeni) #3

OK it works fine! Thanks, Luca