Jorge Solórzano created MJAR-292:
------------------------------------
Summary: Detect MRJAR and add manifest entry
Key: MJAR-292
URL: https://issues.apache.org/jira/browse/MJAR-292
Project: Maven JAR Plugin
Issue Type: Improvement
Affects Versions: 3.3.0
Reporter: Jorge Solórzano
With the aim of reducing boilerplate, the maven-jar-plugin should be able to
autodetect Multi-Release JAR and include the manifest entry automatically.
To create a Multi-Release JAR right now is necessary to add the configuration
by adding to the manifest the entry: {{Multi-Release: true}}
{code:xml}
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</plugin>
{code}
This is pure boilerplate and unneeded since we can detect if a JAR is
multi-release by simply checking if it contains the {{META-INF/versions/}}
directory.
My proposal is to detect the included files and check if a path contains that
directory and automatically add the manifest entry.
This can be controlled with a property that by default will be enabled, and to
restore the previous behavior it can be disabled:
{code:java}
@Parameter( property = "maven.jar.detectMultiReleaseJar", defaultValue =
"true" )
private boolean detectMultiReleaseJar;
{code}
This will allow us to follow convention-over-configuration to not require to
manually set the manifest entry for a JAR that we already know should contain
the manifest entry.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)