understanding maven version resolution: minor and snapshots

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

understanding maven version resolution: minor and snapshots

FilterPunk
In a project 2 "different" versions of the same library A are used. One, as
a direct dependency with a snapshot version *3.2.1-SNAPSHOT* and the same
library - but with version *3.2.0* -  is being used as a transient
dependency in yet another library B. So, the 2 dependencies of A only
differ in the minor version.
When I build/install this project only the 3.2.1-SNAPSHOT version of
library A gets downloaded.
Is this correct behaviour for maven since it evaluates the 3.2.1-SNAPSHOT
to be compatible with the 3.2.0 release version or should maven download
the 3.2.0 release version since it is explicit mentioned as a transient
dependency in the pom of a  library B?
Reply | Threaded
Open this post in threaded view
|

Re: understanding maven version resolution: minor and snapshots

Curtis Rueden
Hi Jörg,

As far as I know, Maven has no notion of "major" vs. "minor" vs. "patch"
versions in the style of e.g. SemVer.

It simply judges which version is the newest via its algorithm, and uses
the newest, since it is assumed that a dependency on e.g. 3.2.0 means
"version must be at least as new as 3.2.0".

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden


On Fri, Apr 21, 2017 at 6:18 PM, Jörg Wille <[hidden email]> wrote:

> In a project 2 "different" versions of the same library A are used. One, as
> a direct dependency with a snapshot version *3.2.1-SNAPSHOT* and the same
> library - but with version *3.2.0* -  is being used as a transient
> dependency in yet another library B. So, the 2 dependencies of A only
> differ in the minor version.
> When I build/install this project only the 3.2.1-SNAPSHOT version of
> library A gets downloaded.
> Is this correct behaviour for maven since it evaluates the 3.2.1-SNAPSHOT
> to be compatible with the 3.2.0 release version or should maven download
> the 3.2.0 release version since it is explicit mentioned as a transient
> dependency in the pom of a  library B?
>
Reply | Threaded
Open this post in threaded view
|

Re: understanding maven version resolution: minor and snapshots

stephenconnolly
On Sat 22 Apr 2017 at 00:21, Curtis Rueden <[hidden email]> wrote:

> Hi Jörg,
>
> As far as I know, Maven has no notion of "major" vs. "minor" vs. "patch"
> versions in the style of e.g. SemVer.
>
> It simply judges which version is the newest via its algorithm, and uses
> the newest, since it is assumed that a dependency on e.g. 3.2.0 means
> "version must be at least as new as 3.2.0".


Nope it pick the *nearest* version.

Direct dependency trumps transitive

>
>
> Regards,
> Curtis
>
> --
> Curtis Rueden
> LOCI software architect - https://loci.wisc.edu/software
> ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
>
>
> On Fri, Apr 21, 2017 at 6:18 PM, Jörg Wille <[hidden email]> wrote:
>
> > In a project 2 "different" versions of the same library A are used. One,
> as
> > a direct dependency with a snapshot version *3.2.1-SNAPSHOT* and the same
> > library - but with version *3.2.0* -  is being used as a transient
> > dependency in yet another library B. So, the 2 dependencies of A only
> > differ in the minor version.
> > When I build/install this project only the 3.2.1-SNAPSHOT version of
> > library A gets downloaded.
> > Is this correct behaviour for maven since it evaluates the 3.2.1-SNAPSHOT
> > to be compatible with the 3.2.0 release version or should maven download
> > the 3.2.0 release version since it is explicit mentioned as a transient
> > dependency in the pom of a  library B?
> >
>
--
Sent from my phone
Reply | Threaded
Open this post in threaded view
|

Re: understanding maven version resolution: minor and snapshots

Anders Hammar
> Nope it pick the *nearest* version.
>

> Direct dependency trumps transitive
>

And to give the full picture, if different versions are declared at the
same level in the dependency tree (typically via transitive dependencies
when you don't have a direct dep), the first declaration wins. So, the
order you declare your dependencies could actually have an impact in that
case.

/Anders


>
> >
> >
> > Regards,
> > Curtis
> >
> > --
> > Curtis Rueden
> > LOCI software architect - https://loci.wisc.edu/software
> > ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
> >
> >
> > On Fri, Apr 21, 2017 at 6:18 PM, Jörg Wille <[hidden email]>
> wrote:
> >
> > > In a project 2 "different" versions of the same library A are used.
> One,
> > as
> > > a direct dependency with a snapshot version *3.2.1-SNAPSHOT* and the
> same
> > > library - but with version *3.2.0* -  is being used as a transient
> > > dependency in yet another library B. So, the 2 dependencies of A only
> > > differ in the minor version.
> > > When I build/install this project only the 3.2.1-SNAPSHOT version of
> > > library A gets downloaded.
> > > Is this correct behaviour for maven since it evaluates the
> 3.2.1-SNAPSHOT
> > > to be compatible with the 3.2.0 release version or should maven
> download
> > > the 3.2.0 release version since it is explicit mentioned as a transient
> > > dependency in the pom of a  library B?
> > >
> >
> --
> Sent from my phone
>
Reply | Threaded
Open this post in threaded view
|

Re: understanding maven version resolution: minor and snapshots

Erik Bertelsen
Also:

The command
   mvn dependency:tree

may be your rescue, look for entries marked as conflicting.

- Erik

2017-04-22 9:31 GMT+02:00 Anders Hammar <[hidden email]>:

>> Nope it pick the *nearest* version.
>>
>
>> Direct dependency trumps transitive
>>
>
> And to give the full picture, if different versions are declared at the
> same level in the dependency tree (typically via transitive dependencies
> when you don't have a direct dep), the first declaration wins. So, the
> order you declare your dependencies could actually have an impact in that
> case.
>
> /Anders
>
>
>>
>> >
>> >
>> > Regards,
>> > Curtis
>> >
>> > --
>> > Curtis Rueden
>> > LOCI software architect - https://loci.wisc.edu/software
>> > ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
>> >
>> >
>> > On Fri, Apr 21, 2017 at 6:18 PM, Jörg Wille <[hidden email]>
>> wrote:
>> >
>> > > In a project 2 "different" versions of the same library A are used.
>> One,
>> > as
>> > > a direct dependency with a snapshot version *3.2.1-SNAPSHOT* and the
>> same
>> > > library - but with version *3.2.0* -  is being used as a transient
>> > > dependency in yet another library B. So, the 2 dependencies of A only
>> > > differ in the minor version.
>> > > When I build/install this project only the 3.2.1-SNAPSHOT version of
>> > > library A gets downloaded.
>> > > Is this correct behaviour for maven since it evaluates the
>> 3.2.1-SNAPSHOT
>> > > to be compatible with the 3.2.0 release version or should maven
>> download
>> > > the 3.2.0 release version since it is explicit mentioned as a transient
>> > > dependency in the pom of a  library B?
>> > >
>> >
>> --
>> Sent from my phone
>>

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