You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by aldana <al...@gmx.de> on 2007/08/23 10:42:37 UTC

assembly plugin: ordering of dependencies

hi,

i am facing following problem:
when building assembly there are two libraries (A.jar+B.jar) which contain
same classes (packageName + className). looking at this library A.jar
contains a class which offers different public methods as B.jar. assembly
plugin now overrides this A.jar class with B.jar classes. 

result of this, that application gives me a NotSuchMethodException.
unfortunately i cannot replace A with B or otherwise. both need to be
assembled into one jar. 

so how is it possible to configure following in assembly plugin:
-dependency X defined in pom.xml of  project P1 should be preferred over
dependency Y in pom.xml of project P2, when running assembly:assembly 

thanks in advance!

besides: i know i should change my architecture to avoid such a library
conflict (there should exist only one class version). but before refactoring
i need a quick solution to make a running release.




-- 
View this message in context: http://www.nabble.com/assembly-plugin%3A-ordering-of-dependencies-tf4316169s177.html#a12289677
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: assembly plugin: ordering of dependencies

Posted by Wayne Fay <wa...@gmail.com>.
You might try using the dependency:unpack mojo to unpack those 2 jars
on top of each other. I'm not positive it supports ordering but it
would be a quick test to find out if it would work for you. Assuming
you could unpack the old one first, and then the new one on top of it,
you would achieve the results you desire.

Then instead of including those 2 jars, you would just include their
*.class files directly.

Wayne

On 8/23/07, aldana <al...@gmx.de> wrote:
>
> alright, i'll try that as a quick solution. after having refactored i hope i
> get rid of this evil duplicate class-dependency.
>
>
> Tim Kettler wrote:
> >
> > Hi,
> >
> > As far as I know this is not supported by the assembly-plugin directly.
> >
> > If the two jars contain exactly the same set of classes (just different
> > versions) you can just exclude one of them via the <excludes/> tag. Or
> > you can try to define two distinct <dependencySet> respectivly
> > <moduleSet/> definitions. One containing the dependencies pulling in
> > A.jar, one with the dependencies pulling in B.jar and then try to switch
> > the order of the two definitions in your assembly descriptor and hope
> > that that switches the order in which the jars get copied.
> >
> > -Tim
> >
> > aldana schrieb:
> >> hi,
> >>
> >> i am facing following problem:
> >> when building assembly there are two libraries (A.jar+B.jar) which
> >> contain
> >> same classes (packageName + className). looking at this library A.jar
> >> contains a class which offers different public methods as B.jar. assembly
> >> plugin now overrides this A.jar class with B.jar classes.
> >>
> >> result of this, that application gives me a NotSuchMethodException.
> >> unfortunately i cannot replace A with B or otherwise. both need to be
> >> assembled into one jar.
> >>
> >> so how is it possible to configure following in assembly plugin:
> >> -dependency X defined in pom.xml of  project P1 should be preferred over
> >> dependency Y in pom.xml of project P2, when running assembly:assembly
> >>
> >> thanks in advance!
> >>
> >> besides: i know i should change my architecture to avoid such a library
> >> conflict (there should exist only one class version). but before
> >> refactoring
> >> i need a quick solution to make a running release.
> >>
> >>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/assembly-plugin%3A-ordering-of-dependencies-tf4316169s177.html#a12293947
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: assembly plugin: ordering of dependencies

Posted by aldana <al...@gmx.de>.
alright, i'll try that as a quick solution. after having refactored i hope i
get rid of this evil duplicate class-dependency.


Tim Kettler wrote:
> 
> Hi,
> 
> As far as I know this is not supported by the assembly-plugin directly.
> 
> If the two jars contain exactly the same set of classes (just different 
> versions) you can just exclude one of them via the <excludes/> tag. Or 
> you can try to define two distinct <dependencySet> respectivly 
> <moduleSet/> definitions. One containing the dependencies pulling in 
> A.jar, one with the dependencies pulling in B.jar and then try to switch 
> the order of the two definitions in your assembly descriptor and hope 
> that that switches the order in which the jars get copied.
> 
> -Tim
> 
> aldana schrieb:
>> hi,
>> 
>> i am facing following problem:
>> when building assembly there are two libraries (A.jar+B.jar) which
>> contain
>> same classes (packageName + className). looking at this library A.jar
>> contains a class which offers different public methods as B.jar. assembly
>> plugin now overrides this A.jar class with B.jar classes. 
>> 
>> result of this, that application gives me a NotSuchMethodException.
>> unfortunately i cannot replace A with B or otherwise. both need to be
>> assembled into one jar. 
>> 
>> so how is it possible to configure following in assembly plugin:
>> -dependency X defined in pom.xml of  project P1 should be preferred over
>> dependency Y in pom.xml of project P2, when running assembly:assembly 
>> 
>> thanks in advance!
>> 
>> besides: i know i should change my architecture to avoid such a library
>> conflict (there should exist only one class version). but before
>> refactoring
>> i need a quick solution to make a running release.
>> 
>> 
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/assembly-plugin%3A-ordering-of-dependencies-tf4316169s177.html#a12293947
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: assembly plugin: ordering of dependencies

Posted by Tim Kettler <ti...@udo.edu>.
Hi,

As far as I know this is not supported by the assembly-plugin directly.

If the two jars contain exactly the same set of classes (just different 
versions) you can just exclude one of them via the <excludes/> tag. Or 
you can try to define two distinct <dependencySet> respectivly 
<moduleSet/> definitions. One containing the dependencies pulling in 
A.jar, one with the dependencies pulling in B.jar and then try to switch 
the order of the two definitions in your assembly descriptor and hope 
that that switches the order in which the jars get copied.

-Tim

aldana schrieb:
> hi,
> 
> i am facing following problem:
> when building assembly there are two libraries (A.jar+B.jar) which contain
> same classes (packageName + className). looking at this library A.jar
> contains a class which offers different public methods as B.jar. assembly
> plugin now overrides this A.jar class with B.jar classes. 
> 
> result of this, that application gives me a NotSuchMethodException.
> unfortunately i cannot replace A with B or otherwise. both need to be
> assembled into one jar. 
> 
> so how is it possible to configure following in assembly plugin:
> -dependency X defined in pom.xml of  project P1 should be preferred over
> dependency Y in pom.xml of project P2, when running assembly:assembly 
> 
> thanks in advance!
> 
> besides: i know i should change my architecture to avoid such a library
> conflict (there should exist only one class version). but before refactoring
> i need a quick solution to make a running release.
> 
> 
> 
> 


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