Skip to content

[MCOMPILER-1124] testCompile dependency state tolerates missing target/classes - #1125

Open
arimu1 wants to merge 1 commit into
apache:maven-compiler-plugin-3.xfrom
arimu1:fix/1124-testcompile-classes-dir
Open

arimu1 wants to merge 1 commit into
apache:maven-compiler-plugin-3.xfrom
arimu1:fix/1124-testcompile-classes-dir

Conversation

@arimu1

@arimu1 arimu1 commented Sep 12, 2026

Copy link
Copy Markdown

Summary

  • Fix spurious [WARNING] I/O error reading dependency state: …/target/classes during testCompile on projects with no src/main/java (tests-only modules).
  • Missing classpath/module-path entries are treated like empty directories when persisting dependency state, so incremental testCompile stays stable without false "changed dependency" rebuilds.
  • Adds DependencyStateTest coverage and invoker IT MCOMPILER-1124_test-only-testcompile.

Fixes #1124

Root cause

Since 3.16.0 (#1102), dependency state scanning walks test classpath elements. Tests-only projects still list ${project.build.outputDirectory} on the classpath even when that directory was never created. A missing path was handled as a regular file read failure, which logged a warning and stored an unreadable fingerprint.

Test plan

  • mvn -Dtest=DependencyStateTest test

  • mvn -Prun-its verify -Dinvoker.test=MCOMPILER-1124_test-only-testcompile -DskipTests

  • Manual reproducer (lprimak/maven-test-compiler-reproducer) with compiler.plugin.version=3.16.1-SNAPSHOT: no dependency-state warning on clean test-compile / test-compile

  • I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004

  • In any other case, please file an Apache Individual Contributor License Agreement.

When testCompile scans dependency state, the test classpath may list
target/classes even if no main sources were compiled. Treat a missing
path like an empty directory instead of logging I/O warnings and
recording unstable dependency metadata.

Fixes apache#1124
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant