0

I have an application A which contains code to fetch records from dB and some other functionality. I want to use the same in another project B and use A as dependency. Even if spring boot apps are not recommended to be used as library I have this use case bcs app A is a batch application and doesn’t keep running so no option of rest call. Issue is when I try to create the jar it is created as spring boot jar or if I create a normal jar it doesn’t have the required dependencies and fails at runtime as class not found. It seems dependencies from parent project of A are not included during jar creation. Is there a recommenced way of generating the jar using maven.

1 Answers1

0

To elaborate on what chrylis said:

Create a project or module C that contains everything that both A and B need. Use it as dependency in A and B.

The easiest way to handle this is to have a multi-module-project with A, B and C, but you can also have three separate projects.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142