Skip to content

Add listLibrariesMissingMetadata task/goal for Gradle and Maven#877

Merged
jormundur00 merged 15 commits into
masterfrom
jormundur00/gh-871
Apr 22, 2026
Merged

Add listLibrariesMissingMetadata task/goal for Gradle and Maven#877
jormundur00 merged 15 commits into
masterfrom
jormundur00/gh-871

Conversation

@jormundur00

@jormundur00 jormundur00 commented Apr 22, 2026

Copy link
Copy Markdown
Member

Summary

This PR adds the listLibrariesMissingMetadata Gradle task and the native:list-libraries-missing-metadata Maven goal. They scan a project's direct external runtime dependencies, classify each as supported or missing against the configured GraalVM reachability metadata repository, look up existing GitHub issues for the missing ones, and either print a prefilled issue link per library or (with createIssues=true) file the issues directly. Implements #871.

What Changed

New commands

  • Gradle task listLibrariesMissingMetadata, registered in NativeImagePlugin and wired against the runtime classpath.
  • Maven goal native:list-libraries-missing-metadata (requiresDependencyResolution=RUNTIME).
  • Opt-in createIssues=true parameter on both that switches from "print prefilled link" to "file the issue via the GitHub API".
  • Both commands always re-run (Gradle task uses upToDateWhen(false); Maven goal has no caching anyway).

Detection

  • Shared MissingMetadataCommandSupport in common/graalvm-reachability-metadata is the single source of truth for classification; both plugins feed it DependencyCoordinates and consume a Report.
  • A library is "missing" when the configured metadata repository returns no configurations for group:artifact:version, with the existing useLatestConfigWhenVersionIsUntested behavior preserved.
  • Excluded modules from the metadata-repo extension are honored on both sides.
  • Gradle selection: first-level ResolvedDependencyResults on the runtime classpath whose component is a ModuleComponentIdentifier (project components and unresolved entries are filtered out).
  • Maven selection: artifacts with dependencyTrail.size() == 2 and scope compile / runtime / null.

GitHub integration

  • Existing issues are looked up via the GitHub Search API filtered by repo:, is:issue is:open, label:library-new-request, and the groupId:artifactId substring; the result is matched by re-extracting coordinates from the issue title and body.
  • Token resolution order is now: explicit (-PgithubToken=... / -DgithubToken=...) → GITHUB_TOKENGH_TOKENgh auth token (5-second subprocess; non-zero exit treated as no token).
  • Default issue target repository is oracle/graalvm-reachability-metadata (was a personal fork).
  • In default list mode, GitHub lookup failures (rate-limit, network, auth) emit a single throttled warning via the build tool's logger rather than silently producing false negatives. With createIssues=true the failure is fatal.
  • The "missing token" validation error names the right argument per build tool (-PgithubToken=... for Gradle, -DgithubToken=... for Maven) and mentions all four token sources.

Console output

  • Results are grouped by status: Already requested (existing open issues), Requested support for N libraries (when createIssues=true succeeded), and Or request support manually (the remaining ones). Errors get their own block at the bottom.
  • A prominent call-to-action above the manual list shows the exact createIssues=true re-run command tailored to the build tool, plus the token-resolution order on the next line.
  • Prefilled issue URLs collapse to numbered footnotes ([1], [E1], [C1]) so library names line up vertically instead of drowning in 200-character URLs.
  • Prefilled issue links keep colons readable in the title= value and populate the issue form's maven_coordinates field so GitHub can auto-fill the request.
  • All-supported runs collapse to a single sentence.
  • A Full report: <path> footer points the user at the JSON report.

JSON report

  • Stable schema matching the spec: command, mode, targetRepository, metadataRepositoryUri, scannedAt, project, summary, results[]. Per-result fields: coordinates, scope, status, plus issueStatus / issueUrl / issueNumber for missing entries and error for errors.
  • Added versioned schema schemas/list-libraries-missing-metadata-schema-v1.0.0.json; generated reports now include a $schema field pointing to it.
  • Default report file: build/reports/native/list-libraries-missing-metadata.json (Gradle), ${project.build.directory}/native/list-libraries-missing-metadata.json (Maven).

Configuration & wiring

  • Gradle properties accepted by the task: createIssues, githubToken, targetRepository, githubApiUrl, reportFile (the last one is now actually wired up).
  • Maven @Parameters with the same property names.
  • getRootComponent() on the Gradle task is @Internal (paired with upToDateWhen(false)) for configuration-cache compatibility.

