Uploaded image for project: 'Maven JAR Plugin'
  1. Maven JAR Plugin
  2. MJAR-292

Detect MRJAR and add manifest entry

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.3.0
    • 3.4.0
    • None
    • None

    Description

      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

              <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>
      

      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:

          @Parameter( property = "maven.jar.detectMultiReleaseJar", defaultValue = "true" )
          private boolean detectMultiReleaseJar;
      

      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.

      Attachments

        Issue Links

          Activity

            People

              sjaranowski Slawomir Jaranowski
              jorsol Jorge Solórzano
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: