云函数抛出错误找不到私有git存储库中的工件

问题描述

我正在尝试部署一个Spring Cloud函数,该函数具有来自私有GitLab Maven存储库的依赖关系。尽管在settings.xml中提供了令牌,但是Spring cloud函数构建失败并显示以下错误

Build Failed: [INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for io.spring.sample:function-sample:jar:2.0.0.RELEASE
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-deploy-plugin is missing. @ line 82,column 12
[WARNING] 'build.plugins.plugin.version' for org.springframework.boot:spring-boot-maven-plugin is missing. @ line 89,column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason,future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------< io.spring.sample:function-sample >------------------
[INFO] Building function-sample 2.0.0.RELEASE
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] Downloading from gitlab-maven: https://gitlab.com/<path-to-git-depencency>
[INFO] Downloading from gitlab-maven: https://gitlab.com/<path-to-git-depencency>
[WARNING] The POM for <library> is missing,no dependency information available
[INFO] Downloading from gitlab-maven: https://gitlab.com/<path-to-git-depencency>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.738 s
[INFO] Finished at: 2020-08-25T13:04:06Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project function-sample: Could not resolve dependencies for project io.spring.sample:function-sample:jar:2.0.0.RELEASE: Could not find artifact <library name>in gitlab-maven (<path-to-git-depencency>) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors,re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException; Error ID: efa79f31

Settings.xml

<settings xmlns="http://maven.apache.org/POM/4.0.0"

 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

 <servers>

 <server>

 <id>gitlab-maven</id>

 <configuration>

 <httpHeaders>

 <property>

 <name>Private-Token</name>

 <value>xxxx</value>

 </property>

 </httpHeaders>

 </configuration>

 </server>

 </servers>

 </settings>

POM.xml

    <repository>

 <id>gitlab-maven</id>

 <url><gitlab-path></url>

 </repository>

 <repository>

 <snapshots>

 <enabled>true</enabled>

 </snapshots>

 <id>central</id>

 <name>central</name>

 <url>https://repo.maven.apache.org/maven2/

 </repository>

相同的代码在本地和GKE集群中均有效。我无法调试。是否可以在云函数内部运行maven命令来检查错误

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)