You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Martin Kacer <ma...@kacer.net> on 2009/01/20 21:02:03 UTC
How to specify conflicting versions in Maven?
Hi there,
I am wondering whether it is possible to specify that some existing JAR
version will NOT work with my artifact (library), though it is not my
own dependency.
Let me illustrate the problem by a very simplified example:
We have two libraries, both managed by Maven: Library 1 is called BASIC
and provides some common utilities used in many other projects.
Library 2 is called EXTENDED and it depends on BASIC because it uses
those utilities.
Both libraries exist in many versions: 1.0, 1.1, etc. In a repository,
we have various jar artifacts (such as BASIC-1.4.jar, EXTENDED-1.2.jar
etc.) and also POM files specifying dependencies between them. For
example, EXTENDED-1.2.pom defines a dependency on artifactId="BASIC",
version="[1.0,)".
After some time, I decide to release a new version of BASIC, numbered 2.0.
Unfortunately, there is an incompatible change in the library API that
will cause the EXTENDED library version 1.x to stop working. Therefore,
I also have to release a new version of EXTENDED: EXTENDED-2.0.jar.
Is there some way to specify that BASIC-2.0 will _not_ work with EXTENDED
version < 2.0? In other words, I want to prevent top projects from
declaring something like:
<dependency><artifactId>BASIC</artifactId><version>2.0</version></dependency>
<dependency><artifactId>EXTENDED</artifactId><version>1.2</version></dependency>
Of course, the conflict could be specified in the POM of EXTENDED 1.2.
But it was not known in the time of 1.2 release yet.
Sorry if I overlooked something, but I was not able to find this in the
Maven documentation and it is a crucial feature for me.
Thanks for any help...
Martin Kacer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to specify conflicting versions in Maven?
Posted by Rusty Wright <ru...@gmail.com>.
I wonder if OSGi would help (for example, Apache Felix)? It might help at runtime, but I don't know if it would help with the maven builds. Perhaps the Apache Felix documentation offers suggestions when using maven.
Martin Kacer wrote:
> Simple but not always true.
>
> First, the fact that EXTENDED depends on BASIC is an internal issue of
> the EXTENDED library. Future versions may not depend on it and top-level
> projects should not be aware of the dependency.
>
> Second, the conflict may also occur between projects (libraries) without
> a direct dependecy. Imagine we have two optional modules, each of them
> may be used separately by a top-level project. But if both of them are
> used together, there are some limits on version numbers (such as, module
> A will not work with B of version smaller than 2.0).
>
> Martin
>
>
> On Wed, 21 Jan 2009, Jeff MAURY wrote:
> # If EXTENDED depends on BASIC, then your POM user should only declare
> # EXTENDED as a dependency and not BASIC.
> #
> # Jeff MAURY
> #
> # On Tue, Jan 20, 2009 at 9:02 PM, Martin Kacer <ma...@kacer.net> wrote:
> #
> # > Hi there,
> # >
> # > I am wondering whether it is possible to specify that some existing JAR
> # > version will NOT work with my artifact (library), though it is not my
> # > own dependency.
> # >
> # > Let me illustrate the problem by a very simplified example:
> # > We have two libraries, both managed by Maven: Library 1 is called BASIC and
> # > provides some common utilities used in many other projects.
> # > Library 2 is called EXTENDED and it depends on BASIC because it uses
> # > those utilities.
> # >
> # > Both libraries exist in many versions: 1.0, 1.1, etc. In a repository,
> # > we have various jar artifacts (such as BASIC-1.4.jar, EXTENDED-1.2.jar
> # > etc.) and also POM files specifying dependencies between them. For example,
> # > EXTENDED-1.2.pom defines a dependency on artifactId="BASIC",
> # > version="[1.0,)".
> # >
> # > After some time, I decide to release a new version of BASIC, numbered 2.0.
> # > Unfortunately, there is an incompatible change in the library API that will
> # > cause the EXTENDED library version 1.x to stop working. Therefore,
> # > I also have to release a new version of EXTENDED: EXTENDED-2.0.jar.
> # >
> # > Is there some way to specify that BASIC-2.0 will _not_ work with EXTENDED
> # > version < 2.0? In other words, I want to prevent top projects from declaring
> # > something like:
> # >
> # >
> # > <dependency><artifactId>BASIC</artifactId><version>2.0</version></dependency>
> # >
> # > <dependency><artifactId>EXTENDED</artifactId><version>1.2</version></dependency>
> # >
> # > Of course, the conflict could be specified in the POM of EXTENDED 1.2.
> # > But it was not known in the time of 1.2 release yet.
> # >
> # >
> # > Sorry if I overlooked something, but I was not able to find this in the
> # > Maven documentation and it is a crucial feature for me.
> # >
> # > Thanks for any help...
> # > Martin Kacer
> # >
> # > ---------------------------------------------------------------------
> # > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> # > For additional commands, e-mail: users-help@maven.apache.org
> # >
> # >
> #
> #
> # --
> # La mélancolie c'est communiste
> # Tout le monde y a droit de temps en temps
> # La mélancolie n'est pas capitaliste
> # C'est m?me gratuit pour les perdants
> # La mélancolie c'est pacifiste
> # On ne lui rentre jamais dedans
> # La mélancolie oh tu sais ça existe
> # Elle se prend m?me avec des gants
> # La mélancolie c'est pour les syndicalistes
> # Il faut juste sa carte de permanent
> #
> # Miossec (2006)
> #
> # http://www.jeffmaury.com
> # http://riadiscuss.jeffmaury.com
> # http://www.lastfm.fr/listen/user/jeffmaury/personal
> # Mes CDs ? récupérer:
> # http://spreadsheets.google.com/ccc?key=pNeg4Doa_oCsh7CepKPaPTA&hl=en
> #
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> 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: How to specify conflicting versions in Maven?
Posted by Martin Kacer <ma...@kacer.net>.
Simple but not always true.
First, the fact that EXTENDED depends on BASIC is an internal issue of
the EXTENDED library. Future versions may not depend on it and top-level
projects should not be aware of the dependency.
Second, the conflict may also occur between projects (libraries) without
a direct dependecy. Imagine we have two optional modules, each of them
may be used separately by a top-level project. But if both of them are
used together, there are some limits on version numbers (such as, module
A will not work with B of version smaller than 2.0).
Martin
On Wed, 21 Jan 2009, Jeff MAURY wrote:
# If EXTENDED depends on BASIC, then your POM user should only declare
# EXTENDED as a dependency and not BASIC.
#
# Jeff MAURY
#
# On Tue, Jan 20, 2009 at 9:02 PM, Martin Kacer <ma...@kacer.net> wrote:
#
# > Hi there,
# >
# > I am wondering whether it is possible to specify that some existing JAR
# > version will NOT work with my artifact (library), though it is not my
# > own dependency.
# >
# > Let me illustrate the problem by a very simplified example:
# > We have two libraries, both managed by Maven: Library 1 is called BASIC and
# > provides some common utilities used in many other projects.
# > Library 2 is called EXTENDED and it depends on BASIC because it uses
# > those utilities.
# >
# > Both libraries exist in many versions: 1.0, 1.1, etc. In a repository,
# > we have various jar artifacts (such as BASIC-1.4.jar, EXTENDED-1.2.jar
# > etc.) and also POM files specifying dependencies between them. For example,
# > EXTENDED-1.2.pom defines a dependency on artifactId="BASIC",
# > version="[1.0,)".
# >
# > After some time, I decide to release a new version of BASIC, numbered 2.0.
# > Unfortunately, there is an incompatible change in the library API that will
# > cause the EXTENDED library version 1.x to stop working. Therefore,
# > I also have to release a new version of EXTENDED: EXTENDED-2.0.jar.
# >
# > Is there some way to specify that BASIC-2.0 will _not_ work with EXTENDED
# > version < 2.0? In other words, I want to prevent top projects from declaring
# > something like:
# >
# >
# > <dependency><artifactId>BASIC</artifactId><version>2.0</version></dependency>
# >
# > <dependency><artifactId>EXTENDED</artifactId><version>1.2</version></dependency>
# >
# > Of course, the conflict could be specified in the POM of EXTENDED 1.2.
# > But it was not known in the time of 1.2 release yet.
# >
# >
# > Sorry if I overlooked something, but I was not able to find this in the
# > Maven documentation and it is a crucial feature for me.
# >
# > Thanks for any help...
# > Martin Kacer
# >
# > ---------------------------------------------------------------------
# > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
# > For additional commands, e-mail: users-help@maven.apache.org
# >
# >
#
#
# --
# La mélancolie c'est communiste
# Tout le monde y a droit de temps en temps
# La mélancolie n'est pas capitaliste
# C'est m?me gratuit pour les perdants
# La mélancolie c'est pacifiste
# On ne lui rentre jamais dedans
# La mélancolie oh tu sais ça existe
# Elle se prend m?me avec des gants
# La mélancolie c'est pour les syndicalistes
# Il faut juste sa carte de permanent
#
# Miossec (2006)
#
# http://www.jeffmaury.com
# http://riadiscuss.jeffmaury.com
# http://www.lastfm.fr/listen/user/jeffmaury/personal
# Mes CDs ? récupérer:
# http://spreadsheets.google.com/ccc?key=pNeg4Doa_oCsh7CepKPaPTA&hl=en
#
Re: How to specify conflicting versions in Maven?
Posted by Jeff MAURY <je...@jeffmaury.com>.
If EXTENDED depends on BASIC, then your POM user should only declare
EXTENDED as a dependency and not BASIC.
Jeff MAURY
On Tue, Jan 20, 2009 at 9:02 PM, Martin Kacer <ma...@kacer.net> wrote:
> Hi there,
>
> I am wondering whether it is possible to specify that some existing JAR
> version will NOT work with my artifact (library), though it is not my
> own dependency.
>
> Let me illustrate the problem by a very simplified example:
> We have two libraries, both managed by Maven: Library 1 is called BASIC and
> provides some common utilities used in many other projects.
> Library 2 is called EXTENDED and it depends on BASIC because it uses
> those utilities.
>
> Both libraries exist in many versions: 1.0, 1.1, etc. In a repository,
> we have various jar artifacts (such as BASIC-1.4.jar, EXTENDED-1.2.jar
> etc.) and also POM files specifying dependencies between them. For example,
> EXTENDED-1.2.pom defines a dependency on artifactId="BASIC",
> version="[1.0,)".
>
> After some time, I decide to release a new version of BASIC, numbered 2.0.
> Unfortunately, there is an incompatible change in the library API that will
> cause the EXTENDED library version 1.x to stop working. Therefore,
> I also have to release a new version of EXTENDED: EXTENDED-2.0.jar.
>
> Is there some way to specify that BASIC-2.0 will _not_ work with EXTENDED
> version < 2.0? In other words, I want to prevent top projects from declaring
> something like:
>
>
> <dependency><artifactId>BASIC</artifactId><version>2.0</version></dependency>
>
> <dependency><artifactId>EXTENDED</artifactId><version>1.2</version></dependency>
>
> Of course, the conflict could be specified in the POM of EXTENDED 1.2.
> But it was not known in the time of 1.2 release yet.
>
>
> Sorry if I overlooked something, but I was not able to find this in the
> Maven documentation and it is a crucial feature for me.
>
> Thanks for any help...
> Martin Kacer
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
--
La mélancolie c'est communiste
Tout le monde y a droit de temps en temps
La mélancolie n'est pas capitaliste
C'est même gratuit pour les perdants
La mélancolie c'est pacifiste
On ne lui rentre jamais dedans
La mélancolie oh tu sais ça existe
Elle se prend même avec des gants
La mélancolie c'est pour les syndicalistes
Il faut juste sa carte de permanent
Miossec (2006)
http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.lastfm.fr/listen/user/jeffmaury/personal
Mes CDs à récupérer:
http://spreadsheets.google.com/ccc?key=pNeg4Doa_oCsh7CepKPaPTA&hl=en