Skip to content

Maven: Java tests outside the standard roots are skipped instead of falling back #327

Closed

Description

@adityankale190895

The Maven adapter only recognises sources under src/main/{java,kotlin}, src/test/{java,kotlin} and a plain <testSourceDirectory> (#317). Java or Kotlin files anywhere else in a module are ignored, so a change can miss tests that Maven runs, without falling back:

  • Test roots added by build-helper-maven-plugin. add-test-source with src/it/java: a library change doesn't select src/it/java/a/AppIT.java, and changing AppIT.java itself gives a selective plan with no tests. With "maven": { "goal": "verify" }, Failsafe runs it.
  • A parent POM outside the repository (a company parent) that sets <testSourceDirectory> or <sourceDirectory>. DiffCI can't read it, assumes src/test/java, and misses tests under the real root the same way.

Both reproduce on main at 0d145c7 with small synthetic reactors.

Fix (fail closed first):

  1. A module that contains .java or .kt files outside every root DiffCI recognises gets a blocker, for example Maven <pom>: Java sources outside the standard roots require full validation. This one rule covers both cases above, and any plugin we don't know about.
  2. Optionally, after that: read build-helper-maven-plugin add-source and add-test-source with plain relative paths as extra roots, using the same guards as resolveTestRoot in fix(maven): find tests under a relative <testSourceDirectory> #317, so the common src/it/java layout narrows instead of falling back.

Done when: synthetic fixtures for both cases either select the test under the extra root or fall back, for a library change and for a change to the test file itself. The Maven table in docs/using-diffci.md lists the new reason.

Related: #89 (Maven fallbacks), #317.

Activity

  1. added
    bug
    help wanted
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    adapterbughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions