title: How can I exclude dependencies brought in from other sub-projects?
body: <p>This is not a duplicate since those other solutions did not work.</p>
  
  <p>I have a sub-project:</p>
  
  <p>:commons:widget</p>
  
  <p>gradle.build (sub-project) resembles this:</p>
  
  <pre><code>configurations {providedCompile}
  
  dependencies {
    compile project(":commons:other-widget")
  ...other dependencies...
  }
  </code></pre>
  
  <p>If you display the dependencies:</p>
  
  <pre><code>+--- project :commons:some-other-project
      +--- project :commons:exclude-me-project (*)
      \--- org.apache.cxf:cxf-rt-frontend-jaxrs: -&gt; 3.0.3 (*)
  </code></pre>
  
  <p>What doesn't work:</p>
  
  <p>Any of the usual syntax. I've tried every variation I can think of. Even went looking for the API but was unable to find what I need there. </p>
  
  <p>In this project's dependencies section:
  ...</p>
  
  <pre><code>compile project(":commons:some-other-project") {
   exclude (":commons:exclude-me-project")
  }
  </code></pre>
  
  <p>Result: </p>
  
  <pre><code>Could not find method exclude() for arguments [:commons:some-other-project] on project 
  </code></pre>
  
  <p>I've also tried:</p>
  
  <pre><code>compile ( project (':commons:some-other-project') ) {
    transitive = false
  }
  </code></pre>
  
  <p>Result: Instead of removing dependencies of ":commons:some-other-project", it removes ":commons:some-other-project".</p>
  
  <p>I have a large and complicated project to convert. I've a lot of this sort of work ahead of me. Given a project as a dependency, how do I exclude things from it?</p>