Skip to content

Remove unused MavenSession injection to fix deprecated @Component warning in ReproducibleCentralReport - #261

Merged
elharo merged 1 commit into
masterfrom
fix-reproducible-central-deprecated-component
Sep 28, 2026
Merged

elharo merged 1 commit into
masterfrom
fix-reproducible-central-deprecated-component

Conversation

@elharo

@elharo elharo commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

What

ReproducibleCentralReport triggers a javac deprecation warning:

[WARNING] .../ReproducibleCentralReport.java:[30,44] org.apache.maven.plugins.annotations.Component
          in org.apache.maven.plugins.annotations has been deprecated
[WARNING] .../ReproducibleCentralReport.java:[55,6]  org.apache.maven.plugins.annotations.Component
          in org.apache.maven.plugins.annotations has been deprecated

org.apache.maven.plugins.annotations.Component was deprecated in maven-plugin-annotations 3.15.2 with the message:

Use JSR 330 annotations or Parameter with according default expressions instead.

The project builds against maven-plugin-annotations 3.16.0 (inherited from apache:40), which is where the warning now shows up.

Why remove the field rather than switch to @Inject

The MavenSession field is never read anywhere in the report — it has been dead since the report was added in b82943b (MARTIFACT-81). It only serves to have Plexus inject a component that is then thrown away.

So rather than rewriting @Component to javax.inject.Inject (the JSR 330 replacement, already used by DescribeBuildOutputMojo, CheckBuildPlanMojo and RangesUtil in this plugin), the field is dropped entirely, along with the now-unused MavenSession import. Nothing in the report depends on the session, and the report's dependency resolution is already declared by requiresDependencyResolution = ResolutionScope.RUNTIME on the @Mojo annotation.

Effects

  • The two javac deprecation warnings are gone.
  • META-INF/maven/plugin.xml no longer contains a <requirement> for org.apache.maven.execution.MavenSession.
  • The related maven-plugin-plugin warning loses one field:
- Mojo reproducible-central uses Plexus Component requirements (@Component annotation) for fields: [container, session, siteRenderer, siteTool]
+ Mojo reproducible-central uses Plexus Component requirements (@Component annotation) for fields: [container, siteRenderer, siteTool]

The three remaining fields (container, siteRenderer, siteTool) are declared with @Component inside AbstractMavenReport in maven-reporting-impl, so they are inherited rather than defined here. maven-reporting-impl:4.0.0 is already the latest release, so clearing those would be an upstream change and is out of scope here. That is why this PR fixes the javac warning but the plugin-level advisory remains.

Verification

  • mvn clean compile -Dmaven.compiler.showDeprecation=true — no deprecation warnings; on master the two warnings above are reported.

  • mvn clean verify -DskipITs — BUILD SUCCESS, 0 Checkstyle violations, Spotless clean, 2/2 unit tests pass.

  • Smoke-tested the report end-to-end against a throwaway project with both paths:

    • standalone goal mvn artifact:reproducible-central
    • via the site lifecycle, mvn site -DgenerateReports=true with the report declared in src/site/site.xml → Detected 1 report for maven-artifact-plugin: reproducible-central, Generating "Reproducible Central" report, BUILD SUCCESS

    Both render the project badge, the per-scope dependency badge groups (e.g. compile, runtime) and the Reproducible Builds footnote, i.e. output is unchanged.

org.apache.maven.plugins.annotations.Component is deprecated since
maven-plugin-annotations 3.15: "Use JSR 330 annotations or Parameter with
according default expressions instead."

The @Component-annotated MavenSession field in ReproducibleCentralReport has
never been read by the report, so rather than swapping it for javax.inject.Inject
this drops the field altogether, which also removes the corresponding
<requirement> from the generated plugin descriptor.

Co-Authored-By: opencode <[email protected]>
@elharo
elharo requested review from hboutemy and a lite review from Copilot September 26, 2026 13:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Removes unused MavenSession injection from ReproducibleCentralReport, eliminating deprecated @Component warnings without changing report behavior.

Changes:

  • Removed the unused field, annotation, and imports.
  • Preserved runtime dependency resolution configuration.
File Description
src/​main/​java/​org/​apache/​maven/​plugins/​artifact/​buildinfo/​ReproducibleCentralReport.java Removes unused Maven session injection.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@elharo
elharo merged commit adb256b into master Sep 28, 2026
23 checks passed
@elharo
elharo deleted the fix-reproducible-central-deprecated-component branch September 28, 2026 17:52
@github-actions github-actions Bot added this to the 3.7.0 milestone Sep 28, 2026
@github-actions

Copy link
Copy Markdown

@elharo Please assign appropriate label to PR according to the type of change.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants