我在笔记本中安装了 Nexus 存储库,然后在其中上传了一个快照项目。这是它的样子:
现在,我正在尝试构建一个 Docker 映像,其中另一个项目将前一个项目作为依赖项。这是我的 Dockerfile:
FROM maven:3.5.2-jdk-8-alpine AS MAVEN_BUILD
COPY settings.xml /usr/share/maven/ref/
COPY pom.xml /build/
RUN echo $(route -n | awk '/UG[ \t]/{print $2}')
RUN sed -i "s/localhost/$(route -n | awk '/UG[ \t]/{print $2}')/g" /build/pom.xml
COPY src /build/src/
WORKDIR /build/
RUN mvn package -DskipTests=true
# Other stuff that doesn't matter...
我已将此行添加到 pom.xml 以解决来自 Nexus 的依赖关系(locahost 被替换为 docker 网关 IP(请参阅 Dockerfile)):
<repositories>
<repository>
<id>maven-group</id>
<url>http://localhost:8081/repository/maven-group/</url>
</repository>
</repositories>
它按预期工作,直到 maven 需要下载我自己的库依赖项(上传到 Nexus 的依赖项),失败并显示消息:
[ERROR] Failed to execute goal on project springboot-servicio-producto: Could not resolve dependencies for project com.abarazal.springboot.app.producto:springboot-servicio-producto:jar:0.0.1-SNAPSHOT: Could not find artifact com.abarazal.springboot.app.commons:springboot-servicio-commons:jar:0.0.1-SNAPSHOT in maven-group (http://172.17.0.1:8081/repository/maven-group/) -> [Help 1]
在 pom.xml 中,依赖关系声明为:
<dependency>
<groupId>com.abarazal.springboot.app.commons</groupId>
<artifactId>springboot-servicio-commons</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
为了让它发挥作用,我还缺少什么?
我复制了“使用”选项卡下的依赖项标签。
如用法所示,从那里复制依赖项(在您的情况下),
<dependency>
<groupId>com.abarazal.sringboot.app.commons</groupId>
<artifactId>springboot-servicio-commons</artifactId>
<version>0.0.1.20200017.2123240</version>
</dependency>
然后重新加载pom。
检查您的可用磁盘空间是否超过 10%。 这可能是弹性搜索引起的问题。