Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding JAR file as dependency to project without its related JARs

We have file payment.jar that developed with Spring Framework 3.1.2 . We need to use it as a dependency on a new project that its version is Spring Framework 5.x .

Problem: When payment.jar used as a dependency, the payment.jar transitive dependencies add to project class-path so in cause conflicting Spring Framework 3 and Spring Framework 5.

I tried solutions:

  1. big fat jar:

create-an-executable-jar-with-dependencies-using-maven

there is no success, the fat JAR, adds Spring Framework 3 to project. (what I am doing wrong!)

  1. excluding payment Spring Framework 3.1.2 dependency in new project:

because of using spring-ibatis implementation in payment.jar it is not worked. Spring Framework new versions do not support ibatis.

Error:

Caused by: java.lang.ClassNotFoundException: org.springframework.orm.ibatis.support.SqlMapClientDaoSupport

my requirement: I need to use payment.jar (with Spring Framework 3.1.2) as a dependency on new project with Spring Framework 5.x without problem mentioned above.

like image 563
Ali Akbarpour Avatar asked Dec 17 '22 19:12

Ali Akbarpour


1 Answers

If the Spring versions are as incompatible as it sounds as though they are, you're probably going to have to recompile either the jar or the project so that they're using the same version of Spring.

If that's impossible (e.g. if you don't have source for the jar), you might be able to wrap the payment jar up in a microservice so that it's running in a different process, and talk to it via XML-RPC or SOAP.

like image 144
Stephen Savitzky Avatar answered Dec 28 '22 06:12

Stephen Savitzky