【问题标题】:Failed to execute goal in GitLab CI Pipeline未能在 GitLab CI 管道中执行目标
【发布时间】:2021-11-05 19:57:43
【问题描述】:

当我触发我的应用程序的构建管道时,我收到了未能执行目标错误。但是,当我在本地构建这个应用程序时,我没有得到这样的异常。当我只通过 GitLab 构建时,我会遇到这种情况。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project sample-app: Execution default-clean of goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean failed: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-clean-plugin:jar:2.5 -> org.apache.maven:maven-plugin-api:jar:2.0.6: Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:2.0.6: Could not transfer artifact org.apache.maven:maven-plugin-api:pom:2.0.6 from/to central (https://repo.maven.apache.org/maven2): Connection reset -> [Help 1]

为了更好看,下面还附上了错误图片...

【问题讨论】:

  • 如果可以,请使用code format 将代码、错误等放入帖子本身,而不是上传图片。这有助于使您的问题更具可读性,并防止图像被删除时出现问题。

标签: maven gitlab continuous-integration gitlab-ci pipeline


【解决方案1】:

我们正在与我的团队一起调查此问题的根本原因,但无法找到解决方案。然而,最常见的原因是在不同服务器上运行的 GitLab-Runner 存在连接问题,因此会发生这种情况。

我的一位团队成员找到了一个对我们有用的解决方案。我们的问题解决了,现在 GitLab 管道成功构建并运行。这对我们有用,并希望任何人都会遇到类似的问题也会发现这有帮助。

  <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
    </pluginRepository>
  </pluginRepositories>
  <repositories>
    <repository>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  <repositories>

将上述代码块添加到 POM 文件解决了这个问题。

【讨论】:

    猜你喜欢
    • 2022-01-19
    • 2022-08-11
    • 1970-01-01
    • 2021-01-23
    • 2022-06-12
    • 2021-12-21
    • 2020-12-12
    • 2022-11-15
    • 1970-01-01
    相关资源
    最近更新 更多