Multi-release jar file - Should the "Multi-Release" mainfest attribute have a specific value?
Alan.Bateman at oracle.com
Wed Jan 23 14:39:27 UTC 2019
On 23/01/2019 14:27, Jaikiran Pai wrote:
> The Multi-Release JarFile support JEP notes that the jar file is
> expected to contain a main attribute:
> Multi-Release: true
> The JarFile javadoc on the other hand makes no mention of the value
> for such an attribute and just mentions that the Multi-Release main
> attribute needs to be present:
> "A multi-release jar file is a jar file that contains a manifest with a
> main attribute named "Multi-Release",..."
> Which one of these 2 docs is expected to be the formal specification?
> I'm guessing it's the javadoc, in which case, is it intentional that the
> value for this attribute isn't mentioned or is it just a miss? My quick
> tests show that the implementation of this feature does indeed expect
> the value to be a "true" for it to consider the versioned entries in a
> multi-release jar.
The JAR file spec  is the specification. There's a lengthy section
defining MR JARs. The API docs are also specification, for the APIs that
provide access to JAR files, including MR JARs. So yes, you need the
"Multi-Release" attribute in the main section of the JAR file manifest
and it needs to have a value of "true" to enable. There is also a
JDK-specific property, documented in the JarFile docs, to override the
configuration where needed.
More information about the core-libs-dev