title: Getting the openapi spec from a library I depend on
body: <p>I have multiple apps that used the same datatypes.  I duplicated these in each OpenAPI spec.  Boo.</p>
  
  <p>I have seen the light and pulled these types to a library, and they are marked as imported in the apps.  The library has it's own openapi spec for the data types, and it is published to a maven repository.</p>
  
  <p>When I build one of my dependent apps, I need to get hold of the openapi spec for the library, so I can resolve the $refs to these datatypes.  I'll replace the refs to the data types with Remote References to the datatypes in the library spec.  The build of an app cannot rely on the build of the library being present.</p>
  
  <p>I am attaching the openapi30.yaml as an artifact on the library and I can see the file in the repo and download it manually.</p>
  
  <pre><code>publishing {
      publications {
          mavenJava(MavenPublication) {
              from components.java
              artifact 'openapi30.yaml'
  
          }
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/efshA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/efshA.png" alt="And the respository shows"></a></p>
  
  <p>Am I approaching this problem correctly?  If I am, how does the build.gradle of my apps retrieve and access this file?  Looking in the .gradle/caches it only pulls down the jar, pom and .module files, not my spec.</p>