这个问题是基于教程Build a Batch Pipeline with Maven Archetypes (Scala)的最小可重复示例,尽管我们无法在为客户构建的管道中使用模式工件。
我们有一个单独的存储库,我们想从中发布(mvn deploy
)模式。我们运行相当于(替换djv
为您自己的唯一字符串)的设置:
$ 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 << EOF > schema/proto/src/main/proto/com/example/djv/nodecardinality/schema/v1/schema.proto
syntax = "proto3";
>
> package com.example.djv.nodecardinality.schema.v1;
>
> message NodeCardinalityPartition {
> repeated NodeCardinality node_cardinality = 1;
> }
>
> message NodeCardinality {
> string id = 1;
> uint32 cardinality = 2;
> }
> EOF
$ # <edit schema/ds/pom.xml per the tutorial>
$ cd schema
$ mvn deploy
主要症状
在 OLP 门户中,我可以在模式列表中看到我的新模式。它解释说我可以像这样添加对它的依赖:
<dependency>
<groupId>com.example.djv.nodecardinality</groupId>
<artifactId>schema_v1_scala_2.11</artifactId>
<version>1.0.0</version>
<type>jar</type>
</dependency>
但是,我无法下载processor
项目中的工件:
$ 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 -> [Help 1]
...
我们看到这个失败只是因为我们在为项目运行processor
的同一台机器上运行项目构建,mvn deploy
因此缓存schema
中存在一些文件。~/.m2
如果没有这些文件,下载就会失败:
[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/) -> [Help 1]
次要症状
正如我们在上面看到的,mvn deploy
从本地schema
目录运行并不会将构建所需的所有内容都放入本地~/.m2
存储库(即构建processor
子项目)。要将所需文件放入本地~/.m2
存储库,我们需要从模式存储库mvn install
的父目录 ( ) 运行。nodecardinality
这使我们至少可以在本地(临时)进行开发。
部分分辨率
按照依赖管理·OLP SDK页面上的工件服务部分中的说明进行操作。尽管构建变得更远,但它仍然无法提取依赖项:
[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/) -> [Help 1]