How to deploy Multi module maven spring boot project in pivotal Cloud foundry?











up vote
2
down vote

favorite












I have a multi maven module spring boot project. Lets say, there are 2 modules in the parent 'service' and 'config'. Service depends on config. config module contains classes for DB configuration code ( cassandra db).
I added config module as dependency in my service module's pom. Sprinngboot application runs fine in local.
Parent pom has packaging as pom. submodules ie. Service and config have packaging as jar. I don't need to create any war as there is no webapp required. its just rest microservices.
To package the project, I executed'mvn package' at root pom level. It created jars for individual modules. service module is the one where main method is defined.
I created manifest file at service module level and deployed the jar of service module in cloud. App ran fine on cloud as well. I believe jar of service module implicitly contains required dependencies from config module as i have already defined config as dependency in service module's pom.



Next, in case I want to make some modification in config module only, would it still require creating the jar of service and deploy that in cloud even if there is no change in service?
Or
Is there a way i can deploy jar of config module only in cloud? if yes, how would I bind my service module with that in cloud to keep it functioning as before?



What is the recommended way for cloud deployment of multimaven project?



Edit:1
To make the question more clear and precise, I am looking for standard way of deployment in cloud. i am putting up the steps how I am doing the deployment at present and with reference to that what betterment i should do in the current steps.
I am having 3 pom.xml files. 1 parent and 2 childs. Also, config module is defined as dependency in service module's pom.xml



For deployment below steps i am taking-




  1. Going to path of parent pom and running 'mvn package'
    It creates respective jars in child modules ( 1 jar in service and, 1 jar in config)

  2. creating a manisfest.yml file in service module and putting up path of service jar along with other required configuration in manifest file.

  3. Logging into cloud foundry, navigating to path of service module where manifest .yml file is present and executing 'cf push'
    It deploys and starts my app in cloud. All good!


Next, lets say i make modification in config module class code. How can I just deploy the jar of config module in cloud? Would my app still work?



Previously I had deployed only service module's jar and not the config module's jar. App runs fine. But in future if i make changes in config module only and i don't touch service module, would I still need to create jar of service as i did initially or there is a way i just re create jar for config module which is modified and deploy that only.










