title: How to consume a published OLP schema dependency?
body: <p>This question is a minimum reproducible example based on the tutorial <a href="https://developer.here.com/olp/documentation/data-processing-library/dev_guide/topics/quickstart-scala.html" rel="nofollow noreferrer">Build a Batch Pipeline with Maven Archetypes (Scala)</a>, though we are unable to consume a schema artifact in a pipeline we are building for a customer.</p>
  
  <p>We have a separate repository we want to publish (<code>mvn deploy</code>) the schema from. We ran setup equivalent to (replace <code>djv</code> with your own unique string):</p>
  
  <pre class="lang-sh prettyprint-override"><code>$ mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo.archetypes \
                           -DarchetypeArtifactId=pom-root \
                           -DarchetypeVersion=1.1 \
                           -DgroupId=com.example.djv \
                           -DartifactId=nodecardinality \
                           -Dversion=1.0.0 \
                           -Dpackage=com.example.djv.nodecardinality
  ...
  $ cd nodecardinality
  $ mvn archetype:generate -DarchetypeGroupId=com.here.platform.schema \
                           -DarchetypeArtifactId=project_archetype \
                           -DarchetypeVersion=1.0.13 \
                           -DgroupId=com.example.djv.nodecardinality \
                           -DartifactId=schema \
                           -Dversion=1.0.0 \
                           -Dpackage=com.example.djv.nodecardinality.schema \
                           -DmajorVersion=1
  ...
  $ cat &lt;&lt; EOF &gt; schema/proto/src/main/proto/com/example/djv/nodecardinality/schema/v1/schema.proto
  syntax = "proto3";
  &gt; 
  &gt; package com.example.djv.nodecardinality.schema.v1;
  &gt; 
  &gt; message NodeCardinalityPartition {
  &gt;   repeated NodeCardinality node_cardinality = 1;
  &gt; }
  &gt; 
  &gt; message NodeCardinality {
  &gt;   string id = 1;
  &gt;   uint32 cardinality = 2;
  &gt; }
  &gt; EOF
  $ # &lt;edit schema/ds/pom.xml per the tutorial&gt;
  $ cd schema
  $ mvn deploy
  </code></pre>
  
  <h1>Primary symptom</h1>
  
  <p>In the OLP Portal, I can see my new schema in the list of Schemas. It explains that I can add a dependency on it like so:</p>
  
  <pre><code>&lt;dependency&gt; 
    &lt;groupId&gt;com.example.djv.nodecardinality&lt;/groupId&gt; 
    &lt;artifactId&gt;schema_v1_scala_2.11&lt;/artifactId&gt; 
    &lt;version&gt;1.0.0&lt;/version&gt; 
    &lt;type&gt;jar&lt;/type&gt; 
  &lt;/dependency&gt;
  </code></pre>
  
  <p>However, I cannot download the artifact in the <code>processor</code> project:</p>
  
  <pre><code>$ cd processor
  $ mvn install
  ...
  [INFO] Building processor Direct1toN Batch Processor in Scala 1.0.0                                                                                                                                                
  [INFO] --------------------------------[ jar ]---------------------------------                                                                                                                                    
  Downloading from HERE_PLATFORM_REPO: https://repo.platform.here.com/artifactory/open-location-platform/com/example/djv/nodecardinality/1.0.0/nodecardinality-1.0.0.pom                                             
  Downloading from OLP Public repo: https://artifactory.in.here.com/artifactory/here-olp-sit/com/example/djv/nodecardinality/1.0.0/nodecardinality-1.0.0.pom                                                         
  Downloading from central: https://repo.maven.apache.org/maven2/com/example/djv/nodecardinality/1.0.0/nodecardinality-1.0.0.pom                                                                                     
  [INFO] ------------------------------------------------------------------------                                                                                                                                    
  [INFO] BUILD FAILURE                                                                                                                                                                                               
  ...                                                                                                                                                                 
  [INFO] ------------------------------------------------------------------------ 
  [ERROR] Failed to execute goal on project processor: Could not resolve dependencies for project com.example.nodecardinality:processor:jar:1.0.0: Failed to collect dependencies at com.example.djv.nodecardinality:schema_v1_scala_2.11:jar:1.0.0: Failed to read artifact descriptor for com.example.djv.nodecardinality:schema_v1_scala_2.11:jar:1.0.0: Could not transfer artifact com.example.djv:nodecardinality:pom:1.0.0 from/to HERE_PLATFORM_ARTIFACT (here+artifact-service://artifact-service): Cannot access here+artifact-service://artifact-service with type here using the available connector factories: BasicRepositoryConnectorFactory: Cannot access here+artifact-service://artifact-service with type here using the available layout factories: Maven2RepositoryLayoutFactory: Unsupported repository layout here -&gt; [Help 1]
  ...
  </code></pre>
  
  <p>We see this failure only because we are running the <code>processor</code> project build on the same machine that we ran <code>mvn deploy</code> for the <code>schema</code> project so some files exists in the <code>~/.m2</code> cache. Without these files the download just fails:</p>
  
  <pre><code>[INFO] --------------------------------[ jar ]---------------------------------                                                                                                                                    
  Downloading from HERE_PLATFORM_REPO: https://repo.platform.here.com/artifactory/open-location-platform/com/example/djv/nodecardinality/schema_v1_scala_2.11/1.0.0/schema_v1_scala_2.11-1.0.0.pom                   
  Downloading from OLP Public repo: https://artifactory.in.here.com/artifactory/here-olp-sit/com/example/djv/nodecardinality/schema_v1_scala_2.11/1.0.0/schema_v1_scala_2.11-1.0.0.pom                               
  Downloading from central: https://repo.maven.apache.org/maven2/com/example/djv/nodecardinality/schema_v1_scala_2.11/1.0.0/schema_v1_scala_2.11-1.0.0.pom                                                           
  [WARNING] The POM for com.example.djv.nodecardinality:schema_v1_scala_2.11:jar:1.0.0 is missing, no dependency information available                                                                               
  Downloading from HERE_PLATFORM_REPO: https://repo.platform.here.com/artifactory/open-location-platform/com/example/djv/nodecardinality/schema_v1_scala_2.11/1.0.0/schema_v1_scala_2.11-1.0.0.jar                   
  Downloading from OLP Public repo: https://artifactory.in.here.com/artifactory/here-olp-sit/com/example/djv/nodecardinality/schema_v1_scala_2.11/1.0.0/schema_v1_scala_2.11-1.0.0.jar                               
  Downloading from central: https://repo.maven.apache.org/maven2/com/example/djv/nodecardinality/schema_v1_scala_2.11/1.0.0/schema_v1_scala_2.11-1.0.0.jar                                                           
  [INFO] ------------------------------------------------------------------------                                                                                                                                    
  [INFO] BUILD FAILURE                                                                                                                                                                                               
  ...                                                                                                                                                                   
  [INFO] ------------------------------------------------------------------------                                                                                                                                    
  [ERROR] Failed to execute goal on project processor: Could not resolve dependencies for project com.example.nodecardinality:processor:jar:1.0.0: Could not find artifact com.example.djv.nodecardinality:schema_v1_scala_2.11:jar:1.0.0 in HERE_PLATFORM_REPO (https://repo.platform.here.com/artifactory/open-location-platform/) -&gt; [Help 1] 
  </code></pre>
  
  <h1>Secondary symptom</h1>
  
  <p>As we saw above, running <code>mvn deploy</code> from a local <code>schema</code> directory doesn't put everything required to build in the local <code>~/.m2</code> repository (that is, to build the <code>processor</code> sub-project). To put the required files in the local <code>~/.m2</code> repository we need to run <code>mvn install</code> from the parent directory (<code>nodecardinality</code>) of the schema repository.</p>
  
  <p>This allows us to at least develop locally (temporarily).</p>
  
  <h1>Partial resolution</h1>
  
  <p>Follow the instructions in the section <strong>Artifact Service</strong> on the page <a href="https://developer.here.com/olp/documentation/sdk-developer-guide/dev_guide/topics/dependency-management.html" rel="nofollow noreferrer">Dependency Management · OLP SDK</a>. Although the build gets farther, it still isn't able to pull the dependency:</p>
  
  <pre><code>[INFO] --------------------------------[ jar ]---------------------------------                                                                                                                                    
  Downloading from HERE_PLATFORM_REPO: https://repo.platform.here.com/artifactory/open-location-platform/com/example/djv/nodecardinality/schema_v1_scala_2.11/1.0.0/schema_v1_scala_2.11-1.0.0.pom                   
  Downloading from OLP Public repo: https://artifactory.in.here.com/artifactory/here-olp-sit/com/example/djv/nodecardinality/schema_v1_scala_2.11/1.0.0/schema_v1_scala_2.11-1.0.0.pom                               
  Downloading from HERE_PLATFORM_ARTIFACT: here+artifact-service://artifact-service/com.example.djv.nodecardinality/schema_v1_scala_2.11/1.0.0/schema_v1_scala_2.11-1.0.0.pom                                        
  Downloaded from HERE_PLATFORM_ARTIFACT: here+artifact-service://artifact-service/com.example.djv.nodecardinality/schema_v1_scala_2.11/1.0.0/schema_v1_scala_2.11-1.0.0.pom (3.4 kB at 1.6 kB/s)                    
  Downloading from HERE_PLATFORM_REPO: https://repo.platform.here.com/artifactory/open-location-platform/com/example/djv/nodecardinality/schema_v1/1.0.0/schema_v1-1.0.0.pom
  Downloading from OLP Public repo: https://artifactory.in.here.com/artifactory/here-olp-sit/com/example/djv/nodecardinality/schema_v1/1.0.0/schema_v1-1.0.0.pom
  Downloading from HERE_PLATFORM_ARTIFACT: here+artifact-service://artifact-service/com.example.djv.nodecardinality/schema_v1/1.0.0/schema_v1-1.0.0.pom
  Downloaded from HERE_PLATFORM_ARTIFACT: here+artifact-service://artifact-service/com.example.djv.nodecardinality/schema_v1/1.0.0/schema_v1-1.0.0.pom (8.0 kB at 6.3 kB/s)
  Downloading from HERE_PLATFORM_REPO: https://repo.platform.here.com/artifactory/open-location-platform/com/example/djv/nodecardinality/1.0.0/nodecardinality-1.0.0.pom
  Downloading from OLP Public repo: https://artifactory.in.here.com/artifactory/here-olp-sit/com/example/djv/nodecardinality/1.0.0/nodecardinality-1.0.0.pom
  Downloading from HERE_PLATFORM_ARTIFACT: here+artifact-service://artifact-service/com.example.djv/nodecardinality/1.0.0/nodecardinality-1.0.0.pom
  Downloading from central: https://repo.maven.apache.org/maven2/com/example/djv/nodecardinality/1.0.0/nodecardinality-1.0.0.pom
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE                  
  ...
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal on project processor: Could not resolve dependencies for project com.example.nodecardinality:processor:jar:1.0.0: Failed to collect dependencies at com.example.djv.nodecardinality:schema_v1_scala_2.11:jar:1.0.0: Failed to read artifact descriptor for com.example.djv.nodecardinality:schema_v1_scala_2.11:jar:1.0.0: Could not find artifact com.example.djv:nodecardinality:pom:1.0.0 in HERE_PLATFORM_REPO (https://repo.platform.here.com/artifactory/open-location-platform/) -&gt; [Help 1]
  </code></pre>