I have two Java projects Test1 and Test2. Test1 has a lib library added to it in the Eclipse Java Build Path. Test2 has an added jar in its build path.
Test1 Test2 /src /src lib Referenced Libraries x-1.1.jar a.jar y.jar x-1.2 z
The code in Test1 calls the functions / classes of y.jar, which is dependent on x-1.1.jar. I do not know what functions / classes x-1.1.jar are used by y.jar, since I do not have a source for cans. Similarly, Test2 calls the functions / classes of the package z a.jar, which are dependent on x-1.2 verion jar.
Now I have a test project where I need both projects Test1 and Test2
Test /src Test1 code Test2 code some other code which uses Test1 as well as Test2 libraries lib x-1.1.jar y.jar Referenced Libraries a.jar x-1.2 z
Now when I start the Test project, I get into the jar-hell situation. My research uses two approaches:
- Class path: The problem with this approach is that since the / jar library for Test1, Test2 is added to the Java eclipse build path, only the first downloaded version of x.jar is available, and Test2 code breaks even when using the class loader.
- osgi: the problem with the approach is that I can only export packages to the src folder Test1 and Test2 from the osgi package, and not the one referenced by the project. But there is code in the test project that uses the Test1 and Test2 libraries.
I hope I'm clear enough. Any help is appreciated. Thanks in advance.
Adding additional information to the question: I have to use two different java-sdks in my project that are associated with different jar files. Conflicting are:
jar file Test1 ver Test2 ver org.apache.commons.codecs 1.3 1.6 org.apache.commons.logging 1.1.1 1.1.1 org.apache.log4j 1.2.7 1.2.15 httpclient 4.1.1 4.0.3 httpcore 4.1 4.1.4
What are some possible ways to do this?
source share