On Tue 22 Oct 2019 at 11:30, Elliotte Rusty Harold <elh...@ibiblio.org>
wrote:

> The docs at
> https://maven.apache.org/pom.html#Dependency_Version_Requirement_Specification
> say:
>
> 1.0: "Soft" requirement on 1.0 (just a recommendation, if it matches
> all other ranges for the dependency)
> [1.0]: "Hard" requirement on 1.0
>
> However, I don't think anywhere do we actually explain what a soft or
> a "Hard" requirement is. If someone can clarify this for me, I'll
> update the docs accordingly.
>

Ranges only come into affect when you have multiple dependencies using
ranges.

When you use ranges, Maven tries to satisfy all the requests.

A soft version is like: “I’d like this if I can have it”

A hard version is: “only this or die”

If your dependency tree has dependency foo being brought in by multiple
dependencies:

Maven first gets the intersection of all ranges

If there is more than one version left in the intersection, Maven looks at
the “nearest” soft version requests and if that fits the range it will use
that.

If your range is just a single version, that means only that version will
do, hence it becomes a hard specification.

Now having said all that, ranges have - to date - proven problematic. In
general it is better to avoid ranges at all... and that includes hard
version numbers.

Hopefully in Maven 5.0.0 we can find a way to make ranges at least
usable... but the reality is ranges are a hard problem in and if themselves.

>
>
> --
> Elliotte Rusty Harold
> elh...@ibiblio.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org
>
> --
Sent from my phone

Reply via email to