You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Leon Rosenberg <ro...@gmail.com> on 2012/09/03 12:56:15 UTC

understanding maven dependencies range

Hello,

I have two modules, say A and B, which are using the same library, one
is using 1.0.8 and one 1.0.14:
		<dependency>
			<groupId>net.anotheria</groupId>
			<artifactId>ano-util</artifactId>
			<version>1.0.14</version>
		</dependency>

A third module (a web-app) uses both A and B. After I built the third
module, it wasn't able to start, because it had the wrong version,
1.0.8 in the WEB-INF/lib. The eclipse dependency analysis showed, that
1.0.14 was omitted in conflict with 1.0.8 (why?!).

I thought ok, than i can work with ranges now. I opened the pom of
project A and changed 1.0.8 to 1.0.14 and added a range to it, to
prevent such problems in the future:
	<dependency>
		<groupId>net.anotheria</groupId>
		<artifactId>ano-util</artifactId>
		<version>[1.0.14,)</version>
	</dependency>

After I rebuilt everything, what do you think I got? 1.0.14? No,
1.0.16-SNAPSHOT ????

Google leads me to this page:
http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges

which states:
Resolution of dependency ranges should not resolve to a snapshot
(development version) unless it is included as an explicit boundary.

So why am I getting a SNAPSHOT version?
And how can I state that the LATEST RELEASED version is what I
actually want as conflict resolution scenario (isn't it self-evident
actually??).

regards
Leon

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: understanding maven dependencies range

