title: How to best setup Multi Module Gradle Java Project to make a public Java API to a proprietary Codebase?
body: <p>I am currently working on a Multi Module Gradle Java Project and want to expand the project to allow for a public Java API through which developers can add plugins to my core application (API), while my core code remains private (Core). The idea is similar to applications such as:</p>
  <ul>
  <li>The Minecraft Plugin Frameworks (PaperMC), where the actual Minecraft code remains hidden but the respective API is publicly accessible.</li>
  <li>Jenkins</li>
  </ul>
  <p>I am trying to implement such a model for my own project with the following requirements:</p>
  <ol>
  <li>Any code in Core must not be publicly accessible</li>
  <li>When the API module is compiled it should not contain Core, but it has to be available to reference (So that I can ya know build the API)</li>
  <li>Core should have access to API (So that I can integrate the API into the application)</li>
  <li>The Core should have the API compiled into it so that any plugins that are injected can actually be correctly interpreted by the Core</li>
  </ol>
  <p>If any of these requirements pose a fundamental flaw I can of course change the structure, the above is purely based on prior research.</p>
  <p>Here is what I currently have, which is throwing a Circular dependency issue, because I am very clearly setting this up incorrectly.</p>
  <p>Core:</p>
  <pre><code>plugins {
      id 'java'
  }
  
  group 'com.awesomedude'
  version '1.0.0-SNAPSHOT'
  sourceCompatibility = '17'
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      implementation 'org.jetbrains:annotations:22.0.0'
      implementation 'commons-io:commons-io:2.11.0'
      implementation project(':API')
      testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
      testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
  }
  
  test {
      useJUnitPlatform()
  }
  </code></pre>
  <p>API:</p>
  <pre><code>plugins {
      id 'java'
  }
  
  group 'com.awesomedude'
  version '1.0.0-SNAPSHOT'
  sourceCompatibility = '17'
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      compileOnly project(':Core')
      implementation 'org.jetbrains:annotations:22.0.0'
      implementation 'commons-io:commons-io:2.11.0'
      testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
      testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
  }
  
  test {
      useJUnitPlatform()
  }
  </code></pre>