what you probably need to do is shade flying saucer and it's iText dependency into a different package tree. That way it will be separated from the iText your app is using...
The other solution is to run inside a OSGi container, as you could define in the bundle manifests that Flying Saucer must use 2.0.8 and your app must use 2.1.3. OSGi will then take care of managing the classloaders for you. Unfortunately in a standard web container, the classloader is what it is, which means that whatever class comes first is the class that gets loaded... which is one of the reasons people resort to shading or OSGi 2009/6/18 Timothy Orme <[email protected]>: > Hello, > > I have a JAR and a WAR. > > My JAR file is used to render PDF files using the Flying Saucer > Project. When used in this way, flying saucer requires iText 2.0.8 to be > included. > So the POM file for my JAR has 2 dependencies: > > org.xhtmlrenderer : core-renderer : R8pre2 : jar : compile > com.lowagie : itext : 2.0.8 : jar : compile > > My WAR file then includes this JAR and makes calls to it to have > PDF's generated. However, the WAR file itself also includes some legacy > functionality to generate some other PDF's. However, it requires iText > 2.1.3. So my WAR has 2 dependencies: > > jarA : jarA : 1.0 : jar : compile > com.lowagie : itext : 2.1.3 : jar : compile > > The problem then, is that when I try and make calls from my WAR to > methods in that JAR, it seems that it uses iText 2.1.3 instead of 2.0.8, so > it breaks because some methods are missing. > > Everything works as it should when I just use the JAR itself, through > JUnit. > > I cannot upgrade Flying Saucer to use 2.1.3 and it would take a great > deal of work to downgrade the WAR to use 2.0.8. My question then, is there a > way for me to specify in Maven that the iText 2.0.8 be somehow packaged up > with the JAR so that all methods in it use 2.0.8, but anything in the war > would use 2.1.3? > > Thanks, > Tim O. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