Tests

  • MissingMetadataCommandSupportTest (shared) covers issue-title-and-body coordinate parsing, supported-vs-missing classification with prefilled-link generation, existing-issue reuse with group:artifact-level dedup (verified via an in-process HttpServer), token-resolution priority, the GitHub-CLI fallback, and the per-build-tool "missing token" error message. Tests of the new console layout assert on the headline, the call-to-action command, the token-resolution line, footnote indices, the prefilled issue-form URL, and the $schema report field.
  • ListLibrariesMissingMetadataTest (Gradle) covers the dependency-selection contract: only direct external module dependencies survive, project components and unresolved entries are filtered, transitive children are not walked.
  • ListLibrariesMissingMetadataMojoTest (Maven) covers isDirectRuntimeDependency across scope (compile/runtime/null/test/provided) and trail length (1/2/3/null).
  • All of the above run as plain unit/Spock tests with no GitHub access required.
  • An early-stage attempt at plugin-level functional tests was removed during iteration on this branch because it depended on specific libraries remaining unsupported in the live metadata repository; the unit/Spock coverage above replaces it.

Documentation

  • gradle-plugin.adoc and maven-plugin.adoc get a "Checking Missing Metadata Support" reference section, including default usage, the createIssues=true opt-in, the report file location, the override properties, and the four-step token-resolution order.
  • The end-to-end Gradle and Maven guides mention the command as the first troubleshooting step before tracing-agent workflows.
  • The top-level docs intro carries a [TIP] callout pointing at the command.

Console output examples

Default mode (Gradle), all libraries missing, no existing requests

Missing metadata libraries: 3 of 3 scanned.

To request support for all 3 libraries automatically, re-run with createIssues=true:

    ./gradlew listLibrariesMissingMetadata -PcreateIssues=true -PgithubToken=<token>

  Token sources tried in order:
    -PgithubToken=...  ->  $GITHUB_TOKEN  ->  $GH_TOKEN  ->  `gh auth token`

Or request support manually, one library at a time:
  - commons-io:commons-io:2.16.1             -> request support [1]
  - org.apache.commons:commons-lang3:3.14.0  -> request support [2]
  - org.jsoup:jsoup:1.18.3                   -> request support [3]

  [1] https://github.com/oracle/graalvm-reachability-metadata/issues/new?template=01_support_new_library.yml&title=Support+for+commons-io:commons-io:2.16.1
  [2] https://github.com/oracle/graalvm-reachability-metadata/issues/new?template=01_support_new_library.yml&title=Support+for+org.apache.commons:commons-lang3:3.14.0
  [3] https://github.com/oracle/graalvm-reachability-metadata/issues/new?template=01_support_new_library.yml&title=Support+for+org.jsoup:jsoup:1.18.3

Full report: build/reports/native/list-libraries-missing-metadata.json

Default mode (Maven)

Same shape; the call-to-action becomes:

To request support for all 3 libraries automatically, re-run with createIssues=true:

    ./mvnw native:list-libraries-missing-metadata -DcreateIssues=true -DgithubToken=<token>

  Token sources tried in order:
    -DgithubToken=...  ->  $GITHUB_TOKEN  ->  $GH_TOKEN  ->  `gh auth token`

Mixed: some already requested, some still need support

Missing metadata libraries: 3 of 5 scanned (1 already requested).

Already requested (no action needed):
  - org.example:lib-x:1.0.0  -> existing request [E1]

To request support for the remaining 2 libraries automatically, re-run with createIssues=true:

    ./gradlew listLibrariesMissingMetadata -PcreateIssues=true -PgithubToken=<token>

  Token sources tried in order:
    -PgithubToken=...  ->  $GITHUB_TOKEN  ->  $GH_TOKEN  ->  `gh auth token`

Or request support manually, one library at a time:
  - com.acme:client:2.3.4   -> request support [1]
  - org.jsoup:jsoup:1.18.3  -> request support [2]

  [E1] https://github.com/oracle/graalvm-reachability-metadata/issues/4123
  [1]  https://github.com/oracle/graalvm-reachability-metadata/issues/new?template=01_support_new_library.yml&title=Support+for+com.acme:client:2.3.4
  [2]  https://github.com/oracle/graalvm-reachability-metadata/issues/new?template=01_support_new_library.yml&title=Support+for+org.jsoup:jsoup:1.18.3

Full report: build/reports/native/list-libraries-missing-metadata.json

After createIssues=true succeeds

Missing metadata libraries: 3 of 3 scanned.

Requested support for 3 libraries:
  - commons-io:commons-io:2.16.1             -> request created [C1]
  - org.apache.commons:commons-lang3:3.14.0  -> request created [C2]
  - org.jsoup:jsoup:1.18.3                   -> request created [C3]

  [C1] https://github.com/oracle/graalvm-reachability-metadata/issues/4201
  [C2] https://github.com/oracle/graalvm-reachability-metadata/issues/4202
  [C3] https://github.com/oracle/graalvm-reachability-metadata/issues/4203

