Skip to content

refactor: replace plexus-archiver with JDK jar tool, use maven-archiver for manifest - #341

Draft
gnodet wants to merge 1 commit into
apache:maven-source-plugin-4.xfrom
gnodet:feat/use-jar-tool
Draft

gnodet wants to merge 1 commit into
apache:maven-source-plugin-4.xfrom
gnodet:feat/use-jar-tool

Conversation

@gnodet

@gnodet gnodet commented Oct 19, 2026

Copy link
Copy Markdown

Summary

Migrates maven-source-plugin away from plexus-archiver and maven-archiver's createArchive() to use the JDK built-in jar tool for archive creation, while keeping maven-archiver for manifest generation only.

Changes

New classes

  • SourceFileCollector: walks source directories with Files.walkFileTree(), applies include/exclude glob patterns, handles default SCM excludes (replaces plexus DefaultFileSet).
  • SourceToolExecutor: invokes ToolProvider.findFirst("jar") via a staging directory approach. Supports --date for reproducible builds (JDK 19+). Uses MavenArchiver.parseBuildOutputTimestamp() for timestamp parsing.

Modified

  • AbstractSourceJarMojo: removed JarArchiver injection and all plexus archiver usage. New flow: collect files → build manifest with MavenArchiver.getManifest() → create JAR with SourceToolExecutor. Generates maven descriptor (pom.xml + pom.properties) inline.
  • pom.xml: removed plexus-archiver and plexus-utils dependencies, bumped maven-archiver to 4.0.0-beta-7-SNAPSHOT.

Deleted

  • Archivers.java: provided JarArchiver via DI — no longer needed.

Motivation

Depends on apache/maven-archiver#422 which strips plexus-archiver from maven-archiver itself. The sources JAR is structurally simpler than the JAR plugin (no MR-JAR, no JPMS module hierarchy, no classpath) so the JDK jar tool invocation is straightforward.

@gnodet
gnodet force-pushed the feat/use-jar-tool branch from 993a4fe to e31f0eb Compare October 19, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant