title: Gradle dependency plugin in a multi module Spring Boot project
body: <p>What does a correct Gradle configuration look like in a multi-module project that uses the Gradle plugins <code>spring-boot-dependencies</code> and <code>spring-boot</code>?</p>
  
  <p>I have the following project setup:</p>
  
  <pre><code>parent
    |
    + build.gradle
    |
    + alpha
    |   |
    |   + build.gradle
    |
    + beta
    |   |
    |   + build.gradle
  </code></pre>
  
  <ul>
  <li>The <code>parent</code> module contains common project configuration.</li>
  <li>The <code>alpha</code> module is a module in which I would like to import dependencies using versions numbers specified in the <a href="http://docs.spring.io/spring-boot/docs/1.3.x/reference/html/using-boot-build-systems.html#using-boot-maven-without-a-parent">spring-boot-dependencies</a> bom, but the result of the is a standard jar.</li>
  <li>The <code>beta</code> module is a module that depends on <code>alpha</code> and the result is an executable Spring Boot jar file (including all dependencies). Consequently, this project needs both the <code>spring-boot-dependencies</code> as well as the <code>spring-boot</code> plugin.</li>
  </ul>
  
  <p>In order to keep the Gradle files DRY, I have extracted common module scripts to the parent's <code>build.gradle</code> file.</p>
  
  <p>Attempts to execute <code>$ gradle build</code> using the project configuration below results in:</p>
  
  <pre><code>&gt; Plugin with id 'io.spring.dependency-management' not found.
  </code></pre>
  
  <hr>
  
  <p><strong>parent gradle.build</strong></p>
  
  <pre><code>allprojects {
      group = "com.example"
      version '0.0.1-SNAPSHOT'
  
      ext {
          dependencyManagementPluginVersion = '0.5.3.RELEASE'
          springBootVersion = '1.3.0.RC1'
      }
  
      apply plugin: 'java'
      apply plugin: 'eclipse'
      apply plugin: 'idea'
  }
  
  subprojects {
      sourceCompatibility = 1.8
      targetCompatibility = 1.8
  
      buildscript {
          repositories {
              jcenter()
              maven { url "https://repo.spring.io/snapshot" }
              maven { url "https://repo.spring.io/milestone" }
          }
          dependencies {
              classpath("io.spring.gradle:dependency-management-plugin:${dependencyManagementPluginVersion}")
              classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
          }
      }
  
      apply plugin: 'io.spring.dependency-management'
  
      dependencyManagement {
          imports {
              mavenBom("org.springframework.boot:spring-boot-dependencies:${springBootVersion}")
  //            mavenBom("org.springframework.boot:spring-boot-starter-parent:${springBootVersion}")
          }
      }
  }
  </code></pre>
  
  <p><strong>alpha build.gradle</strong></p>
  
  <pre><code>dependencies {
      compile('org.springframework:spring-web')
  }
  </code></pre>
  
  <p><strong>beta gradle.build</strong></p>
  
  <pre><code>apply plugin: 'spring-boot'
  
  dependencies {
      compile project(':alpha')
      compile('org.springframework.boot:spring-boot-starter')
      compile('org.springframework.boot:spring-boot-starter-web')
  }
  </code></pre>
  
  <hr>
  
  <p>Comments:</p>
  
  <ul>
  <li>The behavior of the <code>spring-boot</code> plugin <a href="https://github.com/spring-projects/spring-boot/issues/2133">was changed</a> in Spring Boot 1.3.0.M1</li>
  <li>Gradle version: 2.8</li>
  <li>Spring Boot version 1.3.0.RC1</li>
  </ul>