Full report: build/reports/native/list-libraries-missing-metadata.json

All direct dependencies supported

All 6 direct dependencies are supported by the reachability metadata repository.

Full report: build/reports/native/list-libraries-missing-metadata.json

Verification

  • Pushed this branch to origin as jormundur00/gh-871.
  • Ran the affected modules' tests under JDK 17: :graalvm-reachability-metadata:test, :native-gradle-plugin:test, :native-maven-plugin:test — all pass, including the new dependency-selection unit tests and the updated console-rendering assertions.

Fixes: #871

@jormundur00 jormundur00 added the enhancement New feature or request label Apr 22, 2026
@jormundur00 jormundur00 self-assigned this Apr 22, 2026
@jormundur00 jormundur00 requested a review from vjovanov April 22, 2026 08:35
@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Apr 22, 2026
@vjovanov vjovanov changed the title Add listMissingMetadataLibs support for Gradle and Maven Add listLibrariesMissingMetadata support for Gradle and Maven Apr 22, 2026
vjovanov and others added 3 commits April 22, 2026 11:26
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- ListLibrariesMissingMetadataTest covers the Gradle path: only direct
  external module dependencies survive, project components and
  unresolved entries are filtered, transitive children are not walked.
- ListLibrariesMissingMetadataMojoTest covers the Maven path:
  isDirectRuntimeDependency accepts compile/runtime/null scope at
  trail length 2, rejects test/provided, transitive trails, missing
  trail, and project-only trails.

Both tests run as plain Spock unit tests and require no GitHub access,
so they cover the dependency-selection contract without the brittle
live-metadata-repo dependency that the earlier functional tests had.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ssues=true

The old output interleaved each missing library's coordinates with a
long, heavily URL-encoded prefilled issue link, then trailed a dense
seven-counter summary line. The call-to-action for filing issues
automatically (createIssues=true) was only reachable by reading the
docs.

The new rendering:
- Groups results by status: "Already requested" (existing open
  issues), "Requested support for N libraries" (when createIssues
  succeeded), and a manual "Or request support manually" section
  for the remaining ones. Errors get their own block at the end.
- Places a prominent call-to-action above the manual list that
  shows the exact re-run command tailored to the build tool
  (`-PcreateIssues=true` / `-DcreateIssues=true`) and the token
  resolution order on the next line.
- Collapses prefilled issue URLs into numbered footnotes ([1],
  [E1], [C1]) so library names line up vertically instead of
  drowning in 200-character URLs.
- Trims `&maven_coordinates=...` from the prefilled URL (the title
  already carries the GAV) and keeps colons readable in the title
  query value.
- Appends `Full report: <path>` as a one-line footer when the
  plugins pass in the report-file path via the new
  renderConsoleOutput(reportFilePath) overload.
- For all-supported runs, collapses to a single sentence.

Tests in MissingMetadataCommandSupportTest are updated to assert on
the new grouped output (headline, CTA, token sources, footnote
indices) and on the trimmed prefilled URL shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vjovanov vjovanov changed the title Add listLibrariesMissingMetadata support for Gradle and Maven Add listLibrariesMissingMetadata task/goal for Gradle and Maven Apr 22, 2026
vjovanov
vjovanov previously approved these changes Apr 22, 2026
vjovanov
vjovanov previously approved these changes Apr 22, 2026
@jormundur00 jormundur00 merged commit 95512d0 into master Apr 22, 2026
48 checks passed
@jormundur00 jormundur00 deleted the jormundur00/gh-871 branch April 22, 2026 11:39
mergify Bot added a commit to robfrank/linklift that referenced this pull request May 3, 2026
…1.5 to 1.1.0 [skip ci]

