Skip to content

Maven patches can only be delivered as the main jar: hpi, aar, war and typed dependencies have no path #2202

Open

Description

[agent] Filed after a read-only review of the CLI source at 02add9be (main). Nothing was executed; the claims below come from reading the code.

Summary

A Maven patch can be delivered only as the main <artifactId>-<version>.jar. Artifacts whose users consume another file have no working path in hosted or vendored mode, and only a partial one in agent mode:

Artifact kind What users run Agent mode Hosted / vendored
Jenkins plugin (hpi/jpi) classes inside the .hpi, under WEB-INF/lib/<artifactId>.jar the companion <artifactId>-<version>.jar in the cache can be patched; the .hpi copy Jenkins loads is not addressed a dependency with <type>hpi</type> is refused; the served tree holds only .jar and .pom
Android library (aar) classes.jar inside the .aar, and the copy Gradle extracts into its transforms cache an .aar is treated as an opaque archive; the nested classes.jar and the extracted copy are not patched; a version directory that holds only an .aar is not discovered <type>aar</type> is refused, and Android Gradle builds are refused as a whole
war, or a dependency that declares <type>bundle</type> the typed file not checked here refused: the rewriter accepts only jar (and pom)

The refusals are warnings on a skipped dependency, so a project can look patched while the file that runs is unchanged. For Jenkins that means a patched compile class path and an unpatched running controller.

Where

  • Hosted Maven accepts a <type> only when it is jar: crates/socket-patch-core/src/patch/redirect/mod.rs (if typ != "jar"), and crates/socket-patch-core/src/formats/maven/mod.rs treats any other non-empty type as not redirectable.
  • No code path looks inside a nested archive for a class-level record (WEB-INF/lib/*.jar in an .hpi, classes.jar in an .aar); a search of crates/socket-patch-core/src finds no handling of either layout.
  • This is separate from Vendored JVM fetches upstream artifacts and checksums only from Maven Central, ignoring the build's mirrors and repositories #1069 (upstream files fetched only from Maven Central), which also affects these artifacts because most of them are published in other repositories.

What would close it

Any one of these, in order of size:

  1. State the limit and fail loudly: refuse a patch whose target is not a main jar with a named code, and say in the scan output that the runtime copy of a Jenkins plugin or an Android library is not covered.
  2. Carry the artifact's file extension from the patch record into the rewriter and the served tree, so a typed dependency whose file is in fact a jar (bundle) or a whole-file replacement (hpi, aar, war) can be redirected.
  3. Cover the nested copies: a record that names the nested jar member of an .hpi or the classes.jar of an .aar, and detection of Gradle's extracted copies.

Context: the patch service is starting to build patches for artifacts published outside Maven Central (Jenkins, XWiki, Google's Maven repository). Plain jars from those repositories are found and patched by coordinates today, whatever repository they came from; this issue is about the other packaging kinds.

Activity

  1. mikolalysenko commented on Dec 1, 2026

    @mikolalysenko
    Collaborator

    [agent] Looked at what this needs. Not started; the three options need a choice from the maintainers.

    Checked on main at 1b3f422: a dependency with a <type> other than jar or pom is a variant the main-jar pin does not reach (is_variant in formats/maven), the hosted rewriter skips it with redirect_maven_unsupported_packaging, and nothing in core reads a jar nested in an .hpi, .war or .aar.

    • Option 1 (state the limit, loudly) is CLI only. It is mostly a reporting change: say in the scan output, and in VEX, that the file the application runs (the .hpi a Jenkins controller loads, the classes.jar inside an .aar) is not covered, instead of a warning on a skipped dependency. I can do this one; it touches the redirect code that Patch gems locked as platform gems in hosted and vendored mode: patched builds where they exist, upstream's gem elsewhere #2273 changes heavily, so after that lands.
    • Options 2 and 3 (serve the typed file, patch nested copies) need a matching change in Socket's backend: a patched build of the typed artifact, or records that name the nested member.

    The multi-release half of #2199 (other loadable copies of a patched class) is being worked on separately; nested jars and shaded copies are documented there as not detected.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions