Windows Maven Incremental Test Compile
Windows 로컬 Maven에서 compile은 성공했는데 testCompile 또는 전체 테스트 중 main/test class를 대량으로 못 찾는 증상을 다룬다.
특히 cannot find symbol, NoClassDefFoundError, Unable to find a @SpringBootConfiguration가 한꺼번에 터지면 실제 코드 누락보다 Maven compiler incremental cache/classpath 흔들림일 수 있다.
이 문서는 ZIP:ON backend 테스트 검증 중 같은 증상을 빠르게 분리하고 우회하기 위한 절차다.
Status: Implemented
Trigger Signals
cd backend && ./mvnw testor.\mvnw.cmd testfails after maincompilereports success.target/classescontains the missing class, buttestCompilesayscannot find symbol.- Many unrelated tests fail with
NoClassDefFoundError. - Spring tests report
Unable to find a @SpringBootConfigurationeven thoughcom.zipon.ZipOnApplication.classexists. - Re-running a focused test sometimes passes, but full suite fails inconsistently on Windows.
Required Scan
git status --short
cd backend && ./mvnw -vWindows PowerShell class existence check:
Test-Path backend\target\classes\com\zipon\ZipOnApplication.class
Test-Path backend\target\classes\com\zipon\domain\User.classCheck whether the failure is real code breakage first:
$env:JAVA_HOME='C:\Program Files\Eclipse Adoptium\jdk-21.0.11.10-hotspot'
$env:Path="$env:JAVA_HOME\bin;$env:Path"
Set-Location backend
.\mvnw.cmd "-Dtest=<FocusedTestClass>" testSame-Issue Criteria
- At least one missing class exists under
backend/target/classes. - The missing symbols span many unrelated packages.
- A prior run compiled the module or focused tests successfully.
- Adding
-Dmaven.compiler.useIncrementalCompilation=falsechanges the result from classpath-like failure to pass or a real single assertion failure.
Fix Steps
Use the non-incremental compiler flag for verification:
$env:JAVA_HOME='C:\Program Files\Eclipse Adoptium\jdk-21.0.11.10-hotspot'
$env:Path="$env:JAVA_HOME\bin;$env:Path"
Set-Location backend
.\mvnw.cmd "-Dmaven.compiler.useIncrementalCompilation=false" testFor a full clean verification:
$env:JAVA_HOME='C:\Program Files\Eclipse Adoptium\jdk-21.0.11.10-hotspot'
$env:Path="$env:JAVA_HOME\bin;$env:Path"
Set-Location backend
.\mvnw.cmd clean "-Dmaven.compiler.useIncrementalCompilation=false" testIf the non-incremental run still fails with a small, coherent set of assertion failures, treat those as real test failures and fix normally.
Verification
.\mvnw.cmd "-Dmaven.compiler.useIncrementalCompilation=false" test- Confirm output ends with
Tests run: <n>, Failures: 0, Errors: 0, Skipped: 0. - If Flyway migrations are involved, confirm logs include
Successfully validatedand schema version reaches the latest migration.
Do Not
- Do not delete or regenerate source files just because
testCompilesays symbols are missing. - Do not assume the first massive
NoClassDefFoundErrorburst is a code regression. - Do not mark tests as passed unless the non-incremental run succeeds.
- Do not commit local
target/output.