2

Is there a way, in Maven, to declare a dependency version range and have it resolve against the lower bound for the compile phase of the build?

eg. I declare a dependency using version range [1.2.0,1.999.999]. I would like for the compile phase to use version 1.2.0, specifically, but for the deployed POM to still show my compatible version range as [1.2.0,1.999.999].

My project is a library. For a non-library project I would just pin a specific version.

Jesse
  • 3,751
  • 1
  • 21
  • 19
  • It depends on your case but it might be better to define a dependency with `provided` ? Or may be `runtime` but I don't know your library so I'm not sure what would be the best....apart from that if you would define a version range you have to be sure that all versions are correctly working which would mean in consequence to test all versions..which I'm sure you really like to do? – khmarbaise Mar 12 '19 at 19:41

1 Answers1

0

I see your point, but I am not sure this is the right idea.

First of all, version ranges are not very popular nowadays. People tend to avoid them because the build is not reproducible. AFAIK, they are not really deprecated, though.

Using version ranges to show compatibility is unexpected. Maybe a comment in the POM would be better.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142