gnodet opened a new pull request, #566: URL: https://github.com/apache/maven-jar-plugin/pull/566
## Summary - Integrate the Maven 4 BuildContext API to skip JAR creation when no input files have changed since the last build - When `forceCreation` is false and the JAR file already exists, the plugin registers and scans the classes directory via `BuildContext.registerAndProcessInputs()` and skips re-packaging if all inputs are `UNMODIFIED` - Signals `markSkipExecution()` at all skip points (`skipIfEmpty`, unchanged inputs) so downstream mojos can react accordingly ## Details This is an experimental branch that depends on: - https://github.com/apache/maven/pull/12576 (Maven 4 BuildContext API — `4.1.0-SNAPSHOT`) ### Changes - **`AbstractJarMojo.java`**: Added `@Inject BuildContext buildContext` field, `hasChangedInputs()` method that uses `registerAndProcessInputs()` to detect file changes, and `attachArtifact()` helper. The `execute()` method now checks for changed inputs before creating the JAR. - **`TestJarMojo.java`**: Added `markSkipExecution()` in the skip branch - **`JarMojoTest.java`**: Updated test imports to new `org.apache.maven.testing.plugin` package, added `@Provides` methods for `BuildContext` and `PathMatcherFactory` - **`pom.xml`**: Bumped `mavenVersion` to `4.1.0-SNAPSHOT` ## Test plan - [x] All existing tests pass (1/1) - [ ] Integration testing with a multi-module project to verify JAR skipping 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
