2

I have created two separate maven modules (let's call them MODULE1 and MODULE2) which are submodules of a third integration module (SUPERMODULE).

MODULE1 and MODULE2 are both Spring Boot Web Applications. What I'm trying to achieve is to start (not build) both projects / web apps by means of SUPERMODULE.

As I see it, there are two options:

  1. Deploy them both to the same tomcat server (probably the better & more interesting solution)
  2. Deploy them to different tomcat servers with different ports

I found no viable example to achieve either one of these options (... by means of a single maven integration project). Hence, I would be glad if someone could point me into the right direction - or are both possibilities bad practice?

gtonic
  • 2,295
  • 1
  • 24
  • 32
l3moony
  • 65
  • 4
  • "or are both possibilities bad practice?" It depends. If you're talking about deploying from your local machine\dev environment, then yes. If, alternatively, you're trying to push out with a build server then this can work in several ways. The maven wagon plugin comes to mind immediately. – javamonkey79 Sep 17 '16 at 21:11

1 Answers1

0

You said :

Deploy them both to the same tomcat server

(1) Build automation software

Any Build Automation tool (Jenkins, bamboo...) would allow you to create a job that deploys both your wars to tomcat (the same server or different server, you can setup your job as you wish).

Do you use an automation software ? I believe that would be the best the solution / best practices.

(2) Build an EAR - Deploy to Tomee

You said:

What I'm trying to achieve is to start (not build) both projects / web apps by means of SUPERMODULE.

What you are really describing is an EAR!

I'll describe the idea, however, it seems Spring boot does not play well with EAR: Spring Boot EAR Packaging and https://github.com/purple52/spring-boot-ear-skinny-war

Since your 2 submodules are spring boot app, you could:

  • build the submodules as WAR
  • have your Supermodule build an EAR
  • include both WARs in the EAR (maven dependencies)
  • this however implies that you use (for instance) Tomee instead of tomcat (is that an option for you?).
  • as mentioned above, after some research it seems a spring-boot war does not work when packaged inside an EAR. The SpringServletContainerInitializer isn't called. So this would not be an option at the moment.
Community
  • 1
  • 1
alexbt
  • 16,415
  • 6
  • 78
  • 87