title: A cycle was detected in the build path of project in maven
body: <p>There are many headlines on this error. But I can't find solution for me.</p>
  
  <p>I am going to create a multi-module project. <code>parentProject</code>, <code>projectA</code>, <code>projectD</code>, <code>projectUtil</code> and <code>projectW</code>. <code>projectW</code>'s packaging is <strong>war</strong> and contain <code>projectA</code>, <code>projectD</code> and <code>projectUtil</code> <strong>jar</strong> file.</p>
  
  <pre><code>projectParent
  ├───projectA
  │   ├───src
  │   │   └───main/java/projectA
  │   │       ├───ClassA.java
  │   │       └───ClassB.java
  │   └───pom.xml ---- packaging = jar &amp; dependencies = projectD and projectUtil
  ├───projectD
  │   ├───src
  │   │   └───main/java/projectD
  │   │       ├───ClassC.java
  │   │       └───ClassD.java
  │   └───pom.xml ---- packaging = jar &amp; dependencies = projectA and projectUtil
  ├───projectUtil
  │   ├───src
  │   │   └───main/java/projectUtil
  │   │       └───StringUtil.java
  │   └───pom.xml ---- packaging = jar &amp; dependencies = no dependency
  ├───projectW
  │   ├───src
  │   │   └───main/java/projectW
  │   │       └───Test.java
  │   └───pom.xml ---- packaging = war &amp; dependencies = projectA, projectD and projectUtil
  └───pom.xml ---- packaging = pom &amp; modules = projectA, project D, projectUtil and projectW
  </code></pre>
  
  <p>There was error like <em>a cycle was detected in the build path of project.</em> And I turned to the errors into warnings like solution on internet. </p>
  
  <blockquote>
    <p>Windows -> Preferences -> Java-> Compiler -> Building -> Circular
    Dependencies</p>
  </blockquote>
  
  <p>Test.java is worked successfully but maven not install due to this warning now. Could anybody suggest me an solution with the following exception?</p>
  
  <p><a href="https://i.stack.imgur.com/xQON3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xQON3.png" alt="enter image description here"></a></p>
  
  <p>Test.java</p>
  
  <pre><code>ClassA a = new ClassA();
  a.getD().mrbDunya();
  
  ClassD d = new ClassD();
  d.getB().sayHello();
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>parentProject/pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.earslan&lt;/groupId&gt;
      &lt;artifactId&gt;projectParent&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
  
      &lt;name&gt;Project Parent&lt;/name&gt;
  
      &lt;modules&gt;
          &lt;module&gt;projectA&lt;/module&gt;
          &lt;module&gt;projectD&lt;/module&gt;
          &lt;module&gt;projectUtil&lt;/module&gt;
          &lt;module&gt;projectW&lt;/module&gt;
      &lt;/modules&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>projectA/pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;project
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
      xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;com.earslan&lt;/groupId&gt;
          &lt;artifactId&gt;projectParent&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;artifactId&gt;projectA&lt;/artifactId&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;Project A&lt;/name&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.earslan&lt;/groupId&gt;
              &lt;artifactId&gt;projectD&lt;/artifactId&gt;
              &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.earslan&lt;/groupId&gt;
              &lt;artifactId&gt;projectUtil&lt;/artifactId&gt;
              &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.3&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.7&lt;/source&gt;
                      &lt;target&gt;1.7&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>projectUtil/pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;project
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
      xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;com.earslan&lt;/groupId&gt;
          &lt;artifactId&gt;projectParent&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;artifactId&gt;projectUtil&lt;/artifactId&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;Project Util&lt;/name&gt;
  
      &lt;dependencies&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.3&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.7&lt;/source&gt;
                      &lt;target&gt;1.7&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>projectW/pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;project
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
      xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;com.earslan&lt;/groupId&gt;
          &lt;artifactId&gt;projectParent&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;artifactId&gt;projectW&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
  
      &lt;name&gt;Project W&lt;/name&gt;
  
      &lt;dependencies&gt;
          &lt;!-- Project Files Dependency --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.earslan&lt;/groupId&gt;
              &lt;artifactId&gt;projectA&lt;/artifactId&gt;
              &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.earslan&lt;/groupId&gt;
              &lt;artifactId&gt;projectD&lt;/artifactId&gt;
              &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.earslan&lt;/groupId&gt;
              &lt;artifactId&gt;projectUtil&lt;/artifactId&gt;
              &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- JSF Dependency --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.faces&lt;/groupId&gt;
              &lt;artifactId&gt;jsf-api&lt;/artifactId&gt;
              &lt;version&gt;2.2.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.faces&lt;/groupId&gt;
              &lt;artifactId&gt;jsf-impl&lt;/artifactId&gt;
              &lt;version&gt;2.2.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;3.0.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- PrimeFaces Dependency --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.primefaces&lt;/groupId&gt;
              &lt;artifactId&gt;primefaces&lt;/artifactId&gt;
              &lt;version&gt;6.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.primefaces.themes&lt;/groupId&gt;
              &lt;artifactId&gt;bootstrap&lt;/artifactId&gt;
              &lt;version&gt;1.0.10&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;commons-fileupload&lt;/groupId&gt;
              &lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;
              &lt;version&gt;1.3&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;prime-repo&lt;/id&gt;
              &lt;name&gt;PrimeFaces Maven Repository&lt;/name&gt;
              &lt;url&gt;http://repository.primefaces.org&lt;/url&gt;
              &lt;layout&gt;default&lt;/layout&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.3&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.7&lt;/source&gt;
                      &lt;target&gt;1.7&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>