Apache Software Foundation / Maven JAR Plugin
Merged upstreamCorrectnessMerged Jul 2, 2026

Respect addBuildEnvironmentEntries for Build-Jdk-Spec

Fixed Apache Maven JAR Plugin manifest generation so Build-Jdk-Spec follows addBuildEnvironmentEntries and can be omitted for reproducible builds.

apache/maven-jar-plugin · #544

Problem

Projects could disable build environment manifest entries, but Build-Jdk-Spec still appeared in generated JAR manifests. That leaked environment-dependent JDK metadata and violated reproducible-build expectations for projects that intentionally disabled those entries.

Approach

Passed archive.manifest.addBuildEnvironmentEntries through to Maven Archiver's Build-Jdk-Spec default-entry switch and added an integration fixture that verifies environment manifest entries are absent while normal entries remain intact.

Impact and scope

  • Improves Maven JAR reproducibility by honoring the existing opt-out switch for environment-derived manifest metadata.
  • Keeps Main-Class and normal manifest behavior unchanged while suppressing volatile build-environment entries.
  • Adds coverage for modular Java JAR generation so the behavior is protected in plugin integration tests.

Validation

  • Added MJAR-539 integration test project and Groovy verifier for manifest contents.
  • Verified the targeted invoker test, mvn verify, and the full Maven JAR Plugin integration-test profile.
  • PR was accepted into the Maven JAR Plugin 4.0.0-beta-2 milestone.