Announcement Announcement Module
Collapse
No announcement yet.
Maven cyclic referance on multi modules project Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Maven cyclic referance on multi modules project

    Hello,

    I have a multi modules project and when I run the command:
    Code:
    mvn clean
    I get a cyclic reference:
    [ERROR] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] The projects in the reactor contain a cyclic reference: Edge between 'Vertex{label='com.learnintouch.lms.service:servic e'}' and 'Vertex{label='com.learnintouch.lms.data:data'}' introduces to cycle in the graph com.learnintouch.lms.data:data --> com.learnintouch.lms.service:service --> com.learnintouch.lms.data:data
    I created my project so:
    Code:
    project --topLevelPackage com.learnintouch.lms --java 6 --packaging pom
    module create --moduleName data --topLevelPackage com.learnintouch.lms.data
    module focus --moduleName ~
    module create --moduleName service --topLevelPackage com.learnintouch.lms.service
    module focus --moduleName ~
    module create --moduleName ui --topLevelPackage com.learnintouch.lms.ui
    module create --moduleName vaadin --topLevelPackage com.learnintouch.lms.ui.vaadin
    module focus --moduleName ~
    
    module focus --moduleName data
    jpa setup --provider HIBERNATE --database MYSQL
    database properties list
    database properties set --key database.username --value learnintouch
    database properties set --key database.password --value mignet
    database properties set --key database.url --value jdbc:mysql://localhost:3306/db_integration
    database properties list
    database introspect --schema db_integration
    database reverse engineer --package ~.domain --schema PUBLIC --testAutomatically --includeNonPortableAttributes
    
    module focus --moduleName service
    service --interface ~.utils.PreferenceService --entity ~.domain.Preference
    service --interface ~.user.UserService --entity ~.domain.User
    
    finder add --finderName findPreferencesByNameEquals
    So I looked in the pom-xml files and I can see the data/pom.xml file contains a dependency on the service module:
    Code:
        <dependency>
          <groupId>com.learnintouch.lms.service</groupId>
          <artifactId>service</artifactId>
          <version>0.1.0.BUILD-SNAPSHOT</version>
        </dependency>
    And the service/pom.xml file contains a dependency on the data module:
    Code:
        <dependency>
          <groupId>com.learnintouch.lms.data</groupId>
          <artifactId>data</artifactId>
          <version>0.1.0.BUILD-SNAPSHOT</version>
        </dependency>
    I had also noticed that when I added the annotation:
    Code:
    @RooService(domainTypes = { com.learnintouch.lms.data.domain.Preference.class })
    in the service.utils.PreferenceService class, it had added, in a Roo maintained file sitting in the data (yes, in the data) module, a code fragment with a reference to the service class. But this is now gone and I cannot see it again. High Chaparal..

    What wrong did I do to have the cyclic reference in the pom.xml files ?

    So I edited the data/pom.xml file and removed the service dependency, and the Maven build clean passed fine.

    But when running the Maven build to compile, it gives me the following compile error:

    [INFO] Compiler errors :
    error at public class PreferenceServiceImpl implements PreferenceService {
    ^^^^^^^^^^^^^^^^^^^^
    /home/stephane/dev/java/projects/spring-roo/learnintouch/service/src/main/java/com/learnintouch/lms/service/utils/PreferenceServiceImpl.java:8:0::0 must implement abstract inter-type declaration: long com.learnintouch.lms.service.utils.PreferenceServi ce.countAllPreferences()
    see also: /home/stephane/dev/java/projects/spring-roo/learnintouch/service/src/main/java/com/learnintouch/lms/service/utils/PreferenceService_Roo_Service.aj:12::0
    error at public class PreferenceServiceImpl implements PreferenceService {
    ^^^^^^^^^^^^^^^^^^^^
    /home/stephane/dev/java/projects/spring-roo/learnintouch/service/src/main/java/com/learnintouch/lms/service/utils/PreferenceServiceImpl.java:8:0::0 must implement abstract inter-type declaration: void com.learnintouch.lms.service.utils.PreferenceServi ce.deletePreference(com.learnintouch.lms.data.doma in.Preference)
    see also: /home/stephane/dev/java/projects/spring-roo/learnintouch/service/src/main/java/com/learnintouch/lms/service/utils/PreferenceService_Roo_Service.aj:13::0
    error at public class PreferenceServiceImpl implements PreferenceService {
    Last edited by stephaneeybert; Apr 15th, 2012, 08:25 AM.

  • #2
    I then added the following in each data and service modules:

    <parent>
    <groupId>com.learnintouch.lms</groupId>
    <artifactId>lms</artifactId>
    <version>0.1.0.BUILD-SNAPSHOT</version>
    </parent>
    And the Maven mvn clean compile passed successfully.

    Comment


    • #3
      I then added the following in each data and service modules:

      <parent>
      <groupId>com.learnintouch.lms</groupId>
      <artifactId>lms</artifactId>
      <version>0.1.0.BUILD-SNAPSHOT</version>
      </parent>
      And the Maven mvn clean compile passed successfully.

      Comment


      • #4
        Here is more on my above:

        in the service.utils.PreferenceService class, it had added, in a Roo maintained file sitting in the data (yes, in the data) module, a code fragment with a reference to the service class. But this is now gone and I cannot see it again. High Chaparal..
        The file src/test/java/com/learnintouch/lms/data/domain/UserDataOnDemand_Roo_DataOnDemand.aj sitting in the data Maven module contains a reference to a service class sitting in the service Maven module:

        Code:
        import com.learnintouch.lms.service.user.UserService;
        
        privileged aspect UserDataOnDemand_Roo_DataOnDemand {
        
            @Autowired
            UserService UserDataOnDemand.userService;
        
        }
        And the the userService is used throughout in the test class.

        It is strange that Roo runs this integration test using the service class having the Spring Roo service Maven module creeping down into the data Maven module.

        How come Roo generates code dependencies in this direction ?

        The service Maven module is dependent on the data Maven module, not the other way around.

        And sure enough the command mvn clean test-compile fails.
        Last edited by stephaneeybert; Apr 15th, 2012, 03:37 PM.

        Comment


        • #5
          Roo service Maven module creeping down into the data Maven module

          Any one ? :-)

          Comment


          • #6
            Hi Stephane,
            Have you had any progress with this issue?
            I'm just encountering it myself with roo 1.2.2.RELEASE and am quite frustrated.
            It seems like there is currently an orthogonal choice between multi-modules and application-layering.

            Thanks,
            Ittai

            Comment


            • #7
              Hi Itai,

              No, I could not solve it and another issue as well, so I put Roo back on its shelf.

              I don't really need Roo at the moment. It is more a curiosity to me for now.

              Kind Regards,

              Comment

              Working...
              X