RE: Override dependency classes with another module's classes
Well, I've tried switching the order of the two dependencies both ways and tried all sorts of different scopes and exclusions to try to get it to work, and I've had no success. Since both of you say it should work in the version I am using, can you take a look at my 2 dependencies and let me know if you see anything that stands out? Here are the 2 dependencies in my POM: dependencies dependency groupIdcom.sample/groupId artifactIdqueue-override/artifactId version1.9.0-SNAPSHOT/version typejar/type scopecompile/scope /dependency dependency groupIdmule/groupId artifactIdmule/artifactId version1.2/version typejar/type scopecompile/scope /dependency /dependencies So the module A that has these 2 dependencies is trying to use the implementations from the queue-override that overrides the packages/classes inside of mule. So: Queue-override has the classes: org.mule.util.queue.QueueSession, org.mule.util.queue.Queue And the mule package has the same classes minus a few methods. In module A when I try to use the methods I added in queue-override, no matter which way I order the dependencies, it doesn't see the new methods. Thanks! Brendan Haverlock -Original Message- From: Wayne Fay [mailto:wayne...@gmail.com] Sent: Tuesday, May 26, 2009 4:50 PM To: Maven Users List Subject: Re: Override dependency classes with another module's classes Like Brian, I expected this would work right in 2.0.10 and 2.1.0, so I'm a bit surprised it didn't work. Having said that, let me remind you what I said earlier... ;-) This just won't work at all, at least not consistently. Build a different jar containing just the classes you DON'T override, and depend on it instead. I've just run into too many odd problems as a result of trying to override classes like this that I simply refuse to go this route at this point. Making sure your jars are in the right order in Maven plus your Web container and any other environments you may use them in is just too much work when you can solve this pretty easily with your own build of the jar minus certain classes. Wayne On Tue, May 26, 2009 at 4:24 PM, Brian Fox bri...@infinity.nu wrote: I expected it would, yes. On Tue, May 26, 2009 at 10:54 AM, Brendan Haverlock brend...@mirthcorp.comwrote: I am using 2.1.0, and it doesn't seem to make a difference which order I put them in. Based on what you said, shouldn't this be working in my version? Thanks, Brendan Haverlock - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Override dependency classes with another module's classes
So the module A that has these 2 dependencies is trying to use the implementations from the queue-override that overrides the packages/classes inside of mule. So: Is Mule perhaps using OSGi or something to look up classes, so even though your artifacts/classes appear first in the classpath, they are getting ignored? What does mvn help:effective-pom show you? I'm not entirely convinced this is Maven performing badly but rather something more intricate going on... Might want to take this over to the Mule list to see what people there think. Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
RE: Override dependency classes with another module's classes
The version of Mule that we are using does not use OSGi, but that should be irrelevant because the problem is occurring at compile time. When I ran mvn help:effective-pom, queue was still after mule and there was only one instance of each. It was quite large because it inherited a lot of dependencies from the parent project. Thanks, Brendan Haverlock -Original Message- From: Wayne Fay [mailto:wayne...@gmail.com] Sent: Wednesday, May 27, 2009 5:04 PM To: Maven Users List Subject: Re: Override dependency classes with another module's classes So the module A that has these 2 dependencies is trying to use the implementations from the queue-override that overrides the packages/classes inside of mule. So: Is Mule perhaps using OSGi or something to look up classes, so even though your artifacts/classes appear first in the classpath, they are getting ignored? What does mvn help:effective-pom show you? I'm not entirely convinced this is Maven performing badly but rather something more intricate going on... Might want to take this over to the Mule list to see what people there think. Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
RE: Override dependency classes with another module's classes
I am using 2.1.0, and it doesn't seem to make a difference which order I put them in. Based on what you said, shouldn't this be working in my version? Thanks, Brendan Haverlock -Original Message- From: Brian Fox [mailto:bri...@infinity.nu] Sent: Monday, May 25, 2009 3:19 PM To: Maven Users List Subject: Re: Override dependency classes with another module's classes The order in the poms is maintained as of 2.0.10, so you should be able to affect the classpath by reordering the poms. 2009/5/22 Brendan Haverlock brend...@mirthcorp.com Thanks Wayne...I just found a link to the other post about this: http://www.mail-archive.com/users@maven.apache.org/msg70079.html Thanks for not redirecting me to the What is Maven page. That seems like the only plausible solution to me for now. Is there any plan for making the dependency order matter in the POM files? That would be really useful! Thanks again, Brendan Haverlock -Original Message- From: Wayne Fay [mailto:wayne...@gmail.com] Sent: Friday, May 22, 2009 11:12 AM To: Maven Users List Subject: Re: Override dependency classes with another module's classes Unfortunately, we are overriding classes from a dependency library, so we are just putting the classes in the same package and wanting our overriding classes to get precedence on the classpath. So, our classes are in the same package as the library's classes and have the same class name, we just want ours to be used at compile time. This just won't work at all, at least not consistently. Build a different jar containing just the classes you DON'T override, and depend on it instead. Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Override dependency classes with another module's classes
I expected it would, yes. On Tue, May 26, 2009 at 10:54 AM, Brendan Haverlock brend...@mirthcorp.comwrote: I am using 2.1.0, and it doesn't seem to make a difference which order I put them in. Based on what you said, shouldn't this be working in my version? Thanks, Brendan Haverlock -Original Message- From: Brian Fox [mailto:bri...@infinity.nu] Sent: Monday, May 25, 2009 3:19 PM To: Maven Users List Subject: Re: Override dependency classes with another module's classes The order in the poms is maintained as of 2.0.10, so you should be able to affect the classpath by reordering the poms. 2009/5/22 Brendan Haverlock brend...@mirthcorp.com Thanks Wayne...I just found a link to the other post about this: http://www.mail-archive.com/users@maven.apache.org/msg70079.html Thanks for not redirecting me to the What is Maven page. That seems like the only plausible solution to me for now. Is there any plan for making the dependency order matter in the POM files? That would be really useful! Thanks again, Brendan Haverlock -Original Message- From: Wayne Fay [mailto:wayne...@gmail.com] Sent: Friday, May 22, 2009 11:12 AM To: Maven Users List Subject: Re: Override dependency classes with another module's classes Unfortunately, we are overriding classes from a dependency library, so we are just putting the classes in the same package and wanting our overriding classes to get precedence on the classpath. So, our classes are in the same package as the library's classes and have the same class name, we just want ours to be used at compile time. This just won't work at all, at least not consistently. Build a different jar containing just the classes you DON'T override, and depend on it instead. Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Override dependency classes with another module's classes
Like Brian, I expected this would work right in 2.0.10 and 2.1.0, so I'm a bit surprised it didn't work. Having said that, let me remind you what I said earlier... ;-) This just won't work at all, at least not consistently. Build a different jar containing just the classes you DON'T override, and depend on it instead. I've just run into too many odd problems as a result of trying to override classes like this that I simply refuse to go this route at this point. Making sure your jars are in the right order in Maven plus your Web container and any other environments you may use them in is just too much work when you can solve this pretty easily with your own build of the jar minus certain classes. Wayne On Tue, May 26, 2009 at 4:24 PM, Brian Fox bri...@infinity.nu wrote: I expected it would, yes. On Tue, May 26, 2009 at 10:54 AM, Brendan Haverlock brend...@mirthcorp.comwrote: I am using 2.1.0, and it doesn't seem to make a difference which order I put them in. Based on what you said, shouldn't this be working in my version? Thanks, Brendan Haverlock - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Override dependency classes with another module's classes
The order in the poms is maintained as of 2.0.10, so you should be able to affect the classpath by reordering the poms. 2009/5/22 Brendan Haverlock brend...@mirthcorp.com Thanks Wayne...I just found a link to the other post about this: http://www.mail-archive.com/users@maven.apache.org/msg70079.html Thanks for not redirecting me to the What is Maven page. That seems like the only plausible solution to me for now. Is there any plan for making the dependency order matter in the POM files? That would be really useful! Thanks again, Brendan Haverlock -Original Message- From: Wayne Fay [mailto:wayne...@gmail.com] Sent: Friday, May 22, 2009 11:12 AM To: Maven Users List Subject: Re: Override dependency classes with another module's classes Unfortunately, we are overriding classes from a dependency library, so we are just putting the classes in the same package and wanting our overriding classes to get precedence on the classpath. So, our classes are in the same package as the library's classes and have the same class name, we just want ours to be used at compile time. This just won't work at all, at least not consistently. Build a different jar containing just the classes you DON'T override, and depend on it instead. Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
RE: Override dependency classes with another module's classes
Martin, Unfortunately, we are overriding classes from a dependency library, so we are just putting the classes in the same package and wanting our overriding classes to get precedence on the classpath. So, our classes are in the same package as the library's classes and have the same class name, we just want ours to be used at compile time. Thanks, Brendan Haverlock From: Martin Gainty [mailto:mgai...@hotmail.com] Sent: Thursday, May 21, 2009 6:15 PM To: brend...@mirthcorp.com Subject: RE: Override dependency classes with another module's classes public interface ModuleC { public int doCalculationC(int a) { return(a+1); } } public class ModuleA implements ModuleC { public int doCalculationA(int a) { return (a+2); } public int doCalculationC(int a) { return(a+1); } } 1. I have a Module A that is overriding a few, but not all, classes from its Dependency C. //B extends A and all protected/public methods from A //B implements C and all protected/public methods from C public class ModuleB extends ModuleA implements ModuleC { public int doCalculationB(int a) { return (a+3); } public int doCalculationA(int a) { return (a+2); } public int doCalculationC(int a) { return(a+1); } } 2. I have another Module B that is dependent on Module A, but also on the Dependency C. 3. Module B is getting compile errors because it is using the classes from Dependency C but not finding the overridden classes from Module A. From: brend...@mirthcorp.com To: users@maven.apache.org Subject: Override dependency classes with another module's classes Date: Thu, 21 May 2009 17:39:46 -0700 Hi all, I've run into an issue with my dependencies in Maven: 1. I have a Module A that is overriding a few, but not all, classes from its Dependency C. 2. I have another Module B that is dependent on Module A, but also on the Dependency C. 3. Module B is getting compile errors because it is using the classes from Dependency C but not finding the overridden classes from Module A. Question: Is there a way for me to specify dependency precedence so that Module B knows to use the classes from Dependency C, except for the ones that were overridden in Module A? Thanks, Brendan Haverlock _ Insert movie times and more without leaving HotmailR. See how. http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutor ial_QuickAdd1_052009
Re: Override dependency classes with another module's classes
Unfortunately, we are overriding classes from a dependency library, so we are just putting the classes in the same package and wanting our overriding classes to get precedence on the classpath. So, our classes are in the same package as the library's classes and have the same class name, we just want ours to be used at compile time. This just won't work at all, at least not consistently. Build a different jar containing just the classes you DON'T override, and depend on it instead. Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
RE: Override dependency classes with another module's classes
Thanks Wayne...I just found a link to the other post about this: http://www.mail-archive.com/users@maven.apache.org/msg70079.html Thanks for not redirecting me to the What is Maven page. That seems like the only plausible solution to me for now. Is there any plan for making the dependency order matter in the POM files? That would be really useful! Thanks again, Brendan Haverlock -Original Message- From: Wayne Fay [mailto:wayne...@gmail.com] Sent: Friday, May 22, 2009 11:12 AM To: Maven Users List Subject: Re: Override dependency classes with another module's classes Unfortunately, we are overriding classes from a dependency library, so we are just putting the classes in the same package and wanting our overriding classes to get precedence on the classpath. So, our classes are in the same package as the library's classes and have the same class name, we just want ours to be used at compile time. This just won't work at all, at least not consistently. Build a different jar containing just the classes you DON'T override, and depend on it instead. Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org