Hello there,

I am fairly new to using Maven having mostly done it through IDE or using
Ant.

We are using Spring Boot, and their 1.4.x update changed the structure of
their FAT jar mechanism such that many libraries that also scan for classes
broke. There is a work around, basically it requires setting up a multi
module project structure with a parent POM file.

This apparently is somewhat common, but new to me. Previously we had just
the one POM file that pulled in dependencies. Now in breaking things out, I
am not able to rebuild our executable spring boot jar file.

Basically I am trying to understand the parent\/child relationship. I
thought if I put dependencies in the parent, they are automatically
inherited by the children. However, in building, I get a lot of compiler
errors for specific modules, such that I had to duplicate the dependency
info in several modules. One thing I am confused about.. does Maven end up
duplicating the JAR library dependencies for each module JAR it creates
when more than one module uses the same dependency? When I do a mvn
dependency:tree after a compile (which I was able to get to succeed... but
still spring boot fails to start), I see the same dependencies in the
module graphs. Does that mean they are stored more than once and that each
uses their own module classloader at runtime? Or is this just showing the
map via pom files, but in the FAT jar there is only one dependency jar?

Second, I am unsure where to put the spring boot info to create the
executable fat jar. From what I gather, my *-server module which contains
the Application class that has the only main() method in my code and starts
the spring boot app, is the module to put all the spring boot stuff. But,
when I do this, I am not getting all the other modules pulled in to this
jar.. such that it cant find classes that are needed when I try to execute
it. I have added them as dependencies as well.. but then it begs the
question.. what is the purpose of having a parent POM if I cant put the
bits in that parent that instruct my final outcome? It seems I should be
able to do so.. but because this parent POM structure must specify POM
instead of JAR, it fails.

So.. any help in understanding multi module and spring boot maven setup
would be fantastic.

Thank you.

Reply via email to