Access restrictions in Eclipse Multiple Projects with Gradle
<p>I have a Gradle Project in Eclipse consisting of multiple subprojects. I currently have subprojects A, B and C.</p>

<p>Project A should have access to Project B. Project B should have access to Project C. But project A should <em>not</em> have access to Project C.</p>

<pre><code>A -&gt; B, B -&gt; C, but not A -&gt; C
</code></pre>

<p>I can easily test this by having a java example class in Project A which tries to use a class from Project C.</p>

<p>I've achieved this with Gradle using the following setup in the main <code>build.gradle</code> file and using the <code>transitive</code> property:</p>

<pre><code>project(':projectA') {
    dependencies {
        compile project(':projectB'), {
            transitive = false
        }
    }
}

project(':projectB') {
    dependencies {
        compile project(':projectC'), {
            transitive = false
        }
    }
}
</code></pre>

<p>Running Gradle's <code>compileJava</code> on Project A's example class gives the correct error message. I would like to have this error should up as a compile error in Eclipse. I was also able to manually configure the classpath in a way that the desired relationship holds, but a Gradle Refresh/Rebuild resets the classpath again.</p>

<p>Is it possible to use Gradle's Java Compiler instead of the Eclipse Compiler? Or should I influence the classpath files when doing a Gradle Refresh/Rebuild? Is there maybe a different solution?</p>

<p>I'd like to hear what is the preferred approach for this situation. Thanks!</p>