apache / apache/maven-jar-plugin

[idea] split the jar goal into two mojos that can be bound to different phases

Open
#586 6 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
92
Forks
84
Avg merge
19h 45m
Merged PRs (30d)
6

Description

### New feature, improvement proposal

Currently the jar goal mixes effectively two things:

1. Generation of descriptors (controlled by `addMavenDescriptor`) and a Manifest (with possibly customization like `manifestEntries` and `manifestFile`)
2. the actual packaging of things into a physical jar file (e.g `compress` option)

This has some limitations that surface at different levels:

- Tools like bnd / felix-bundle-plugin / Tycho can't intercept without special configurations
- There is no way to generate the metadata files to be used elsewhere (e.g. in an IDE - m2e uses reflection to only call the generation part of the mojo and not package a full jar) or further processed

If there where split into different mojos (e.g. one `generate` and one `jar` mojo) it would be possible to bind the first to the `prepare-package` and the later to the `package` phase allowing other plugins to further customize/use the data before it is being packed.

Since Maven 4 even allows interleaving phases this could then even be more flexible, e.g. another plugin that only needs the manifest data but not necessarily the full packaged physical jar could use this before the heavy weight jar packaging happens. It would also be a good time to do a major release with that change tailored to Maven 4.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by examining the current jar goal and how it handles descriptor and manifest generation alongside physical JAR packaging. Trace the existing lifecycle binding and options such as addMavenDescriptor, manifestEntries, manifestFile, and compress; done means defining separate generation and packaging mojos that can be bound to the proposed phases without losing these capabilities.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.