通过 GitlabCI 部署 Maven 时出现此错误,docker image: maven:3-jdk-8。
Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.mycompany.app:app-all:0.9.3-SNAPSHOT:
Could not transfer artifact com.mycompany:parent:pom:8 from/to maven-default-http-blocker (http://0.0.0.0/):
Blocked mirror for repositories: [app-releases (http://nexus.mycompany.com/content/repositories/app-releases, default, releases+snapshots),
app-snapshots (http://nexus.mycompany.com/content/repositories/app-snapshots, default, releases+snapshots)] and 'parent.relativePath' points at wrong local POM @ line 5, column 10
Run Code Online (Sandbox Code Playgroud)
我在这里找到了一些有关在 settings.xml 文件中编辑镜像的答案。我在 /usr/share/maven/conf/settings.xml 中添加了阻塞的镜像: false
<mirrors>
<mirror>
<id>app-releases</id>
<mirrorOf>app-releases</mirrorOf>
<url>http://nexus.mycompany.com/content/repositories/app-releases</url>
<blocked>false</blocked>
</mirror>
<mirror>
<id>app-snapshots</id>
<mirrorOf>app-snapshots</mirrorOf>
<url>http://nexus.mycompany.com/content/repositories/app-snapshots</url>
<blocked>false</blocked>
</mirror>
</mirrors>
Run Code Online (Sandbox Code Playgroud)
但仍然出现此错误,我不明白为什么它在 maven-default-http-blocker ( http://0.0.0.0/ ) 中搜索工件,而选项 -X (debug) 显示正在使用 settings.xml 文件,所以应该使用我设置的镜子。
1100 [DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
1100 [DEBUG] Reading user settings from /root/.m2/settings.xml
Run Code Online (Sandbox Code Playgroud)
我在镜子定义中犯了错误吗?
可以在本地做镜像。将其添加到~/.m2/settings.xml(这是特定于用户的<maven_dir>/conf/settings.xml.
<settings>
<!-- if you need http connection, enable it and don't block -->
<mirrors>
<mirror>
<id>maven-default-http-blocker</id>
<mirrorOf>external:http:*</mirrorOf>
<name>Pseudo repository to mirror external repositories initially using HTTP.</name>
<url>http://0.0.0.0</url>
<blocked>false</blocked>
</mirror>
</mirrors>
...
</settings>
Run Code Online (Sandbox Code Playgroud)
我什至将网址更改为file:/home/<my_user>/.m2/repository,这解决了我的问题。
| 归档时间: |
|
| 查看次数: |
15480 次 |
| 最近记录: |