Search code examples
eclipsespring-bootmulti-moduleparent-pom

How to run multi module project in Spring boot


My maven project structure:

My maven project structure

My question is, I need to run only parent module, that automatically instantiate that's sub modules(tomcat server). Is it possible with spring boot multi module project?

Note : I am using STS. parent packaging is pom and child module packaging is jar files.

My Parent pom file

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0

<groupId>com.test</groupId>
<artifactId>test-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<name>test-parent</name>
<description>testproject for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.7.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
<modules>
    <module>userService</module>
    <module>authenticationService</module>
    <module>dataLayerService</module>
</modules>

My Question is how can I run parent project using tomcat? If I run parent project, child modules are automatically gets run or not?

Thanks in advance !!!


Solution

  • I have configured all the the microservices inside one docker-compose file. using docker-compose up command all modules gets started.(Make one microservice as service and others are child microservice)