You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Grau Aracil, Manuel" <mg...@eservicios.indra.es> on 2010/08/31 11:43:25 UTC

using 2 or more different version of an artifact in a single pom

Hi all,

We have some applications developed using AndroMDA Project, that uses Maven 1.0.2. Some modules of our applications need more than one version of the same artifact. The problem is that maven identifies artifacts with groupId and artifactId, so, if a pom file includes the same artifact more than one time, with different versions, maven only gets one. Is there any way to force maven getting all of them? We thought a solution: define these dependencies with different names and use <jar> tag to point to the library. But, we don't like this solution, is not very clean. Any ideas?

Thanks

RE: using 2 or more different version of an artifact in a single pom

Posted by "Grau Aracil, Manuel" <mg...@eservicios.indra.es>.
"The following specifies the minimum requirements to run this Maven plugin:
Maven 	2.0.6"

We can't use this plugin, as I told you, we use maven 1.0.2

-----Mensaje original-----
De: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Enviado el: martes, 31 de agosto de 2010 12:12
Para: Maven Users List
Asunto: Re: using 2 or more different version of an artifact in a single pom

2010/8/31 Grau Aracil, Manuel <mg...@eservicios.indra.es>:
> Is a dependency from a dependency. Suppose our project uses artifact XXX-1.0, and, a jar from our project uses XXX-1.1.

If they are binary-compatible, then I suggest to choose one (the most
recent one, I suppose) and exclude the other.
If they are not, well, welcome to jar hell :-D
In fact, Maven is protecting you from a potential problem: same
classes in different jars, that *will* cripple your classloader. It's
not a Maven problem, but a Java feature.
In this case, the best approach is to migrate your project to use 1.1
version of that dependency.
You might use the Shade plugin to get a version of a library with
modified package names:
http://maven.apache.org/plugins/maven-shade-plugin/examples/class-relocation.html
But, in your case, I think that migration is easier... or not?

Antonio

---------------------------------------------------------------------
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: using 2 or more different version of an artifact in a single pom

Posted by Antonio Petrelli <an...@gmail.com>.
2010/8/31 Grau Aracil, Manuel <mg...@eservicios.indra.es>:
> Is not eassier. I've discovered that transitive dependencies is a maven 2 feature, with maven 1 that is not possible. This is a project of about 200 people, we can't change that.

I meant, migration from 1.0 version of the offending library to 1.1,
as you stated in your example. Choose one.

Antonio

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


RE: using 2 or more different version of an artifact in a single pom

Posted by "Grau Aracil, Manuel" <mg...@eservicios.indra.es>.
Is not eassier. I've discovered that transitive dependencies is a maven 2 feature, with maven 1 that is not possible. This is a project of about 200 people, we can't change that.  

-----Mensaje original-----
De: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Enviado el: martes, 31 de agosto de 2010 12:12
Para: Maven Users List
Asunto: Re: using 2 or more different version of an artifact in a single pom

2010/8/31 Grau Aracil, Manuel <mg...@eservicios.indra.es>:
> Is a dependency from a dependency. Suppose our project uses artifact XXX-1.0, and, a jar from our project uses XXX-1.1.

If they are binary-compatible, then I suggest to choose one (the most
recent one, I suppose) and exclude the other.
If they are not, well, welcome to jar hell :-D
In fact, Maven is protecting you from a potential problem: same
classes in different jars, that *will* cripple your classloader. It's
not a Maven problem, but a Java feature.
In this case, the best approach is to migrate your project to use 1.1
version of that dependency.
You might use the Shade plugin to get a version of a library with
modified package names:
http://maven.apache.org/plugins/maven-shade-plugin/examples/class-relocation.html
But, in your case, I think that migration is easier... or not?

Antonio

---------------------------------------------------------------------
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: using 2 or more different version of an artifact in a single pom

Posted by Antonio Petrelli <an...@gmail.com>.
2010/8/31 Grau Aracil, Manuel <mg...@eservicios.indra.es>:
> Is a dependency from a dependency. Suppose our project uses artifact XXX-1.0, and, a jar from our project uses XXX-1.1.

If they are binary-compatible, then I suggest to choose one (the most
recent one, I suppose) and exclude the other.
If they are not, well, welcome to jar hell :-D
In fact, Maven is protecting you from a potential problem: same
classes in different jars, that *will* cripple your classloader. It's
not a Maven problem, but a Java feature.
In this case, the best approach is to migrate your project to use 1.1
version of that dependency.
You might use the Shade plugin to get a version of a library with
modified package names:
http://maven.apache.org/plugins/maven-shade-plugin/examples/class-relocation.html
But, in your case, I think that migration is easier... or not?

Antonio

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


RE: using 2 or more different version of an artifact in a single pom

Posted by "Grau Aracil, Manuel" <mg...@eservicios.indra.es>.
Is a dependency from a dependency. Suppose our project uses artifact XXX-1.0, and, a jar from our project uses XXX-1.1.

-----Mensaje original-----
De: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Enviado el: martes, 31 de agosto de 2010 11:57
Para: Maven Users List
Asunto: Re: using 2 or more different version of an artifact in a single pom

2010/8/31 Grau Aracil, Manuel <mg...@eservicios.indra.es>:
> Because some components use different versions of the same artifact. I know that this is not a good design, but I can't do nothing.

This is a tautology, not explanation.
Why would someone want to use different versions of the same class?
Wouln't it cripple the classloader?
IOW, what do you make of two classes in different jars?

Antonio

---------------------------------------------------------------------
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: using 2 or more different version of an artifact in a single pom

Posted by Antonio Petrelli <an...@gmail.com>.
2010/8/31 Grau Aracil, Manuel <mg...@eservicios.indra.es>:
> Because some components use different versions of the same artifact. I know that this is not a good design, but I can't do nothing.

This is a tautology, not explanation.
Why would someone want to use different versions of the same class?
Wouln't it cripple the classloader?
IOW, what do you make of two classes in different jars?

Antonio

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


RE: using 2 or more different version of an artifact in a single pom

Posted by "Grau Aracil, Manuel" <mg...@eservicios.indra.es>.
Because some components use different versions of the same artifact. I know that this is not a good design, but I can't do nothing. 

-----Mensaje original-----
De: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Enviado el: martes, 31 de agosto de 2010 11:46
Para: Maven Users List
Asunto: Re: using 2 or more different version of an artifact in a single pom

2010/8/31 Grau Aracil, Manuel <mg...@eservicios.indra.es>:
> Some modules of our applications need more than one version of the same artifact.

Can you explain why? This is not a typical use case.

Antonio

---------------------------------------------------------------------
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: using 2 or more different version of an artifact in a single pom

Posted by Antonio Petrelli <an...@gmail.com>.
2010/8/31 Grau Aracil, Manuel <mg...@eservicios.indra.es>:
> Some modules of our applications need more than one version of the same artifact.

Can you explain why? This is not a typical use case.

Antonio

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