title: Gradle: configure sub-project (module) from parent build script
body: <p>I split my project onto modules/sub-projects following this guide:</p>
  
  <p><a href="https://docs.gradle.org/current/userguide/multi_project_builds.html" rel="nofollow noreferrer">https://docs.gradle.org/current/userguide/multi_project_builds.html</a></p>
  
  <p>In the main script <code>build.gradle</code> i apply the configuration for the sub-projects:</p>
  
  <pre><code>subprojects {
    repositories {
      mavenCentral()
    }
  }
  </code></pre>
  
  <p>And this works fine if i run the subproject build from the root build directory: </p>
  
  <pre><code>mainProject$ ./gradlew clean :common:build 
  </code></pre>
  
  <p>(successfully builds <code>:common</code> module)</p>
  
  <p>BUT i want to be able to build the <code>:common</code> module being in <code>common</code> directory:</p>
  
  <pre><code>mainProject$ cd common
  common$ ./gradlew clean build 
  </code></pre>
  
  <p>This fails if the <em>repositories</em> are not configured explicitly in <code>common/build.gradle</code> file. But i did it already in the parent config above and i'd like the subprojects pick-up parent config where it's possible.</p>
  
  <p>So, hot to configure parent project and sub-projects so when i run a subproject build from the subproject directory, it considers parent configuration as well (and not only repositories configuration, but also some constants, dependencies and so on).</p>