Skip to content

[agent] fix(manifest): fail clearly on a directory without a Maven or sbt build - #1560

Merged
Jeppe Fredsgaard Blaabjerg (jfblaa) merged 1 commit into
v1.xfrom
jfblaa/rea-814-maven-missing-pom
Sep 24, 2026
Merged

Jeppe Fredsgaard Blaabjerg (jfblaa) merged 1 commit into
v1.xfrom
jfblaa/rea-814-maven-missing-pom

Conversation

@jfblaa

@jfblaa Jeppe Fredsgaard Blaabjerg (jfblaa) commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

[agent]

Fixes REA-814.

What

  • Maven: the facts extension crashed with an NPE on a directory without a POM, because Maven's stand-in project has no basedir. That crash hid Maven's own "no POM in this directory" error. The extension now skips that project, so Maven's error is shown.
  • sbt: sbt runs in any directory by synthesizing a default project. socket manifest scala on a non-sbt directory therefore exited 0 and wrote a bogus facts file. It now fails with a clear message unless there's a build.sbt or a project/ directory.
  • Gradle already refused such a directory with a clear error, so it's unchanged.

Testing

  • Unit tests cover the sbt check: it refuses to run without a build and runs with either marker.
  • Real runs on an empty directory: Maven shows its no-POM error, Gradle shows its own error, and sbt shows the new message and writes nothing. Real Maven and sbt fixture projects still generate facts.

🤖 Generated with Claude Code


Note

Low Risk
Targeted validation and null-guard changes in manifest generation only; they improve error paths without altering successful scan logic.

Overview
Manifest generation now fails clearly when you point socket manifest maven or socket manifest scala at a directory that is not a real build, instead of crashing or writing a bogus .socket.facts.json.

For sbt, runManifestFacts checks for build.sbt or a project/ directory via new looksLikeSbtBuild() and exits with an explicit error before spawning sbt (which would otherwise synthesize a fake project). Unit tests cover the no-build case and both valid markers.

For Maven, the facts and workspaces record engines skip reactor modules whose basedir is null (Maven’s placeholder when there is no POM), so the extension no longer NPEs and Maven’s own “no POM in this directory” message can surface. Gradle behavior is unchanged.

Reviewed by Cursor Bugbot for commit 28cad18. Configure here.

Maven hands the extension a stand-in project with no basedir when it finds
no POM, and the extension's workspace lookup threw an NPE that hid Maven's
own "no POM in this directory" error. Skip that project so Maven's error
surfaces.

sbt runs in any directory by synthesizing a default project, so pointing
`socket manifest scala` at a non-sbt directory wrote a bogus facts file and
exited 0. Refuse to run sbt without a build.sbt or project directory.
@jfblaa
Jeppe Fredsgaard Blaabjerg (jfblaa) merged commit f49bdfc into v1.x Sep 24, 2026
11 checks passed
@jfblaa
Jeppe Fredsgaard Blaabjerg (jfblaa) deleted the jfblaa/rea-814-maven-missing-pom branch September 24, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant