You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Anthony Dahanne <an...@gmail.com> on 2012/10/05 16:00:50 UTC

specifying different dependencies according to versions

Hello all,
We recently changed the packaging of some modules in our application :
    <dependency>
      <groupId>my.company</groupId>
      <artifactId>my.artifact.core</artifactId>
      <version>2.5.0-SNAPSHOT</version>
    </dependency>
 to
    <dependency>
      <groupId>my.company.internal</groupId>
      <artifactId>my.artifact.core</artifactId>
      <version>2.6.0-SNAPSHOT</version>
    </dependency>

as this is internal now, we created a new module

 <dependency>
      <groupId>my.company</groupId>
      <artifactId>my.artifact</artifactId>
      <version>2.6.0-SNAPSHOT</version>
    </dependency>


I have a maven module that could depend on
my.company:my.artifact.core:2.5.0-SNAPSHOT as well as any other
following releases, including my.company:my.artifact:2.6.0-SNAPSHOT
I could have used a version range such as: <version>[2.5.0,)</version>
 if only my packaging did not change...

My question is : can we tell maven to depend on
my.company:my.artifact.core for  a certain range of version and
depend on my.company:my.artifact for another range of version?

Thank you very much for your answers,
Anthony

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


Re: specifying different dependencies according to versions

Posted by Ron Wheeler <rw...@artifact-software.com>.
Sorry for more questions than answers.
I am glad that it provided a creative push.

We use exclusions extensively in our builds to ensure that we get the 
"right" version at run-time and they work "as advertised".

Ron

On 05/10/2012 11:30 AM, Anthony Dahanne wrote:
> Hello Ron,
> Let me try to explain with other terms what we have and we want to do
> : we have refactored an artifact, changing his name and even its group
> name;
> * from version 1.0.0 to 2.5.0, this artifact was named
> my.company:my.artifact.core:version
> * from version 2.5.1 and up , this artifact is named
> my.company:my.artifact:version
>
> We have consumers of this artifact, that may depend on it directly and
> indirectly.
>
> Well, we were afraid of dependency clashes, and this is why we talked
> about version ranges (imagining a dependency chooses the right
> version, and other ones, using range versions, just cope with it)
> instead of specifying directly the right version.
>
> Now reading your email, and trying to answer your questions , I
> finally found out that transitive dependencies clashes can be avoided
> with exclusion
> http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html
>
> Problem solved :-)
> Thanks,
> Anthony
>
>
> On Fri, Oct 5, 2012 at 10:14 AM, Ron Wheeler
> <rw...@artifact-software.com> wrote:
>> What are you trying to accomplish?
>> Why is your situation different from the normal system development process
>> that everyone else uses.
>>
>> What version do you want to run at run-time?
>>
>> In the pom of the artifact that you are making, set the dependency to the
>> version of <artifactId>my.artifact.core</artifactId> that you want to build
>> with.
>>
>>
>> It is hard to see what you are trying to tell us with this
>>
>>
>> "as this is internal now, we created a new module
>>
>>   <dependency>
>>        <groupId>my.company</groupId>
>>        <artifactId>my.artifact</artifactId>
>>        <version>2.6.0-SNAPSHOT</version>
>>      </dependency>
>> "
>> In what POM does this dependency appear? Why? How does this relate to
>> ....-core.
>>
>> If you followed last weeks discussion about version ranges, you might have
>> noted that they are regarded by most as inherently evil and by others as
>> poorly implemented.
>>
>> In general, you should pick a version of the dependency that you want to
>> build with and identify it with a specific version.
>>
>> A range of SNAPSHOTs makes no sense to me at all.
>>   Ron
>>
>>
>>
>>
>>
>> On 05/10/2012 10:00 AM, Anthony Dahanne wrote:
>>> Hello all,
>>> We recently changed the packaging of some modules in our application :
>>>       <dependency>
>>>         <groupId>my.company</groupId>
>>>         <artifactId>my.artifact.core</artifactId>
>>>         <version>2.5.0-SNAPSHOT</version>
>>>       </dependency>
>>>    to
>>>       <dependency>
>>>         <groupId>my.company.internal</groupId>
>>>         <artifactId>my.artifact.core</artifactId>
>>>         <version>2.6.0-SNAPSHOT</version>
>>>       </dependency>
>>>
>>> as this is internal now, we created a new module
>>>
>>>    <dependency>
>>>         <groupId>my.company</groupId>
>>>         <artifactId>my.artifact</artifactId>
>>>         <version>2.6.0-SNAPSHOT</version>
>>>       </dependency>
>>>
>>>
>>> I have a maven module that could depend on
>>> my.company:my.artifact.core:2.5.0-SNAPSHOT as well as any other
>>> following releases, including my.company:my.artifact:2.6.0-SNAPSHOT
>>> I could have used a version range such as: <version>[2.5.0,)</version>
>>>    if only my packaging did not change...
>>>
>>> My question is : can we tell maven to depend on
>>> my.company:my.artifact.core for  a certain range of version and
>>> depend on my.company:my.artifact for another range of version?
>>>
>>> Thank you very much for your answers,
>>> Anthony
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>> --
>> Ron Wheeler
>> President
>> Artifact Software Inc
>> email: rwheeler@artifact-software.com
>> skype: ronaldmwheeler
>> phone: 866-970-2435, ext 102
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


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


Re: specifying different dependencies according to versions

