apache / apache/maven-build-cache-extension
[MBUILDCACHE-68] NoSuchElementException in CacheUtils.getLast(…)
- Dominant language
- Java
- Stars
- 163
- Forks
- 77
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 4
Description
**[Oliver Drotbohm](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=oliver.gierke)** opened **[MBUILDCACHE-68](https://issues.apache.org/jira/browse/MBUILDCACHE-68?redirect=false)** and commented
I have a multi-module project with the build cache extension added. The first run works fine, but the second run immediately fails to use the cache with this exception of every module:
```
[INFO] Local build found by checksum fa6e7de90dd0f397
[INFO] Found cached build, restoring org.springframework.modulith:spring-modulith-actuator from cache by checksum fa6e7de90dd0f397
[ERROR] Failed to restore project
java.util.NoSuchElementException
at org.apache.maven.buildcache.CacheUtils.getLast (CacheUtils.java:138)
at org.apache.maven.buildcache.xml.Build.getHighestCompletedGoal (Build.java:138)
at org.apache.maven.buildcache.LifecyclePhasesHelper.isLaterPhaseThanBuild (LifecyclePhasesHelper.java:119)
at org.apache.maven.buildcache.LifecyclePhasesHelper.getCachedSegment (LifecyclePhasesHelper.java:191)
at org.apache.maven.buildcache.CacheControllerImpl.analyzeResult (CacheControllerImpl.java:248)
at org.apache.maven.buildcache.CacheControllerImpl.findLocalBuild (CacheControllerImpl.java:222)
at org.apache.maven.buildcache.CacheControllerImpl.findCachedBuild (CacheControllerImpl.java:187)
at org.apache.maven.buildcache.BuildCacheMojosExecutionStrategy.execute (BuildCacheMojosExecutionStrategy.java:117)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
```
Steps to reproduce:
```
$ git clone https://github.com/spring-projects/spring-modulith
$ cd spring-modulith
$ ./mvnw # runs fine
$ ./mvnw #shows the exception
```
---
**Affects:** 1.0.1
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at CacheUtils.getLast in CacheUtils.java:138 and trace how Build.getHighestCompletedGoal in Build.java:138 handles the cached build metadata. Reproduce the failure by running ./mvnw twice in the spring-modulith checkout, then verify that the second run restores every module from the cache without throwing NoSuchElementException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100