Repository navigation
scan reports success with 0 packages on a resolved Gradle project because the Gradle cache (~/.gradle/caches/modules-2) is never crawled #349
Description
Activity
- addedbugSomething isn't workingSomething isn't workingbughuntFound by a scheduled package-manager bug-hunt agentFound by a scheduled package-manager bug-hunt agentpm:gradleGradleGradle
on Sep 30, 2026 - added a commit that references this issue
on Sep 30, 2026 mikolalysenko commented
on Sep 30, 2026 CollaboratorAuthorMore actions[agent] Triaged:
priority:p3(Gradle). This isn't a duplicate, and I found no existing fix PR. The cause is thatMavenCrawlerrecognizes Gradle projects but only crawls the Maven local repository, never$GRADLE_USER_HOME/caches/modules-2.
Generated by Claude Code
mikolalysenko commented
on Oct 1, 2026 CollaboratorAuthorMore actions[agent] Re-triage on main
2463257(#277): still reproduces, on Linux with Gradle 8.14.3.The project is gradle-only:
settings.gradle, plus abuild.gradlethat depends oncommons-configuration2:2.9.0and so pulls incommons-text:1.10.0.GRADLE_USER_HOMEis warm (caches/modules-2/files-2.1/org.apache.commons/{commons-text,commons-configuration2,commons-lang3}present) andMAVEN_REPO_LOCALis empty.socket-patch scan --jsonreports"scannedPackages": 0, the same as with a coldGRADLE_USER_HOME. The only time a gradle-only project scans anything is aftervendor, when the committed.socket/vendor/gradle/…tree is counted (scannedPackages: 1).Global mode has the same gap. With the same warm
GRADLE_USER_HOMEand an empty m2,scan -g --jsonsends a batch request with zeropkg:mavenpurls (cargo 233, npm 210, pypi 102, gem 17), so Gradle-cached global installs are never reported. The crawler itself can read Gradle's layout, though.scan --global-prefix ~/.gradle/caches/modules-2/files-2.1correctly yieldspkg:maven/org.apache.commons/commons-text@1.10.0,commons-configuration2@2.9.0,commons-lang3@3.12.0and the rest, 15 purls including parent/BOM poms. So this looks like a missing root, not a parser limitation, and that--global-prefixis a workaround for report-only scans.scan -g --mode hostedand--global-prefix … --mode hostedboth refuse correctly (exit 2, "global installs have no project lockfile to redirect").The new
docs/design/maven-vendoring.mdnow says "Maven discovery still uses the Maven local repository; a Gradle-only cache is not a Maven discovery source". So this may now count as an intended limitation. However, that sentence is in the vendoring design doc, and the user-facingscan/scan -goutput still shows nothing that tells a Gradle user their dependencies were never looked at. That's also true now that v5scandefaults to hosted mode. I'm leaving the triage call to a maintainer.
Generated by Claude Code
mikolalysenko commented
on Oct 2, 2026 CollaboratorAuthorMore actions[agent] Claiming this issue as part of the full Gradle support campaign (agent / hosted / vendored modes, tested on Gradle 6.9/7.6/8.x/9.x on Linux, macOS and Windows). Branch: feat/gradle-support. Claim-ID: 2026-10-02T13:56:32Z-gradle21
Generated by Claude Code
- added a commit that references this issue
on Oct 5, 2026 - added a commit that references this issue
on Oct 7, 2026
[agent] Found by the scheduled Gradle bug-hunt routine (ledger #319).
Summary
MavenCrawlertreatsbuild.gradle*/settings.gradle*as Java project markers, but then only crawls the Maven local repository ($MAVEN_REPO_LOCAL/$M2_HOME/repository/~/.m2/repository). Gradle never writes there. It resolves into$GRADLE_USER_HOME/caches/modules-2/files-2.1/<group>/<artifact>/<version>/<sha1>/. On a normal Gradle-only project,scan(agent),scan --mode hostedandscan --mode vendoredall return"status": "success", "scannedPackages": 0and never query the API. As a result:redirect_gradle_manual_snippet) can never fire unless~/.m2happens to hold the same GAV from unrelated Maven use;Repro
A logging mock on
--proxy-urlconfirms no/patch/batchrequest is ever sent. As a cross-check,scan --global-prefix ~/.gradle/caches/modules-2/files-2.1does findcommons-text@1.10.0andcommons-lang3@3.12.0by POM content. So the data is there; it's just not in the discovery roots. (Agentapplycouldn't use that root anyway:find_by_purlsexpects the Mavengroup/path/artifact/versionlayout, not Gradle's dotted group + per-file<sha1>directories.)Expected vs actual
build.gradle*/settings.gradle*gets a paste-ableexclusiveContent { … }snippet"), and the crawler deliberately accepts Gradle markers (maven_crawler.rs:580). Gradle-resolved dependencies should be discovered, or the scan should at least warn that the Gradle cache isn't supported, instead of reporting a clean success.Matrix (Linux; each run twice)
~/.gradleThe cache layout (
modules-2/files-2.1) has been the same since Gradle 1.x, so every major is affected. Tested on mainf6b7fb9(4.0.0).Suspect code
crates/socket-patch-core/src/crawlers/maven_crawler.rs:580-605: Gradle markers select onlym2_repo_path()(:709).crates/socket-patch-core/src/crawlers/maven_crawler.rsfind_by_purls: Maven layout only.