0

I am having a Spring Boot App with Java 9.

Depending on the input parameter to maven, I want to create the Spring Boot App Jar with different modules.

Example: I have four modules mod1, mod2, mod3, and mod4. If I pass the parameter 'light' then the Spring Boot App should have mod1 and mod2 modules only and If I pass a parameter 'full' it should create spring boot jar with all the modules i.e build mod1, mod2, mod3, and mod4.

Is this possible?

JDev
  • 1,662
  • 4
  • 25
  • 55
  • Building a Spring Boot App with modules does not make sense cause the resulting jar contains all code which means there is no separation of modules possible apart from that a single JAR can only contains a single `module-info.java` which makes it useless...Furthermore if you need to have two different spring boot apps you should make to spring boot modules in your build and do things like profiles etc.... – khmarbaise Apr 18 '18 at 06:02
  • You can create a project with multiple maven and java modules for a clean layered application. I've seen multiple youtubes on it. However, I have yet to find the secret to separate the MVC from SpringApplication class. I would like multiple MVC modules that run on the same port so I only want one app. – dmalechek Jun 08 '22 at 12:47

1 Answers1

0

Maven profiles will help. http://maven.apache.org/guides/introduction/introduction-to-profiles.html You can make profiles as per your need and then can use "maven assembly plugin" to build the modules as per your need. This link Maven maven-assembly-plugin build with profile can help.

ashishgupta_mca
  • 578
  • 6
  • 27