apache / apache/maven-archiver

add support for JDK toolchains

Open
#327 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
13
Forks
26
Avg merge
1d 1h
Merged PRs (30d)
7

Description

### New feature, improvement proposal

Maven Archiver defines `META-INF/MANIFEST.MF` entries:
- `Build-Jdk-Spec`
- `Build-Jdk`

they are taken from Maven runtime: when a JDK toochain is used, we need clarity between JDK/JRE running Maven (the build tool) vs JDK for compiling (running the compiler)

`Build-Jdk`and `Build-Jdk-Spec` in spirit are more about he compiler than Maven runtime

`Build-Tool-Jdk-Spec` (or `Jre`?) should give the Java version used by Maven build tool runtime, at least when toolchains is used, perhaps also when toolchains are not used, just to start giving good habits of not always considering they are the same
And perhaps do the equivalent for `Build-Tool-Jdk`

### Existing solution in Maven Jar Plugin

this has been partially done in Maven Jar Plugin 3.4.0 MJAR-62:
- adding `Build-Tool-Jdk-Spec` with runtime value = https://github.com/apache/maven-jar-plugin/pull/73,
- overriding `Build-Jdk-Spec` with the value from the toolchain
- disabling default manifest entries (which disables `Java-Version` added in #298)
- ignoring `Build-Jdk`: in case of toolchains usage, `Build-Jdk` gives full java version from Maven runtime, while `Build-Jdk-Spec` gives spec of toolchain

this algorithm would be better implemented in Maven Archiver, with the plugin just configuring the toolchain to Maven Archiver: then Maven Archiver can use the toolchain

this would probably also be a good first step to injecting later the toolchain to Plexus Module Archiver that seems to be necessary given failure described in https://github.com/apache/maven-jar-plugin/issues/439

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading Maven Archiver's manifest-entry handling and the Maven Jar Plugin 3.4.0 implementation from MJAR-62, including pull request 73. Compare how toolchain and Maven runtime versions are selected. Done means Maven Archiver can receive and use the toolchain while distinguishing compiler JDK entries from build-tool JDK entries, with the relevant behavior covered by tests.

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
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.