Am 07/04/16 um 22:46 schrieb Stephen Connolly:
> So when I have a pom with <version>1.0</version> that is the strongest hint
> for that pom. That version will be used in that pom even if a transitive
> dependency has <version>2.0</version>
> 
> So one solution to that is to use ranges... if the transitive dependency
> has a version like <version>[2.0]</version> then that basically says I must
> have version 2.0 nothing else will do. Now my local pom has just a hint of
> 1.0... but hints can be ignored, so in that case Maven should give my local
> pom 2.0 because of the hard dependency in the transitive pom.
> 
> Of course such a hard dependency can cause issues... which can then only be
> resolved by exclusions and adding back in again
> 
> So better is to use ranges, you can have the transitive dependency with a
> version like <version>[2.0,3.0)</version> and perhaps another dependency
> brings it in with a version like <version>[2.1,4.0)</version>
> 
> So in that case we have a local hint of 1.0, and two hard requirements.
> Maven is supposed to then resolve that set and come back with an effective
> range of [2.1,3.0) now at this point the spec and bugs get imprecise...
> there is a bug whereby -SNAPSHOT versions are considered part of the range
> (which should IIRC only be the case where at least one bound is a
> -SNAPSHOT) and then it is unclear as to whether the top or bottom end of
> the range is selected.... if somewhere else in our transitive dependencies,
> somebody else has put a hint of 2.2 then because that hint is within the
> range it might legitimately be considered a valid hint... though if there
> are conflicting hints you then get into topological sorting for distance...
> and wahhh
> 
> So people don't use ranges and just use hints

Thank you for explaining that. Regarding the SNAPSHOT thing: I really
like the idea of the 'ContextualSnapshotVersionFilter' available in the
'aether-utils'. So the root node decides if SNAPSHOTs are allowed or not.

<https://git-wip-us.apache.org/repos/asf?p=maven-aether.git;a=blob;f=aether-util/src/main/java/org/eclipse/aether/util/graph/version/ContextualSnapshotVersionFilter.java;h=569bf4cbe51515846656fd14edfe52db13f1a1e2;hb=HEAD>

Regards,
-- 
Christian


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to