Posted by David Hoffer <dh...@gmail.com>.
I wish version ranges did/will get implemented the way it was first
stated, or something similar/equivalent.  As it is we had to abandon
that feature altogether, we basically solved the problem by keeping
everything as a snapshot until product release...so I mean 99% of the
time we work with snapshots (and that's with hundreds of builds/devs).
 That actually works fairly well except now that maven3 requires
timestamped snapshots that has caused lots of problems...still working
through those.

-Dave

On Mon, Sep 3, 2012 at 10:35 AM, Wayne Fay <wa...@gmail.com> wrote:
>> Google leads me to this page:
>> http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution
>>
>> which states:
>> Resolution of dependency ranges should not resolve to a snapshot
>> (development version) unless it is included as an explicit boundary.
>
> I guess you missed this at the top of the page:
> Dependency Mediation and Conflict Resolution
> Skip to end of metadata
> Added by Brett Porter, last edited by Carlos Sanchez on Jan 24, 2006
> This document describes the rest of the requirements for dependency
> management that have not yet been implemented for Maven 2.0,
> especially with regards to transitive dependencies.
>
> What you found there is not formal Maven documentation, but rather an
> old discussion of how Maven should work.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: understanding maven dependencies range

Posted by Wayne Fay <wa...@gmail.com>.
> Google leads me to this page:
> http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution
>
> which states:
> Resolution of dependency ranges should not resolve to a snapshot
> (development version) unless it is included as an explicit boundary.

I guess you missed this at the top of the page:
Dependency Mediation and Conflict Resolution
Skip to end of metadata
Added by Brett Porter, last edited by Carlos Sanchez on Jan 24, 2006
This document describes the rest of the requirements for dependency
management that have not yet been implemented for Maven 2.0,
especially with regards to transitive dependencies.

What you found there is not formal Maven documentation, but rather an
old discussion of how Maven should work.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: understanding maven dependencies range

Posted by David Hoffer <dh...@gmail.com>.
Yeah, I too ran into the version range bug, where it would resolve to
snapshots when it was not supposed to...in Maven2.  It was such a big
problem it forced us to not use version ranges at all in Maven2, which
is unfortunate because it could have been an elegant solution.

I know jira issues were created and there were lots of discussions at
that time...now that Maven3 is out...I was hoping that version ranges
would be fixed but I don't know if that's the case or not...since we
have worked around them I haven't looked at this issue for years now.
(Apparently not if your using Maven3.)

However in your case I don't think you need version ranges, can't you
just specify the actual version you want to use in your
depedencyManagement section?

-Dave

On Mon, Sep 3, 2012 at 5:31 AM, tobias maslowski
<to...@gmail.com> wrote:
> Hello,
>
> as far as I understand your message, there are two problems.
> First:
> Your project C (depending on A and B) needs to resolve the transitive
> ano-util artifact to version 1.0.14 instead of 1.0.8. In my experience it's
> the easiest way to explicitly declare this dependency in project C. (It
> makes logically sense, since it incoorperates A and B by providing the
> correct version of ano-util)
> If you do not want to do this, you might want to read about the
> dependency-mechanisms (
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html)
> Or to put it short: in C you'll probably have declared the dependency to A
> above the one to B, so the version declared in A will be considered.
>
> Second Problem:
> In your place I would try to avoid using dependency-ranges. I dont think
> you need them and it makes things far more complicated than they need to be.
> But you are right, they should not resolve to a snapshot version, if you
> did not configure the versions plugin to do so. If you did not do so, I'm
> afraid I can't help you with this one.
>
> regards.
>
>
> 2012/9/3 Leon Rosenberg <ro...@gmail.com>
>
>> Hello,
>>
>> I have two modules, say A and B, which are using the same library, one
>> is using 1.0.8 and one 1.0.14:
>>                 <dependency>
>>                         <groupId>net.anotheria</groupId>
>>                         <artifactId>ano-util</artifactId>
>>                         <version>1.0.14</version>
>>                 </dependency>
>>
>> A third module (a web-app) uses both A and B. After I built the third
>> module, it wasn't able to start, because it had the wrong version,
>> 1.0.8 in the WEB-INF/lib. The eclipse dependency analysis showed, that
>> 1.0.14 was omitted in conflict with 1.0.8 (why?!).
>>
>> I thought ok, than i can work with ranges now. I opened the pom of
>> project A and changed 1.0.8 to 1.0.14 and added a range to it, to
>> prevent such problems in the future:
>>         <dependency>
>>                 <groupId>net.anotheria</groupId>
>>                 <artifactId>ano-util</artifactId>
>>                 <version>[1.0.14,)</version>
>>         </dependency>
>>
>> After I rebuilt everything, what do you think I got? 1.0.14? No,
>> 1.0.16-SNAPSHOT ????
>>
>> Google leads me to this page:
>>
>> http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges
>>
>> which states:
>> Resolution of dependency ranges should not resolve to a snapshot
>> (development version) unless it is included as an explicit boundary.
>>
>> So why am I getting a SNAPSHOT version?
>> And how can I state that the LATEST RELEASED version is what I
>> actually want as conflict resolution scenario (isn't it self-evident
>> actually??).
>>
>> regards
>> Leon
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: understanding maven dependencies range

Posted by tobias maslowski <to...@gmail.com>.
Hello,

as far as I understand your message, there are two problems.
First:
Your project C (depending on A and B) needs to resolve the transitive
ano-util artifact to version 1.0.14 instead of 1.0.8. In my experience it's
the easiest way to explicitly declare this dependency in project C. (It
makes logically sense, since it incoorperates A and B by providing the
correct version of ano-util)
If you do not want to do this, you might want to read about the
dependency-mechanisms (
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html)
Or to put it short: in C you'll probably have declared the dependency to A
above the one to B, so the version declared in A will be considered.

Second Problem:
In your place I would try to avoid using dependency-ranges. I dont think
you need them and it makes things far more complicated than they need to be.
But you are right, they should not resolve to a snapshot version, if you
did not configure the versions plugin to do so. If you did not do so, I'm
afraid I can't help you with this one.

regards.


2012/9/3 Leon Rosenberg <ro...@gmail.com>

> Hello,
>
> I have two modules, say A and B, which are using the same library, one
> is using 1.0.8 and one 1.0.14:
>                 <dependency>
>                         <groupId>net.anotheria</groupId>
>                         <artifactId>ano-util</artifactId>
>                         <version>1.0.14</version>
>                 </dependency>
>
> A third module (a web-app) uses both A and B. After I built the third
> module, it wasn't able to start, because it had the wrong version,
> 1.0.8 in the WEB-INF/lib. The eclipse dependency analysis showed, that
> 1.0.14 was omitted in conflict with 1.0.8 (why?!).
>
> I thought ok, than i can work with ranges now. I opened the pom of
> project A and changed 1.0.8 to 1.0.14 and added a range to it, to
> prevent such problems in the future:
>         <dependency>
>                 <groupId>net.anotheria</groupId>
>                 <artifactId>ano-util</artifactId>
>                 <version>[1.0.14,)</version>
>         </dependency>
>
> After I rebuilt everything, what do you think I got? 1.0.14? No,
> 1.0.16-SNAPSHOT ????
>
> Google leads me to this page:
>
> http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges
>
> which states:
> Resolution of dependency ranges should not resolve to a snapshot
> (development version) unless it is included as an explicit boundary.
>
> So why am I getting a SNAPSHOT version?
> And how can I state that the LATEST RELEASED version is what I
> actually want as conflict resolution scenario (isn't it self-evident
> actually??).
>
> regards
> Leon
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: understanding maven dependencies range

Posted by Martin Gainty <mg...@hotmail.com>.
Good Morning Leon
I remember running into this failure of version ranges..as recently as ths weekend...it seems that specific version always works
fuzzy searches e.g. 		<version>[1.0.14,2.0)</version> fail so some of  the examples displayed here
http://mojo.codehaus.org/versions-maven-plugin/examples/resolve-ranges.html
do not deliver the version that 'falls' within the specified range..

can you try comma and space delimiter e.g.
<version>[2.0.7, 2.0.9)</version>

This version-range bug issue was first reported in 2007 
http://jira.codehaus.org/browse/MNG-2742

If you are finding consistent failure update the JIRA with a specific testcase
at least ONE of us will take a look at this and get the version range resolved

Thanks for identifying the bug!
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.


> Date: Mon, 3 Sep 2012 12:56:15 +0200
> Subject: understanding maven dependencies range
> From: rosenberg.leon@gmail.com
> To: users@maven.apache.org
> 
> Hello,
> 
> I have two modules, say A and B, which are using the same library, one
> is using 1.0.8 and one 1.0.14:
> 		<dependency>
> 			<groupId>net.anotheria</groupId>
> 			<artifactId>ano-util</artifactId>
> 			<version>1.0.14</version>
> 		</dependency>
> 
> A third module (a web-app) uses both A and B. After I built the third
> module, it wasn't able to start, because it had the wrong version,
> 1.0.8 in the WEB-INF/lib. The eclipse dependency analysis showed, that
> 1.0.14 was omitted in conflict with 1.0.8 (why?!).
> 
> I thought ok, than i can work with ranges now. I opened the pom of
> project A and changed 1.0.8 to 1.0.14 and added a range to it, to
> prevent such problems in the future:
> 	<dependency>
> 		<groupId>net.anotheria</groupId>
> 		<artifactId>ano-util</artifactId>
> 		<version>[1.0.14,)</version>
> 	</dependency>
> 
> After I rebuilt everything, what do you think I got? 1.0.14? No,
> 1.0.16-SNAPSHOT ????
> 
> Google leads me to this page:
> http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges
> 
> which states:
> Resolution of dependency ranges should not resolve to a snapshot
> (development version) unless it is included as an explicit boundary.
> 
> So why am I getting a SNAPSHOT version?
> And how can I state that the LATEST RELEASED version is what I
> actually want as conflict resolution scenario (isn't it self-evident
> actually??).
> 
> regards
> Leon
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>