Posted by Anthony Dahanne <an...@gmail.com>.
Hello Ron,
Let me try to explain with other terms what we have and we want to do
: we have refactored an artifact, changing his name and even its group
name;
* from version 1.0.0 to 2.5.0, this artifact was named
my.company:my.artifact.core:version
* from version 2.5.1 and up , this artifact is named
my.company:my.artifact:version

We have consumers of this artifact, that may depend on it directly and
indirectly.

Well, we were afraid of dependency clashes, and this is why we talked
about version ranges (imagining a dependency chooses the right
version, and other ones, using range versions, just cope with it)
instead of specifying directly the right version.

Now reading your email, and trying to answer your questions , I
finally found out that transitive dependencies clashes can be avoided
with exclusion
http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html

Problem solved :-)
Thanks,
Anthony


On Fri, Oct 5, 2012 at 10:14 AM, Ron Wheeler
<rw...@artifact-software.com> wrote:
> What are you trying to accomplish?
> Why is your situation different from the normal system development process
> that everyone else uses.
>
> What version do you want to run at run-time?
>
> In the pom of the artifact that you are making, set the dependency to the
> version of <artifactId>my.artifact.core</artifactId> that you want to build
> with.
>
>
> It is hard to see what you are trying to tell us with this
>
>
> "as this is internal now, we created a new module
>
>  <dependency>
>       <groupId>my.company</groupId>
>       <artifactId>my.artifact</artifactId>
>       <version>2.6.0-SNAPSHOT</version>
>     </dependency>
> "
> In what POM does this dependency appear? Why? How does this relate to
> ....-core.
>
> If you followed last weeks discussion about version ranges, you might have
> noted that they are regarded by most as inherently evil and by others as
> poorly implemented.
>
> In general, you should pick a version of the dependency that you want to
> build with and identify it with a specific version.
>
> A range of SNAPSHOTs makes no sense to me at all.
>  Ron
>
>
>
>
>
> On 05/10/2012 10:00 AM, Anthony Dahanne wrote:
>>
>> Hello all,
>> We recently changed the packaging of some modules in our application :
>>      <dependency>
>>        <groupId>my.company</groupId>
>>        <artifactId>my.artifact.core</artifactId>
>>        <version>2.5.0-SNAPSHOT</version>
>>      </dependency>
>>   to
>>      <dependency>
>>        <groupId>my.company.internal</groupId>
>>        <artifactId>my.artifact.core</artifactId>
>>        <version>2.6.0-SNAPSHOT</version>
>>      </dependency>
>>
>> as this is internal now, we created a new module
>>
>>   <dependency>
>>        <groupId>my.company</groupId>
>>        <artifactId>my.artifact</artifactId>
>>        <version>2.6.0-SNAPSHOT</version>
>>      </dependency>
>>
>>
>> I have a maven module that could depend on
>> my.company:my.artifact.core:2.5.0-SNAPSHOT as well as any other
>> following releases, including my.company:my.artifact:2.6.0-SNAPSHOT
>> I could have used a version range such as: <version>[2.5.0,)</version>
>>   if only my packaging did not change...
>>
>> My question is : can we tell maven to depend on
>> my.company:my.artifact.core for  a certain range of version and
>> depend on my.company:my.artifact for another range of version?
>>
>> Thank you very much for your answers,
>> Anthony
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: rwheeler@artifact-software.com
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
> ---------------------------------------------------------------------
> 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: specifying different dependencies according to versions

Posted by Ron Wheeler <rw...@artifact-software.com>.
What are you trying to accomplish?
Why is your situation different from the normal system development 
process that everyone else uses.

What version do you want to run at run-time?

In the pom of the artifact that you are making, set the dependency to 
the version of <artifactId>my.artifact.core</artifactId> that you want 
to build with.


It is hard to see what you are trying to tell us with this

"as this is internal now, we created a new module

  <dependency>
       <groupId>my.company</groupId>
       <artifactId>my.artifact</artifactId>
       <version>2.6.0-SNAPSHOT</version>
     </dependency>
"
In what POM does this dependency appear? Why? How does this relate to ....-core.

If you followed last weeks discussion about version ranges, you might have noted that they are regarded by most as inherently evil and by others as poorly implemented.

In general, you should pick a version of the dependency that you want to build with and identify it with a specific version.

A range of SNAPSHOTs makes no sense to me at all.
  
Ron




On 05/10/2012 10:00 AM, Anthony Dahanne wrote:
> Hello all,
> We recently changed the packaging of some modules in our application :
>      <dependency>
>        <groupId>my.company</groupId>
>        <artifactId>my.artifact.core</artifactId>
>        <version>2.5.0-SNAPSHOT</version>
>      </dependency>
>   to
>      <dependency>
>        <groupId>my.company.internal</groupId>
>        <artifactId>my.artifact.core</artifactId>
>        <version>2.6.0-SNAPSHOT</version>
>      </dependency>
>
> as this is internal now, we created a new module
>
>   <dependency>
>        <groupId>my.company</groupId>
>        <artifactId>my.artifact</artifactId>
>        <version>2.6.0-SNAPSHOT</version>
>      </dependency>
>
>
> I have a maven module that could depend on
> my.company:my.artifact.core:2.5.0-SNAPSHOT as well as any other
> following releases, including my.company:my.artifact:2.6.0-SNAPSHOT
> I could have used a version range such as: <version>[2.5.0,)</version>
>   if only my packaging did not change...
>
> My question is : can we tell maven to depend on
> my.company:my.artifact.core for  a certain range of version and
> depend on my.company:my.artifact for another range of version?
>
> Thank you very much for your answers,
> Anthony
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


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