share|improve this question




























    up vote
    2
    down vote

    favorite












    I have a multi maven module spring boot project. Lets say, there are 2 modules in the parent 'service' and 'config'. Service depends on config. config module contains classes for DB configuration code ( cassandra db).
    I added config module as dependency in my service module's pom. Sprinngboot application runs fine in local.
    Parent pom has packaging as pom. submodules ie. Service and config have packaging as jar. I don't need to create any war as there is no webapp required. its just rest microservices.
    To package the project, I executed'mvn package' at root pom level. It created jars for individual modules. service module is the one where main method is defined.
    I created manifest file at service module level and deployed the jar of service module in cloud. App ran fine on cloud as well. I believe jar of service module implicitly contains required dependencies from config module as i have already defined config as dependency in service module's pom.



    Next, in case I want to make some modification in config module only, would it still require creating the jar of service and deploy that in cloud even if there is no change in service?
    Or
    Is there a way i can deploy jar of config module only in cloud? if yes, how would I bind my service module with that in cloud to keep it functioning as before?



    What is the recommended way for cloud deployment of multimaven project?



    Edit:1
    To make the question more clear and precise, I am looking for standard way of deployment in cloud. i am putting up the steps how I am doing the deployment at present and with reference to that what betterment i should do in the current steps.
    I am having 3 pom.xml files. 1 parent and 2 childs. Also, config module is defined as dependency in service module's pom.xml



    For deployment below steps i am taking-




    1. Going to path of parent pom and running 'mvn package'
      It creates respective jars in child modules ( 1 jar in service and, 1 jar in config)

    2. creating a manisfest.yml file in service module and putting up path of service jar along with other required configuration in manifest file.

    3. Logging into cloud foundry, navigating to path of service module where manifest .yml file is present and executing 'cf push'
      It deploys and starts my app in cloud. All good!


    Next, lets say i make modification in config module class code. How can I just deploy the jar of config module in cloud? Would my app still work?



    Previously I had deployed only service module's jar and not the config module's jar. App runs fine. But in future if i make changes in config module only and i don't touch service module, would I still need to create jar of service as i did initially or there is a way i just re create jar for config module which is modified and deploy that only.










    share|improve this question


























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I have a multi maven module spring boot project. Lets say, there are 2 modules in the parent 'service' and 'config'. Service depends on config. config module contains classes for DB configuration code ( cassandra db).
      I added config module as dependency in my service module's pom. Sprinngboot application runs fine in local.
      Parent pom has packaging as pom. submodules ie. Service and config have packaging as jar. I don't need to create any war as there is no webapp required. its just rest microservices.
      To package the project, I executed'mvn package' at root pom level. It created jars for individual modules. service module is the one where main method is defined.
      I created manifest file at service module level and deployed the jar of service module in cloud. App ran fine on cloud as well. I believe jar of service module implicitly contains required dependencies from config module as i have already defined config as dependency in service module's pom.



      Next, in case I want to make some modification in config module only, would it still require creating the jar of service and deploy that in cloud even if there is no change in service?
      Or
      Is there a way i can deploy jar of config module only in cloud? if yes, how would I bind my service module with that in cloud to keep it functioning as before?



      What is the recommended way for cloud deployment of multimaven project?



      Edit:1
      To make the question more clear and precise, I am looking for standard way of deployment in cloud. i am putting up the steps how I am doing the deployment at present and with reference to that what betterment i should do in the current steps.
      I am having 3 pom.xml files. 1 parent and 2 childs. Also, config module is defined as dependency in service module's pom.xml



      For deployment below steps i am taking-




      1. Going to path of parent pom and running 'mvn package'
        It creates respective jars in child modules ( 1 jar in service and, 1 jar in config)

      2. creating a manisfest.yml file in service module and putting up path of service jar along with other required configuration in manifest file.

      3. Logging into cloud foundry, navigating to path of service module where manifest .yml file is present and executing 'cf push'
        It deploys and starts my app in cloud. All good!


      Next, lets say i make modification in config module class code. How can I just deploy the jar of config module in cloud? Would my app still work?



      Previously I had deployed only service module's jar and not the config module's jar. App runs fine. But in future if i make changes in config module only and i don't touch service module, would I still need to create jar of service as i did initially or there is a way i just re create jar for config module which is modified and deploy that only.










      share|improve this question















      I have a multi maven module spring boot project. Lets say, there are 2 modules in the parent 'service' and 'config'. Service depends on config. config module contains classes for DB configuration code ( cassandra db).
      I added config module as dependency in my service module's pom. Sprinngboot application runs fine in local.
      Parent pom has packaging as pom. submodules ie. Service and config have packaging as jar. I don't need to create any war as there is no webapp required. its just rest microservices.
      To package the project, I executed'mvn package' at root pom level. It created jars for individual modules. service module is the one where main method is defined.
      I created manifest file at service module level and deployed the jar of service module in cloud. App ran fine on cloud as well. I believe jar of service module implicitly contains required dependencies from config module as i have already defined config as dependency in service module's pom.



      Next, in case I want to make some modification in config module only, would it still require creating the jar of service and deploy that in cloud even if there is no change in service?
      Or
      Is there a way i can deploy jar of config module only in cloud? if yes, how would I bind my service module with that in cloud to keep it functioning as before?



      What is the recommended way for cloud deployment of multimaven project?



      Edit:1
      To make the question more clear and precise, I am looking for standard way of deployment in cloud. i am putting up the steps how I am doing the deployment at present and with reference to that what betterment i should do in the current steps.
      I am having 3 pom.xml files. 1 parent and 2 childs. Also, config module is defined as dependency in service module's pom.xml



      For deployment below steps i am taking-




      1. Going to path of parent pom and running 'mvn package'
        It creates respective jars in child modules ( 1 jar in service and, 1 jar in config)

      2. creating a manisfest.yml file in service module and putting up path of service jar along with other required configuration in manifest file.

      3. Logging into cloud foundry, navigating to path of service module where manifest .yml file is present and executing 'cf push'
        It deploys and starts my app in cloud. All good!


      Next, lets say i make modification in config module class code. How can I just deploy the jar of config module in cloud? Would my app still work?



      Previously I had deployed only service module's jar and not the config module's jar. App runs fine. But in future if i make changes in config module only and i don't touch service module, would I still need to create jar of service as i did initially or there is a way i just re create jar for config module which is modified and deploy that only.







      maven spring-boot pivotal-cloud-foundry






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 at 11:21

























      asked Nov 21 at 9:38









      MaFiA

      356




      356
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote













          You need a parent project to hold it all together:



          <?xml version="1.0" encoding="UTF-8"?>
          <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          <modelVersion>4.0.0</modelVersion>

          <parent>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-parent</artifactId>
          <version>1.5.10.RELEASE</version>
          </parent>

          <groupId>com.greg</groupId>
          <artifactId>boot-multi-module-example</artifactId>
          <version>1.0</version>
          <packaging>pom</packaging>

          <modules>
          <module>service</module>
          <module>config</module>
          </modules>

          </project>


          You need a config project as a child of the parent, something like:



          <?xml version="1.0" encoding="UTF-8"?>
          <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          <modelVersion>4.0.0</modelVersion>
          <parent>
          <artifactId>boot-multi-module-example</artifactId>
          <groupId>com.greg</groupId>
          <version>1.0</version>
          </parent>

          <artifactId>config</artifactId>

          <dependencies>
          <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.11</version>
          <scope>test</scope>
          </dependency>
          </dependencies>

          </project>


          And finally the boot application that you will deploy, with a dependency to the config service above:



          <?xml version="1.0" encoding="UTF-8"?>
          <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          <modelVersion>4.0.0</modelVersion>

          <parent>
          <groupId>com.greg</groupId>
          <artifactId>boot-multi-module-example</artifactId>
          <version>1.0</version>
          </parent>

          <artifactId>service</artifactId>


          <dependencies>
          <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-web</artifactId>
          </dependency>
          <!-- tag::actuator -->
          <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-actuator</artifactId>
          </dependency>
          <dependency>
          <groupId>com.greg</groupId>
          <artifactId>service</artifactId>
          <version>${project.version}</version>
          </dependency>
          <!-- end::actuator -->
          <!-- tag::tests -->
          <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-test</artifactId>
          <scope>test</scope>
          </dependency>
          <!-- end::tests -->
          </dependencies>

          <properties>
          <java.version>1.8</java.version>
          </properties>

          <build>
          <plugins>
          <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          </plugin>
          <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <executions>
          <execution>
          <goals>
          <goal>integration-test</goal>
          <goal>verify</goal>
          </goals>
          </execution>
          </executions>
          </plugin>
          </plugins>
          </build>

          </project>





          share|improve this answer























          • @ Essex Boy, I actually already had the similar pom configurations. i have edited my question to make it more clear . Could you please have a look and provide the insights..thanks!
            – MaFiA
            Nov 21 at 11:19


















          up vote
          0
          down vote














          Next, lets say i make modification in config module class code. How can I just deploy the jar of config module in cloud? Would my app still work?




          It's not possible to do a partial deploy to Cloud Foundry. By this I mean that you can't take one JAR file from your app and swap that into the existing application code bundle. You need to do a cf push every time you're changing code, no matter how small the change.



          When you run cf push you are sending a "complete" bundle of application code to Cloud Foundry to run. If you change any part of that complete bundle, you need to cf push again. This may sound inefficient but cf push is smart and skip files that are already on the server, so you'll notice that subsequent pushes are smaller and faster.



          You do still need to stage & restart the application though. This is unavoidable as you cannot change an application in-place. This would make a snowflake, or app that has diverged from it's droplet, and that's considered bad practice.



          Long story short...




          1. Rebuild the module that changed.

          2. Rebuild the JAR/WAR that you are pushing to Cloud Foundry.

          3. Push to Cloud foundry


          Your changes will be deployed.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53409078%2fhow-to-deploy-multi-module-maven-spring-boot-project-in-pivotal-cloud-foundry%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            You need a parent project to hold it all together:



            <?xml version="1.0" encoding="UTF-8"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>

            <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.10.RELEASE</version>
            </parent>

            <groupId>com.greg</groupId>
            <artifactId>boot-multi-module-example</artifactId>
            <version>1.0</version>
            <packaging>pom</packaging>

            <modules>
            <module>service</module>
            <module>config</module>
            </modules>

            </project>


            You need a config project as a child of the parent, something like:



            <?xml version="1.0" encoding="UTF-8"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>
            <parent>
            <artifactId>boot-multi-module-example</artifactId>
            <groupId>com.greg</groupId>
            <version>1.0</version>
            </parent>

            <artifactId>config</artifactId>

            <dependencies>
            <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
            </dependency>
            </dependencies>

            </project>


            And finally the boot application that you will deploy, with a dependency to the config service above:



            <?xml version="1.0" encoding="UTF-8"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>

            <parent>
            <groupId>com.greg</groupId>
            <artifactId>boot-multi-module-example</artifactId>
            <version>1.0</version>
            </parent>

            <artifactId>service</artifactId>


            <dependencies>
            <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <!-- tag::actuator -->
            <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
            <dependency>
            <groupId>com.greg</groupId>
            <artifactId>service</artifactId>
            <version>${project.version}</version>
            </dependency>
            <!-- end::actuator -->
            <!-- tag::tests -->
            <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            </dependency>
            <!-- end::tests -->
            </dependencies>

            <properties>
            <java.version>1.8</java.version>
            </properties>

            <build>
            <plugins>
            <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
            <execution>
            <goals>
            <goal>integration-test</goal>
            <goal>verify</goal>
            </goals>
            </execution>
            </executions>
            </plugin>
            </plugins>
            </build>

            </project>





            share|improve this answer























            • @ Essex Boy, I actually already had the similar pom configurations. i have edited my question to make it more clear . Could you please have a look and provide the insights..thanks!
              – MaFiA
              Nov 21 at 11:19















            up vote
            1
            down vote













            You need a parent project to hold it all together:



            <?xml version="1.0" encoding="UTF-8"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>

            <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.10.RELEASE</version>
            </parent>

            <groupId>com.greg</groupId>
            <artifactId>boot-multi-module-example</artifactId>
            <version>1.0</version>
            <packaging>pom</packaging>

            <modules>
            <module>service</module>
            <module>config</module>
            </modules>

            </project>


            You need a config project as a child of the parent, something like:



            <?xml version="1.0" encoding="UTF-8"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>
            <parent>
            <artifactId>boot-multi-module-example</artifactId>
            <groupId>com.greg</groupId>
            <version>1.0</version>
            </parent>

            <artifactId>config</artifactId>

            <dependencies>
            <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
            </dependency>
            </dependencies>

            </project>


            And finally the boot application that you will deploy, with a dependency to the config service above:



            <?xml version="1.0" encoding="UTF-8"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>

            <parent>
            <groupId>com.greg</groupId>
            <artifactId>boot-multi-module-example</artifactId>
            <version>1.0</version>
            </parent>

            <artifactId>service</artifactId>


            <dependencies>
            <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <!-- tag::actuator -->
            <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
            <dependency>
            <groupId>com.greg</groupId>
            <artifactId>service</artifactId>
            <version>${project.version}</version>
            </dependency>
            <!-- end::actuator -->
            <!-- tag::tests -->
            <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            </dependency>
            <!-- end::tests -->
            </dependencies>

            <properties>
            <java.version>1.8</java.version>
            </properties>

            <build>
            <plugins>
            <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
            <execution>
            <goals>
            <goal>integration-test</goal>
            <goal>verify</goal>
            </goals>
            </execution>
            </executions>
            </plugin>
            </plugins>
            </build>

            </project>





            share|improve this answer























            • @ Essex Boy, I actually already had the similar pom configurations. i have edited my question to make it more clear . Could you please have a look and provide the insights..thanks!
              – MaFiA
              Nov 21 at 11:19













            up vote
            1
            down vote










            up vote
            1
            down vote









            You need a parent project to hold it all together:



            <?xml version="1.0" encoding="UTF-8"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>

            <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.10.RELEASE</version>
            </parent>

            <groupId>com.greg</groupId>
            <artifactId>boot-multi-module-example</artifactId>
            <version>1.0</version>
            <packaging>pom</packaging>

            <modules>
            <module>service</module>
            <module>config</module>
            </modules>

            </project>


            You need a config project as a child of the parent, something like:



            <?xml version="1.0" encoding="UTF-8"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>
            <parent>
            <artifactId>boot-multi-module-example</artifactId>
            <groupId>com.greg</groupId>
            <version>1.0</version>
            </parent>

            <artifactId>config</artifactId>

            <dependencies>
            <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
            </dependency>
            </dependencies>

            </project>


            And finally the boot application that you will deploy, with a dependency to the config service above:



            <?xml version="1.0" encoding="UTF-8"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>

            <parent>
            <groupId>com.greg</groupId>
            <artifactId>boot-multi-module-example</artifactId>
            <version>1.0</version>
            </parent>

            <artifactId>service</artifactId>


            <dependencies>
            <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <!-- tag::actuator -->
            <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
            <dependency>
            <groupId>com.greg</groupId>
            <artifactId>service</artifactId>
            <version>${project.version}</version>
            </dependency>
            <!-- end::actuator -->
            <!-- tag::tests -->
            <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            </dependency>
            <!-- end::tests -->
            </dependencies>

            <properties>
            <java.version>1.8</java.version>
            </properties>

            <build>
            <plugins>
            <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
            <execution>
            <goals>
            <goal>integration-test</goal>
            <goal>verify</goal>
            </goals>
            </execution>
            </executions>
            </plugin>
            </plugins>
            </build>

            </project>





            share|improve this answer














            You need a parent project to hold it all together:



            <?xml version="1.0" encoding="UTF-8"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>

            <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.10.RELEASE</version>
            </parent>

            <groupId>com.greg</groupId>
            <artifactId>boot-multi-module-example</artifactId>
            <version>1.0</version>
            <packaging>pom</packaging>

            <modules>
            <module>service</module>
            <module>config</module>
            </modules>

            </project>


            You need a config project as a child of the parent, something like:



            <?xml version="1.0" encoding="UTF-8"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>
            <parent>
            <artifactId>boot-multi-module-example</artifactId>
            <groupId>com.greg</groupId>
            <version>1.0</version>
            </parent>

            <artifactId>config</artifactId>

            <dependencies>
            <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
            </dependency>
            </dependencies>

            </project>


            And finally the boot application that you will deploy, with a dependency to the config service above:



            <?xml version="1.0" encoding="UTF-8"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>

            <parent>
            <groupId>com.greg</groupId>
            <artifactId>boot-multi-module-example</artifactId>
            <version>1.0</version>
            </parent>

            <artifactId>service</artifactId>


            <dependencies>
            <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <!-- tag::actuator -->
            <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
            <dependency>
            <groupId>com.greg</groupId>
            <artifactId>service</artifactId>
            <version>${project.version}</version>
            </dependency>
            <!-- end::actuator -->
            <!-- tag::tests -->
            <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            </dependency>
            <!-- end::tests -->
            </dependencies>

            <properties>
            <java.version>1.8</java.version>
            </properties>

            <build>
            <plugins>
            <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
            <execution>
            <goals>
            <goal>integration-test</goal>
            <goal>verify</goal>
            </goals>
            </execution>
            </executions>
            </plugin>
            </plugins>
            </build>

            </project>






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 21 at 10:46

























            answered Nov 21 at 10:10









            Essex Boy

            4,3351815




            4,3351815












            • @ Essex Boy, I actually already had the similar pom configurations. i have edited my question to make it more clear . Could you please have a look and provide the insights..thanks!
              – MaFiA
              Nov 21 at 11:19


















            • @ Essex Boy, I actually already had the similar pom configurations. i have edited my question to make it more clear . Could you please have a look and provide the insights..thanks!
              – MaFiA
              Nov 21 at 11:19
















            @ Essex Boy, I actually already had the similar pom configurations. i have edited my question to make it more clear . Could you please have a look and provide the insights..thanks!
            – MaFiA
            Nov 21 at 11:19




            @ Essex Boy, I actually already had the similar pom configurations. i have edited my question to make it more clear . Could you please have a look and provide the insights..thanks!
            – MaFiA
            Nov 21 at 11:19












            up vote
            0
            down vote














            Next, lets say i make modification in config module class code. How can I just deploy the jar of config module in cloud? Would my app still work?




            It's not possible to do a partial deploy to Cloud Foundry. By this I mean that you can't take one JAR file from your app and swap that into the existing application code bundle. You need to do a cf push every time you're changing code, no matter how small the change.



            When you run cf push you are sending a "complete" bundle of application code to Cloud Foundry to run. If you change any part of that complete bundle, you need to cf push again. This may sound inefficient but cf push is smart and skip files that are already on the server, so you'll notice that subsequent pushes are smaller and faster.



            You do still need to stage & restart the application though. This is unavoidable as you cannot change an application in-place. This would make a snowflake, or app that has diverged from it's droplet, and that's considered bad practice.



            Long story short...




            1. Rebuild the module that changed.

            2. Rebuild the JAR/WAR that you are pushing to Cloud Foundry.

            3. Push to Cloud foundry


            Your changes will be deployed.






            share|improve this answer

























              up vote
              0
              down vote














              Next, lets say i make modification in config module class code. How can I just deploy the jar of config module in cloud? Would my app still work?




              It's not possible to do a partial deploy to Cloud Foundry. By this I mean that you can't take one JAR file from your app and swap that into the existing application code bundle. You need to do a cf push every time you're changing code, no matter how small the change.



              When you run cf push you are sending a "complete" bundle of application code to Cloud Foundry to run. If you change any part of that complete bundle, you need to cf push again. This may sound inefficient but cf push is smart and skip files that are already on the server, so you'll notice that subsequent pushes are smaller and faster.



              You do still need to stage & restart the application though. This is unavoidable as you cannot change an application in-place. This would make a snowflake, or app that has diverged from it's droplet, and that's considered bad practice.



              Long story short...




              1. Rebuild the module that changed.

              2. Rebuild the JAR/WAR that you are pushing to Cloud Foundry.

              3. Push to Cloud foundry


              Your changes will be deployed.






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote










                Next, lets say i make modification in config module class code. How can I just deploy the jar of config module in cloud? Would my app still work?




                It's not possible to do a partial deploy to Cloud Foundry. By this I mean that you can't take one JAR file from your app and swap that into the existing application code bundle. You need to do a cf push every time you're changing code, no matter how small the change.



                When you run cf push you are sending a "complete" bundle of application code to Cloud Foundry to run. If you change any part of that complete bundle, you need to cf push again. This may sound inefficient but cf push is smart and skip files that are already on the server, so you'll notice that subsequent pushes are smaller and faster.



                You do still need to stage & restart the application though. This is unavoidable as you cannot change an application in-place. This would make a snowflake, or app that has diverged from it's droplet, and that's considered bad practice.



                Long story short...




                1. Rebuild the module that changed.

                2. Rebuild the JAR/WAR that you are pushing to Cloud Foundry.

                3. Push to Cloud foundry


                Your changes will be deployed.






                share|improve this answer













                Next, lets say i make modification in config module class code. How can I just deploy the jar of config module in cloud? Would my app still work?




                It's not possible to do a partial deploy to Cloud Foundry. By this I mean that you can't take one JAR file from your app and swap that into the existing application code bundle. You need to do a cf push every time you're changing code, no matter how small the change.



                When you run cf push you are sending a "complete" bundle of application code to Cloud Foundry to run. If you change any part of that complete bundle, you need to cf push again. This may sound inefficient but cf push is smart and skip files that are already on the server, so you'll notice that subsequent pushes are smaller and faster.



                You do still need to stage & restart the application though. This is unavoidable as you cannot change an application in-place. This would make a snowflake, or app that has diverged from it's droplet, and that's considered bad practice.



                Long story short...




                1. Rebuild the module that changed.

                2. Rebuild the JAR/WAR that you are pushing to Cloud Foundry.

                3. Push to Cloud foundry


                Your changes will be deployed.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 25 at 1:56









                Daniel Mikusa

                5,2411813




                5,2411813






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53409078%2fhow-to-deploy-multi-module-maven-spring-boot-project-in-pivotal-cloud-foundry%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Berounka

                    Sphinx de Gizeh

                    Different font size/position of beamer's navigation symbols template's content depending on regular/plain...