Skip to content

fix(spin-junit-module): find a project's own Maven/Gradle-built main output during test resolution - #173

Merged
deer merged 1 commit into
mainfrom
junit_detect_fix
Aug 3, 2026
Merged

fix(spin-junit-module): find a project's own Maven/Gradle-built main output during test resolution#173
deer merged 1 commit into
mainfrom
junit_detect_fix

Conversation

@deer

@deer deer commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

AbstractDetectTestResolution.additionalSiblingCandidates() used to hardcode the .build/main/<target> path when looking for a project's own compiled main output, which only exists if spin itself built that output. A project compiled solely via mvn compile or Gradle -- never by spin -- has no .build directory at all, so its main classes silently dropped out of the test-resolution candidate list, surfacing as "cannot find symbol" for any type test sources referenced from main, even within the same package.

The fix reuses AbstractDetectResolution.resolveCompiledOutput, the same spin/Maven/Gradle-aware, freshest-by-mtime lookup already used for sibling-project candidates, instead of hand-rolling the spin-only path. That method's visibility was widened from package-private to protected so AbstractDetectTestResolution, which lives in a different package but already extends AbstractDetectResolution, can call it directly.

A new maven-built-main fixture workspace and test (shouldIncludeMavenBuiltMainOutputInTestResolution) model a project with a target/classes directory on disk but no .build directory, and run only the detect.test.compilation.resolution task pattern so the project's own main compiler task never executes, deterministically simulating "already built by Maven, never built by spin."

@deer
deer merged commit 9bcb4d4 into main Aug 3, 2026
1 check passed
@deer
deer deleted the junit_detect_fix branch August 3, 2026 09:18
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