Migrate maven-war-plugin to Maven 4 native plugin API#635
Closed
gnodet wants to merge 1 commit into
Closed
Conversation
Migrate all source code (src/main/java) and unit tests (src/test/java) from Maven 3 API to Maven 4 native plugin API. Key changes: Source code: - Replace Maven 3 Mojo/AbstractMojo with Maven 4 @mojo annotations - Use Maven 4 Session for dependency resolution instead of project.getArtifacts() - Replace MavenProject with Maven 4 Project API - Use Maven 4 Artifact/DownloadedArtifact instead of Maven 3 Artifact - Replace MojoExecutionException with MojoException - Replace Maven 3 Resource with maven-filtering Resource Tests: - Convert all test classes to use @MojoTest/@InjectMojo annotations - Create MockSessionHelper utility to bridge Maven 4 session-based dependency resolution in tests - Update test stubs to extend Maven 4 ProjectStub/ArtifactStub - Fix filename mapping interpolation patterns for Maven 4 (@{ } vs @{ }@) - Update test assertions for Maven 4 artifact extension behavior - Mock resolveDependencies for Servlet 3.0 detection test All 64 unit tests pass. Integration tests are not modified. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Migrate maven-war-plugin from Maven 3.x API to Maven 4.x native plugin API, following the same pattern used by maven-jar-plugin, maven-resources-plugin, and maven-compiler-plugin.
Key changes
extends AbstractMojo→implements Mojo,@Injectfield injection, simplified@Mojoannotations, unifiedMojoExceptionorg.apache.maven.plugins.annotations.*→org.apache.maven.api.di.Inject+org.apache.maven.api.plugin.annotations.*MavenProject→Project,MavenSession→Session,MavenProjectHelper→ProjectManagero.a.m.artifact.Artifact→o.a.m.api.Artifact/DownloadedArtifact,getFile()→getPath()o.a.m.archiver→o.a.m.shared.archiver,Resourcefrom maven-filteringproject.getCompileClasspathElements()→session.resolveDependencies(project, PathScope.MAIN_COMPILE)Reference plugins
Build verification
mvn clean install -Bpasses with 64 unit tests, 0 failures. Integration tests (src/it/) were not modified.Test plan
mvn clean install -Bpasses (compilation + 64 unit tests)mvn verify -Prun-its(requires Maven 4 runtime)🤖 Generated with Claude Code