V
V
vildaraj2019-03-09 14:11:58
Java
vildaraj, 2019-03-09 14:11:58

How to limit the scope of dependencies?

Hello,
there is a library, you can get it through the maven repository. This library has many dependencies, but those dependencies are outdated. It depends on springframework 3.0.1, but I want to use the latest spring (5.1.5) in my web service. So: after building the project and installing the latest spring intelij idea, it does not use the latest spring, but takes the old one (version 3) from the library dependencies.
How can I restrict dependency scope so that spring 3 only uses this library and my program that depends on this library uses spring 5.1.5 ?
I tried to manually build the jar file, but the same thing - I can’t limit the scope of the old sping in any way.
There was an idea to update all the dependencies of this library myself, but it is very long, the project is large and there are a lot of dependencies.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vamp, 2019-03-10
@vildaraj

It's best to fork the library project and rewrite the code in spring 5. This may not be too time consuming, given that the library's dependency on spring is transitive. That is, the library code may not contain code that depends on spring, so it may be enough to update only the version of the direct dependency that spring already drags.
An alternative is to use the maven-shade-plugin . This plugin packs project dependencies into a single jar file and optionally can move classes to another package. The feature is called class relocation. That is, you can build a shaded version of the soap-ws library, in which the spring classes will be relocated from the org.springframework package to, for example, vildaraj.shaded.org.springframework. In this case, you can use any version of spring in the main project without conflicts.

A
aol-nnov, 2019-03-09
@aol-nnov

> allows you to build a soap request or response from wsdl , well
, I don’t know . did it myself :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question