Lloyd Ryan David
Lloyd Ryan David

Reputation: 117

How to import multiple Spring application via maven where each dependency sits on its own classpath (to avoid dependency conflicts)?

I plan to bring in multiple Spring Boot Applications to a single module via maven dependecy so I can start them there for integration test purposes. How can I have those spring boot applications via maven so that they would have their own classpaths, and avoid dependency conflict? (each Spring boot application might use different spring versions)

Upvotes: 0

Views: 262

Answers (2)

Azee
Azee

Reputation: 1829

Build a snapshot Docker image for each of your bootsrap apps during their build (use maven docker plugin). Run them using Docker Compose before integration tests and shut them down when tests are finished (docker or just exec maven plugin).

If you don't have an access to the code of those apps - you can create a multi-module maven project. Each module will get it's own bootstrap-app as a dependency. You can either build docker images here or just run apps separately before integration tests (each app in a separate module -> separate directory -> separate classpath) using maven plugins (e.g. - exec or jetty plugins).

Upvotes: 1

Vincent C.
Vincent C.

Reputation: 867

You need a different pom.xml in order to have different versions of the same artifact among a whole application.

You could use dependencyManagement Maven tag.

You can skip the first part of the documentation, even tho it's interesting, and go directly to the

A second, and very important use of the dependency management section is to control the versions of artifacts used in transitive dependencies.

section.

Upvotes: 0

Related Questions