【问题标题】:GitHub maven CI error Missing commit <commit hash>GitHub maven CI 错误缺少提交 <commit hash>
【发布时间】:2021-07-31 00:53:38
【问题描述】:

我正在尝试在 GitHub 上设置标准 maven CI 管道(所以只是 mvn 包),但我总是收到错误“错误:缺少提交”,其中引用了倒数第二个提交(所以不是这个提交运行正在检查,但之前的提交)。

我已经通过删除它并重新设置它来重置整个构建管道,但这没有帮助。

maven.yml 是 GitHub 创建的标准 maven.yml,但这里是:

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 16
        uses: actions/setup-java@v2
        with:
          java-version: '16'
          distribution: 'adopt'
      - name: Build with Maven
        run: mvn -B package --file pom.xml

提前谢谢你!

编辑: 这是完整的错误日志(现在也带有 -X):

Error:  Missing commit 3914bff7919d762d5e6708304167e2047133595d -> [Help 1]
org.eclipse.jgit.errors.MissingObjectException: Missing commit 3914bff7919d762d5e6708304167e2047133595d
    at org.eclipse.jgit.internal.storage.file.WindowCursor.open (WindowCursor.java:149)
    at org.eclipse.jgit.revwalk.RevWalk.getCachedBytes (RevWalk.java:853)
    at org.eclipse.jgit.revwalk.RevCommit.parseHeaders (RevCommit.java:143)
    at org.eclipse.jgit.revwalk.MergeBaseGenerator.next (MergeBaseGenerator.java:148)
    at org.eclipse.jgit.revwalk.StartGenerator.next (StartGenerator.java:102)
    at org.eclipse.jgit.revwalk.RevWalk.next (RevWalk.java:414)
    at org.eclipse.jgit.revwalk.RevWalk.isMergedInto (RevWalk.java:391)
    at edu.kit.ipd.lez.maven.ChangeLogMojo$$anonfun$findBranch$2.apply (ChangeLogMojo.scala:100)
    at edu.kit.ipd.lez.maven.ChangeLogMojo$$anonfun$findBranch$2.apply (ChangeLogMojo.scala:99)
    at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply (TraversableLike.scala:778)
    at scala.collection.Iterator$class.foreach (Iterator.scala:750)
    at scala.collection.AbstractIterator.foreach (Iterator.scala:1202)
    at scala.collection.IterableLike$class.foreach (IterableLike.scala:72)
    at scala.collection.AbstractIterable.foreach (Iterable.scala:54)
    at scala.collection.TraversableLike$WithFilter.foreach (TraversableLike.scala:777)
    at edu.kit.ipd.lez.maven.ChangeLogMojo.findBranch (ChangeLogMojo.scala:99)
    at edu.kit.ipd.lez.maven.ChangeLogMojo$$anonfun$1.apply (ChangeLogMojo.scala:52)
    at edu.kit.ipd.lez.maven.ChangeLogMojo$$anonfun$1.apply (ChangeLogMojo.scala:52)
    at scala.collection.immutable.List.map (List.scala:273)
    at edu.kit.ipd.lez.maven.ChangeLogMojo.execute (ChangeLogMojo.scala:52)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Error:  
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/MissingObjectException
Error: Process completed with exit code 1.

(URL 指向 404 页面)

【问题讨论】:

  • 请使用-e-X 重新运行以显示完整消息。
  • @JFabianMeier 完成。作为信息: lez 插件是我们大学用来自动测试我们上传的提交,将提交消息打包成一个不错的文件等的东西。但是设置 GitHub CI 不是任务的一部分,只是我想了解并亲自做对的事情。

标签: maven github github-actions


【解决方案1】:

我想问题在于结帐。来自结帐操作说明:

# Number of commits to fetch. 0 indicates all history for all branches and tags.
    # Default: 1
    fetch-depth: ''

所以你可能只获取一个提交,就是这样。然后找不到其他提交。

【讨论】:

  • 这确实是问题所在。阅读本文的其他人请注意:您必须为操作/checkout@v2 操作指定 fetch-depth: 0。
猜你喜欢
  • 2020-05-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-12
  • 2015-07-22
  • 1970-01-01
  • 2011-02-25
  • 2016-10-03
相关资源
最近更新 更多