Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-2978

Cyclic dependency in multi-module project when business module focussed after web scaffold

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.2.0.RELEASE
    • Fix Version/s: 1.2.1.RELEASE
    • Component/s: None
    • Labels:
      None

      Description

      1. Run this script:
        project --topLevelPackage com.sample
        module create --topLevelPackage ~.core --moduleName my
        jpa setup --database H2_IN_MEMORY --provider HIBERNATE
        entity jpa --class ~.Book
        field string --fieldName title
        module focus --moduleName ~
        module create --topLevelPackage ~.web --moduleName web
        web mvc setup
        web mvc scaffold --backingType my|~.Book --class web|~.BookController
        module focus --moduleName my
      2. Roo incorrectly makes the "my" module depend on the "web" module:
        ...
        Updated my|ROOT/pom.xml [added dependency com.sample.web:web:0.1.0.BUILD-SNAPSHOT]
        ...
      3. You can confirm this is invalid by running "mvn validate":
        [INFO] Scanning for projects...
        [ERROR] The projects in the reactor contain a cyclic reference: Edge between 'Vertex{label='com.sample.web:web:0.1.0.BUILD-SNAPSHOT'}' and 'Vertex{label='com.sample.core:my:0.1.0.BUILD-SNAPSHOT'}' introduces to cycle in the graph com.sample.core:my:0.1.0.BUILD-SNAPSHOT --> com.sample.web:web:0.1.0.BUILD-SNAPSHOT --> com.sample.core:my:0.1.0.BUILD-SNAPSHOT -> [Help 1]
        [ERROR] 
        [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
        [ERROR] Re-run Maven using the -X switch to enable full debug logging.
        [ERROR] 
        [ERROR] For more information about the errors and possible solutions, please read the following articles:
        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectCycleException

      The workaround is to edit the "my" module's POM and delete the dependency on the "web" module's WAR file.

      The bug doesn't occur if you remove the final "module focus" command from the above script (running it separately via the shell doesn't add the dependency, oddly).

      The impact of this is that scripts need to issue all necessary commands to the non-web modules (e.g. creating entities, services, and repositories) before creating any web modules.

        Attachments

          Activity

            People

            Assignee:
            aswan Andrew Swan
            Reporter:
            aswan Andrew Swan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: