Repository navigation
Remove unused MavenSession injection to fix deprecated @Component warning in ReproducibleCentralReport - #261
Merged
Conversation
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]>
There was a problem hiding this comment.
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.
slawekjaranowski
approved these changes
Sep 28, 2026
|
@elharo Please assign appropriate label to PR according to the type of change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ReproducibleCentralReporttriggers a javac deprecation warning:org.apache.maven.plugins.annotations.Componentwas deprecated in maven-plugin-annotations 3.15.2 with the message:The project builds against
maven-plugin-annotations3.16.0 (inherited fromapache:40), which is where the warning now shows up.Why remove the field rather than switch to
@InjectThe
MavenSessionfield 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
@Componenttojavax.inject.Inject(the JSR 330 replacement, already used byDescribeBuildOutputMojo,CheckBuildPlanMojoandRangesUtilin this plugin), the field is dropped entirely, along with the now-unusedMavenSessionimport. Nothing in the report depends on the session, and the report's dependency resolution is already declared byrequiresDependencyResolution = ResolutionScope.RUNTIMEon the@Mojoannotation.Effects
META-INF/maven/plugin.xmlno longer contains a<requirement>fororg.apache.maven.execution.MavenSession.maven-plugin-pluginwarning loses one field:The three remaining fields (
container,siteRenderer,siteTool) are declared with@ComponentinsideAbstractMavenReportinmaven-reporting-impl, so they are inherited rather than defined here.maven-reporting-impl:4.0.0is 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; onmasterthe 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:
mvn artifact:reproducible-centralmvn site -DgenerateReports=truewith the report declared insrc/site/site.xml→Detected 1 report for maven-artifact-plugin: reproducible-central,Generating "Reproducible Central" report, BUILD SUCCESSBoth render the project badge, the per-scope dependency badge groups (e.g.
compile,runtime) and the Reproducible Builds footnote, i.e. output is unchanged.