GitHub maven CI error Missing commit <commit hash>

C. *_*ann 0 github maven github-actions

I am trying to set up the standard maven CI pipeline (so just mvn package) on GitHub, but I always get the error "Error: Missing commit ", where is referencing the second last commit (so not the commit that this run is checking, but the commit before).

I already reset the whole build pipeline by deleting it and setting it up freshly again, but that didn't help.

The maven.yml is the standard maven.yml created by GitHub, but here it is:

# 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
Run Code Online (Sandbox Code Playgroud)

Thank you in advance!

编辑:这是完整的错误日志(现在也带有 -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.
Run Code Online (Sandbox Code Playgroud)

(该URL指向404页面)

JF *_*ier 5

我猜问题出在结帐处。从结账操作描述来看:

# Number of commits to fetch. 0 indicates all history for all branches and tags.
    # Default: 1
    fetch-depth: ''
Run Code Online (Sandbox Code Playgroud)

所以你可能只获取一次提交,仅此而已。然后无法找到其他提交。

  • 这确实是问题所在。其他阅读本文的人请注意:您必须为 actions/checkout@v2 操作指定 fetch-depth: 0。 (2认同)