Bumps [org.graalvm.buildtools:native-maven-plugin](https://github.com/graalvm/native-build-tools) from 0.11.5 to 1.1.0.
Release notes

*Sourced from [org.graalvm.buildtools:native-maven-plugin's releases](https://github.com/graalvm/native-build-tools/releases).*

> 1.1.0
> -----
>
> What's Changed
> --------------
>
> * Release 1.0.0 by [`@​graalvmbot`](https://github.com/graalvmbot) in [graalvm/native-build-tools#857](https://redirect.github.com/graalvm/native-build-tools/pull/857)
> * Bump version to 1.0.1-SNAPSHOT by [`@​graalvmbot`](https://github.com/graalvmbot) in [graalvm/native-build-tools#858](https://redirect.github.com/graalvm/native-build-tools/pull/858)
> * Use a safer way to create the temporary access filter file by [`@​sschuberth`](https://github.com/sschuberth) in [graalvm/native-build-tools#852](https://redirect.github.com/graalvm/native-build-tools/pull/852)
> * Bump io.netty:netty-codec-http from 4.1.129.Final to 4.1.132.Final in /samples/metadata-repo-integration by [`@​dependabot`](https://github.com/dependabot)[bot] in [graalvm/native-build-tools#859](https://redirect.github.com/graalvm/native-build-tools/pull/859)
> * Add class introduced in 5.14.1/6.0.1 by [`@​marcphilipp`](https://github.com/marcphilipp) in [graalvm/native-build-tools#794](https://redirect.github.com/graalvm/native-build-tools/pull/794)
> * Reduce CI usage by running CI only on "pull\_request" and running only the latest gradle version (except when creating a new release) by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#861](https://redirect.github.com/graalvm/native-build-tools/pull/861)
> * Update latest docs symlink and improve 1.0.0 release notes by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#866](https://redirect.github.com/graalvm/native-build-tools/pull/866)
> * Fix early classpath resolution in GenerateDynamicAccessMetadata by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#868](https://redirect.github.com/graalvm/native-build-tools/pull/868)
> * Bump reachability metadata version to 1.0.0 by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#879](https://redirect.github.com/graalvm/native-build-tools/pull/879)
> * Add listLibrariesMissingMetadata task/goal for Gradle and Maven by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#877](https://redirect.github.com/graalvm/native-build-tools/pull/877)
>
> **Full Changelog**: <graalvm/native-build-tools@1.0.0...1.1.0>
>
> 1.0.0
> -----
>
> Breaking Changes
> ----------------
>
> * Native Build Tools 1.0.0 moves to the `1.0-M1` release of the reachability metadata repository, which uses the new `reachability-metadata.json` metadata format and no longer uses the global `metadata/index.json`.
> * This may require dependency and metadata updates in downstream projects; some stacks can regress until they adapt.
>
> What's Changed
> --------------
>
> * Fix broken JavaApplicationFunctionalTest due to using a removed feature by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#850](https://redirect.github.com/graalvm/native-build-tools/pull/850)
> * Remove the usage of the global metadata/index.json from the nbt plugins by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#829](https://redirect.github.com/graalvm/native-build-tools/pull/829)
> * Add reachability-metadata-schema cross-validation by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#840](https://redirect.github.com/graalvm/native-build-tools/pull/840)
> * Merge 1.0-M1 branch to master by [`@​jormundur00`](https://github.com/jormundur00) in [graalvm/native-build-tools#848](https://redirect.github.com/graalvm/native-build-tools/pull/848)
>
> **Full Changelog**: <graalvm/native-build-tools@0.11.5...1.0.0>


Commits

* [`84cc046`](graalvm/native-build-tools@84cc046) Release 1.1.0
* [`95512d0`](graalvm/native-build-tools@95512d0) Add listLibrariesMissingMetadata task/goal for Gradle and Maven ([#877](https://redirect.github.com/graalvm/native-build-tools/issues/877))
* [`0dcda78`](graalvm/native-build-tools@0dcda78) Merge pull request [#879](https://redirect.github.com/graalvm/native-build-tools/issues/879) from jormundur00/bump-metadata-repository-1.0.0
* [`e5b90f0`](graalvm/native-build-tools@e5b90f0) Bump reachability metadata version to 1.0.0
* [`05f45d3`](graalvm/native-build-tools@05f45d3) Fix early classpath resolution in GenerateDynamicAccessMetadata ([#868](https://redirect.github.com/graalvm/native-build-tools/issues/868))
* [`4d614c7`](graalvm/native-build-tools@4d614c7) Update latest docs symlink and improve 1.0.0 release notes ([#866](https://redirect.github.com/graalvm/native-build-tools/issues/866))
* [`ee1351d`](graalvm/native-build-tools@ee1351d) Reduce CI usage by running CI only on "pull\_request" and running only the lat...
* [`c6f3674`](graalvm/native-build-tools@c6f3674) Add class introduced in 5.14.1/6.0.1 ([#794](https://redirect.github.com/graalvm/native-build-tools/issues/794))
* [`5bc69bd`](graalvm/native-build-tools@5bc69bd) Bump io.netty:netty-codec-http from 4.1.129.Final to 4.1.132.Final in /sample...
* [`395f3b2`](graalvm/native-build-tools@395f3b2) Use a safer way to create the temporary access filter file ([#852](https://redirect.github.com/graalvm/native-build-tools/issues/852))
* Additional commits viewable in [compare view](graalvm/native-build-tools@0.11.5...1.1.0)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=org.graalvm.buildtools:native-maven-plugin&package-manager=maven&previous-version=0.11.5&new-version=1.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

listLibrariesMissingMetadata as the First-Step Support Check

2 participants