apache / apache/maven

project build is failing, sometimes for class not being available

Open
#11,044 2 comments 0 reactions 0 assignees View on GitHub
bug mvn3
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

### Affected version

3.9.9, 3.9.10; 3.9.11

### Bug description

hi,

I'm using maven to build a project composed of 170+ modules.
because of the time taken to build it, I usually use the parallel mode and it's been working great ...

however, lately (less than 2 weeks ago ?), I started to see some failures that prevented the build to complete.
usually, when running the build *WITHOUT* -T option, it completes 'till the end ...
Also, I noticed that when using the Intellij environment, using their 'maven helper' plugin, to build the project, I haven't been able to spot any occurrence of this issue.

however, this time, I was I was able to reproduce the problem without parallel build:

mvn clean install -o -ff -Dmaven.javadoc.skip=true

the error I got from that build was (similar to the ones I'm getting using parallel builds):

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.5.2:test (default-test) on project emc-expressions-base:
[ERROR]
[ERROR] See /Users/thebluemountain/data/git/thebluemountain/eac/emc-expressions-base/target/surefire-reports for the individual test results.
[ERROR] See dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] There was an error in the forked process
[ERROR] Unable to create test class '**com.emc.generics.expressions.ObjELResolverTest**'
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR] Unable to create test class 'com.emc.generics.expressions.ObjELResolverTest'
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:628)
...

looking at the dump file, it does show:
# Created at 2025-08-12T19:11:45.500
java.lang.RuntimeException: Unable to create test class 'com.emc.generics.expressions.ObjELResolverTest'
at org.apache.maven.surefire.api.util.DefaultScanResult.loadClass(DefaultScanResult.java:117)
at org.apache.maven.surefire.api.util.DefaultScanResult.applyFilter(DefaultScanResult.java:85)
at org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:272)
at org.apache.maven.surefire.junit4.JUnit4Provider.setTestsToRun(JUnit4Provider.java:174)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:132)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
Caused by: **java.lang.ClassNotFoundException**: com.emc.generics.expressions.ObjELResolverTest
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
at org.apache.maven.surefire.api.util.DefaultScanResult.loadClass(DefaultScanResult.java:115)
... 8 more

however, the class file already exists:
```
gstat emc-expressions-base/target/test-classes/com/emc/generics/expressions/ObjELResolverTest.class
File: emc-expressions-base/target/test-classes/com/emc/generics/expressions/ObjELResolverTest.class
Size: 3538 Blocks: 8 IO Block: 4096 regular file
Device: 1,18 Inode: 224821872 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 501/thebluemountain) Gid: ( 20/ staff)
Access: 2025-08-12 19:11:45.891487782 +0200
Modify: 2025-08-12 19:11:45.876920286 +0200
Change: 2025-08-12 19:11:45.876920286 +0200
Birth: 2025-08-12 19:11:45.876689286 +0200
```

I'm not sure, though, about the precision of the time (message is reported at Created at 2025-08-12T19:11:45.**500**) ... running on Macbook with sequoia 15.6

notes:
A- the environment, as reported by mvn:

```
mvn -version
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: /Users/thebluemountain/binaries/maven/apache-maven-3.9.9
Java version: 17.0.14, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk@17/17.0.14/libexec/openjdk.jdk/Contents/Home
Default locale: en_FR, platform encoding: UTF-8
OS name: "mac os x", version: "15.6", arch: "aarch64", family: "Mac"
```

B- the maven-compiler-plugin has no special configuration beside setting a and

C- I've tried to reconfigure the Intellij environment to use similar setup (changing the boot idk), but it uses own maven 3.9.9
ie:
/Library/Java/JavaVirtualMachines/openjdk-17.jdk/Contents/Home/bin/java -Dmaven.multiModuleProjectDirectory=/Users/thebluemountain/data/git/thebluemountain/eac -Djansi.passthrough=true -Xshare:off -Dmaven.home=/Users/thebluemountain/Applications/IntelliJ IDEA Community Edition.app/Contents/plugins/maven/lib/maven3 -Didea.modules.paths.file=/Users/thebluemountain/Library/Caches/JetBrains/IdeaIC2024.3/Maven/idea-projects-state-52617d7b.properties -Dclassworlds.conf=/private/var/folders/xg/d0hyfj757mb3ljglz34jx0080000gn/T/idea--mvn.conf -Dmaven.ext.class.path=/Users/thebluemountain/Applications/IntelliJ IDEA Community Edition.app/Contents/plugins/maven/lib/maven-event-listener.jar -javaagent:/Users/thebluemountain/Applications/IntelliJ IDEA Community Edition.app/Contents/lib/idea_rt.jar=49873 -Dfile.encoding=UTF-8 -classpath /Users/thebluemountain/Applications/IntelliJ IDEA Community Edition.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds.license:/Users/thebluemountain/Applications/IntelliJ IDEA Community Edition.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds-2.8.0.jar org.codehaus.classworlds.Launcher -Didea.version=2024.3.5 --offline -Dmaven.javadoc.skip=true clean install -o -T16 -ff

but I suspect there are other differences as, once removed the javaagent, I still cannot run that same command from the shell because maven is complaining about the '--offline':
removing it and running the command would generate errors as well.

What's next ?

at this stage, I'm suspecting antivirus software (sentinel) might play with created files (?) ... but there is no evidence for it to be the cause of this issue.

I am wondering as well whether the message time vs the .class modification time is meaning full explain the issue ...

being very much unaware of the maven project, from code standpoint ...
**Q1**: would you have any pointer in the code or idea for me to follow ... so that i understand what's happening and then possibly apply necessary corrections ?

Thank you,

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.