title: import JPA Model from gradle sub-project in Spring
body: <p>In an android project, I want to use a shared model library with the REST Server(JPA)<br>
  Project structure:</p>
  
  <pre><code>├── android
  │   └ ...
  │
  ├── model
  │   ├── build.gradle
  │   └── src
  │       └── com
  │           └── model                            // error at runtime
  │               └── Customer.java
  ├── server
  │   ├── build.gradle
  │   └── src
  │       └── com
  │           └── server
  │                ├── Application.java
  │                ├── CustomerController.java
  │                ├── CustomerRepository.java
  │                └── model                       // works fine
  │                    └── Customer.java
  ├── build.gradle
  </code></pre>
  
  <p>I am using gradle sub-projects to manage the dependency which works fine at compile time.
  But when I run the Application, Spring can't resolve the JPA annotations.
  When I move the model class to the server project, it works fine.</p>
  
  <pre><code>Exception in thread "main" org.springframework.beans.factory.BeanCreationException:
  Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [...] Instantiation of bean failed;
  [...] 
  Not an managed type: class com.model.Customer
  </code></pre>
  
  <p><strong>root <code>build.gradle</code></strong></p>
  
  <pre><code>buildscript {  ...  }
  
  allprojects {
      repositories {
          mavenCentral()
      }
  }
  
  project(":android") {  ...  }
  
  project(":model") {
      apply plugin: "java"
  }
  
  project(":server") {
      apply plugin: "java"
  
      dependencies {
          compile project(":model")
      }
  }
  </code></pre>
  
  <p><strong>Is there a solution to include JPA models from a gradle sub-project ?</strong><br>
  The reason is mostly to prevent duplicate code between the android and server appication </p>