Build fails out of the gate
- Dominant language
- Java
- Stars
- 17
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
Hello, I am trying to do `mvn clean install` but some tests fail due to some files being used by other parts of the system while a test is to remove that file. It's affecting Windows computers, but builds fine on Linux. Here is the log:
```
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running se.kth.castor.jdbl.adapter.CustomClassReaderTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.11 s - in se.kth.castor.jdbl.adapter.CustomClassReaderTest
[INFO] Running se.kth.castor.jdbl.coverage.JacocoReportReaderTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.05 s - in se.kth.castor.jdbl.coverage.JacocoReportReaderTest
[INFO] Running se.kth.castor.jdbl.coverage.JCovCoverageTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.101 s - in se.kth.castor.jdbl.coverage.JCovCoverageTest
[INFO] Running se.kth.castor.jdbl.coverage.JCovReportReaderTest
calc/Calc : [(II)V, sum()I]
calc/Main : [main([Ljava/lang/String;)V]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.011 s - in se.kth.castor.jdbl.coverage.JCovReportReaderTest
[INFO] Running se.kth.castor.jdbl.coverage.UsageAnalysisTest
calc/Calculator : [(II)V, other()I, sum()I]
calc/CalculatorB : [()V]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.006 s - in se.kth.castor.jdbl.coverage.UsageAnalysisTest
[INFO] Running se.kth.castor.jdbl.util.JarUtilsTest
0 [main] INFO se.kth.castor.jdbl.util.JarUtils - Decompressing: org.jacoco.agent-0.7.9.jar in D:\MasterThesis\debloatingTools\jdbl-master\jdbl-core\src\test\resources\jars\decompressed
18 [main] INFO se.kth.castor.jdbl.util.JarUtils - Decompressing: jacocoagent.jar in D:\MasterThesis\debloatingTools\jdbl-master\jdbl-core\src\test\resources\jars\decompressed
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.252 s - in se.kth.castor.jdbl.util.JarUtilsTest[INFO] Running se.kth.castor.jdbl.util.MyFileUtilsTest
186 [main] INFO se.kth.castor.jdbl.util.MyFileUtils - Removed class: calc\Calculator
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.028 s <<< FAILURE! - in se.kth.castor.jdbl.util.MyFileUtilsTest
[ERROR] deleteUnusedClasses(se.kth.castor.jdbl.util.MyFileUtilsTest) Time elapsed: 0.027 s <<< ERROR!
java.nio.file.FileSystemException:
D:\MasterThesis\debloatingTools\jdbl-master\jdbl-core\src\test\resources\classes\output\calc\Calculator.class: The process cannot access the file because it is being used by another process.
at se.kth.castor.jdbl.util.MyFileUtilsTest.deleteUnusedClasses(MyFileUtilsTest.java:42)
[ERROR] deleteUnusedClasses(se.kth.castor.jdbl.util.MyFileUtilsTest) Time elapsed: 0.027 s <<< ERROR!
java.io.IOException: Unable to delete file: src\test\resources\classes\output\calc\Calculator.class
at se.kth.castor.jdbl.util.MyFileUtilsTest.restoreFiles(MyFileUtilsTest.java:51)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] se.kth.castor.jdbl.util.MyFileUtilsTest.deleteUnusedClasses(se.kth.castor.jdbl.util.MyFileUtilsTest)
[ERROR] Run 1: MyFileUtilsTest.deleteUnusedClasses:42 ≫ FileSystem D:\MasterThesis\debloating...
[ERROR] Run 2: MyFileUtilsTest.restoreFiles:51 ≫ IO Unable to delete file: src\test\resources...
[INFO]
[INFO]
[ERROR] Tests run: 9, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for jdbl-parent-pom 1.0.0:
[INFO]
[INFO] jdbl-parent-pom .................................... SUCCESS [ 1.631 s]
[INFO] jdbl-core .......................................... FAILURE [ 6.409 s]
[INFO] jdbl-maven-plugin .................................. SKIPPED
[INFO] jdbl-app ........................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.230 s
[INFO] Finished at: 2025-01-17T16:58:21+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project jdbl-core: There are test failures.
[ERROR]
[ERROR] Please refer to D:\MasterThesis\debloatingTools\jdbl-master\jdbl-core\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :jdbl-core
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Run `mvn clean install` and inspect `se.kth.castor.jdbl.util.MyFileUtilsTest`, especially `deleteUnusedClasses` at line 42 and `restoreFiles` at line 51. Reproduce the file-locking failure on Windows and compare the test-resource cleanup with the Linux behavior. Done means the tests complete successfully on Windows without breaking the existing Linux build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100