Results 1 to 7 of 7

Thread: Multimodule application issue. Spring Roo 1.2.2

  1. #1
    Join Date
    Nov 2012
    Posts
    6

    Default Multimodule application issue. Spring Roo 1.2.2

    Hi everyone!

    I have multilayered project, which I created using Spring Roo 1.2.2. Initially it had one maven module, where mongodb, web mvc json, repositories and services were generated/configured.

    The project started growing, so using STS I created three sub-modules, changed the parent packaging from WAR to POM, moved corresponding packages and resources, and slightly refactored pom.xml's - added dependency management, dependencies to core module and maybe something else.

    So everything looked fine, build and tests pass.

    However Roo shell started to hang in STS, hints stopped working. Roo console also hangs, module focus command does not work. Also I see a message that version is missed for some maven plugin (as I remember it was Jetty, which is in pluginManagement section now)

    Can anyone point out what am I doing wrong? Maybe refer me to some documentation, or just explain how to make multi-module application from single-module, keeping Roo functioning?


    PS. This is not the first time when Roo does not deal well with multi-module. I had another project before, that was initially created using Roo multi-module support (using module create, focus etc.). Guys started to refactor POMs that were generated by Roo, to organize dependencies. After that Roo started to be _really_ slow (STS, console, Intelij IDEA, everywhere). Unfortunately we ended up removing Roo from the project. I like Roo idea, so I want to continue using it, but multimodule issues can be a blocker for me.

  2. #2
    Join Date
    Nov 2012
    Posts
    6

    Default

    Example.

    Run script

    Code:
    project --topLevelPackage my.roo.demo.mmp --packaging POM 
    module create --moduleName data-core --topLevelPackage com.velti.mct.core
    module focus --moduleName ~
    module create --moduleName jobs --topLevelPackage my.roo.demo.mmp.jobs
    module focus --moduleName ~
    module create --moduleName web-api --topLevelPackage my.roo.demo.mmp.web
    module focus --moduleName data-core 
    mongo setup --databaseName test
    entity mongo --class ~.model.Record --testAutomatically
    repository mongo --interface ~.repository.RecordRepo --entity ~.model.Record
    module focus --moduleName web-api 
    json add --class data-core|~.model.Record --deepSerialize 
    module focus --moduleName data-core 
    service --interface ~.service.ReceiverService --entity ~.model.Record --class ~.service.ReceiverServiceImpl
    module focus --moduleName web-api 
    web mvc json setup
    web mvc json add --jsonObject data-core|~.model.Record --class ~.controllers.RecordController
    Then in every sub-module insert <parent/>, and remove duplicated <version/> (same as in parent). Then go to Roo console, and you'll see that it is almost dead (try use tab auto-completion on module focus).

    You can find the project code in attachment.

    PS. Actually, generated mongodb code has couple of minor bugs, you can do mvn install to get the idea, but this should be another thread.
    Attached Files Attached Files

  3. #3
    Join Date
    Nov 2012
    Posts
    6

    Default

    Restored version in poms. Worked fine.

    Than removed version and scope from junit. Worked fine.

    Removed version from jetty plugin, got this

    Version is required for org.mortbay.jetty:jetty-maven-plugin

    And console started to hang again.

  4. #4
    Join Date
    Nov 2012
    Posts
    6

    Default

    Looks like I figured out resolution/workaround:

    I have just added this to every sub-module's pom.xml (in addition to <parent/> node, which I was looking for):

    Code:
        <!-- The version is requered by Roo 1.2.2 -->
        <version>${project.parent.version}</version>


    Then I was able to refactor my dependencies without braking Roo. Also eventually in sub-modules I completely removed tags <repositories/>, <properties/> and <pluginRepositories/>!


    For jetty in parent POM added
    Code:
    <jetty.plugin.version>8.1.4.v20120524</jetty.plugin.version>
    Then in plugin declaration
    Code:
                    <plugin>
                        <groupId>org.mortbay.jetty</groupId>
                        <artifactId>jetty-maven-plugin</artifactId>
                        <version>${jetty.plugin.version}</version>
          ...
    And in sub-module

    Code:
                    
                    <groupId>org.mortbay.jetty</groupId>
                    <artifactId>jetty-maven-plugin</artifactId>
                    <!-- The version is requered by Roo 1.2.2 -->
                    <version>${jetty.plugin.version}</version><!--$NO-MVN-MAN-VER$-->

  5. #5
    Join Date
    Nov 2012
    Posts
    6

    Default

    I hope this talking with myself will be useful to anyone

  6. #6

    Default

    Instead of manually inserting <parent/> and removing <version/> tag in each of sub-module's POMs, you could add a --parent "my.roo.demo.mmp:mmp:0.1.0.BUILD-SNAPSHOT" switch while creating a module and that would take care of this for you.

  7. #7
    Join Date
    Nov 2012
    Posts
    6

    Default

    As a conclusion, you need to be very careful when manually editing <version/> in every POM under Roo 1.2.2 project.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •