title: Gradle Maven Plugin: compiling subprojects
body: <p>I have a project structure like this:</p>
  
  <pre><code>A
    src
      ...
    build.gradle
  B
    src
      ...
    build.gradle
  build.gradle
  settings.gradle
  </code></pre>
  
  <p>Module A <code>build.gradle</code> looks like this:</p>
  
  <pre><code>apply plugin: "java"
  
  dependencies {
      compile project(':B')
  }
  
  // Maven configurations.
  apply plugin: "maven-publish"
  
  task sourceJar(type: Jar) {
      from sourceSets.main.allSource
  }
  
  artifacts {
      archives sourceJar
  }
  
  publishing {
      repositories {
          maven { url "https://..." }
      }
  
      publications {
           mavenJava(MavenPublication) {
               groupId = "..."
               artifactId = "..."
               version = "..."
  
              from components.java
           }
      }
  }
  </code></pre>
  
  <p>It compiles just fine but when it gets published, user gets an error that dependency <code>default:B:unspecified</code> cannot be resolved. How do I tell Gradle Maven plugin to statically compile module B into the artifact being published (rather than list it as a dependency)?</p>
  
  <p>The whole project is a bit more complex and I do not want to either duplicate B source nor publish module B to Maven as a standalone library.</p>