1

I´ve searching a lot and found like nothing that helps me for my problem.

My Project is a homepage (using Java, Wicket, Tomecat and Maven) and I want to have two modules because I want to turn Module B off and on if want to. The Problem is I want to link from Module A to B and back.

If I try to build my project it doesnt work. I guess its getting into a never ending cycle while building because he is searching for the dependecys... but how do I solve that problem?

Module A -> Module B

Module B <- Module A

The dependencies of Module A looks like this:

<dependencies>
    <dependency>
        <groupId>package.webapp</groupId>
        <artifactId>module_b</artifactId>
        <version>1.0-SNAPSHOT</version>        
        <scope>compile</scope>       
    </dependency>
</dependencies>

The dependencies of Module B looks like this:

<dependencies>  
    <dependency>
        <groupId>package.webapp</groupId>
        <artifactId>module_a</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <scope>compile</scope>  
    </dependency>
</dependencies>
monti
  • 455
  • 7
  • 25

2 Answers2

3

Having cyclic dependencies between maven artifacts is a bad practice. I would advise you to split the module into three and have the shared code in module_c. That way you can let both A and B depend on C.

Jeroen
  • 3,076
  • 1
  • 17
  • 16
  • Further reading on the topic: http://stackoverflow.com/questions/16468525/how-to-resolve-maven-cyclic-dependency , http://stackoverflow.com/questions/13347222/maven-cyclic-dependencies – Gimby Sep 11 '14 at 11:15
  • thought about that solution too but wasnt sure if its a good idea.. thanks for that. I didnt searched for cyclic dependencies.. thanks a lot – monti Sep 12 '14 at 07:44
0

Create new module C, that will be dependent from both of your moudles, or make both modules dependent from that new C module, but not from each other. For what you tell, it looks more like that second one.

Tomasz Bekas
  • 666
  • 6
  • 15