Maven JAR Plugin
  1. Maven JAR Plugin
  2. MJAR-42

Add LICENCE and NOTICE files to the jar

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      1

      Description

      Patch attached that adds project LICENSE and NOTICE files into the output jar. By default it will add LICENSE.txt and NOTICE.txt files from the project's basedir (if they are present) into the META-INF directory of the jar.

        Issue Links

          Activity

          Hide
          Jeremy Boynes added a comment -

          This patch provides a simple mechanism for adding the license files until the more flexible approach described in MJAR-10 can be implemented.

          Show
          Jeremy Boynes added a comment - This patch provides a simple mechanism for adding the license files until the more flexible approach described in MJAR-10 can be implemented.
          Hide
          Brett Porter added a comment -
          • default values should be given with default-value instead of an initialising value (the basedir won't be correctly aligned otherwise)
          • this technique won't work especially well with multiple modules projects
          • I'm not sure we want the Apache-specific NOTICE file in here. Perhaps it should be a part of the license specification.

          Isn't a better workaround just to use the <resources> mechanism for this?

          Show
          Brett Porter added a comment - default values should be given with default-value instead of an initialising value (the basedir won't be correctly aligned otherwise) this technique won't work especially well with multiple modules projects I'm not sure we want the Apache-specific NOTICE file in here. Perhaps it should be a part of the license specification. Isn't a better workaround just to use the <resources> mechanism for this?
          Hide
          Mike Perham added a comment -

          The license and notice files in the root of a project isn't a Maven standard (is it?) and plus I don't think it's a great idea anyways as it becomes repetitive in systems with large numbers of modules, all under the same license.

          I think a better idea is to add an element to the MANIFEST.MF with the value(s) of project.licenses.license:

          License-1-Name: Apache License, 2.0
          License-1-Url: http://apache.org/APL-2.0.txt
          License-2-Name: GNU Lesser General Public License, 1.1
          License-2-Url: http://gnu.org/LGPL-1.1.txt

          This way all modules can inherit their licenses via parent and have the manifest populated automatically.

          Show
          Mike Perham added a comment - The license and notice files in the root of a project isn't a Maven standard (is it?) and plus I don't think it's a great idea anyways as it becomes repetitive in systems with large numbers of modules, all under the same license. I think a better idea is to add an element to the MANIFEST.MF with the value(s) of project.licenses.license: License-1-Name: Apache License, 2.0 License-1-Url: http://apache.org/APL-2.0.txt License-2-Name: GNU Lesser General Public License, 1.1 License-2-Url: http://gnu.org/LGPL-1.1.txt This way all modules can inherit their licenses via parent and have the manifest populated automatically.
          Hide
          Jochen Wiedmann added a comment -

          I'd like to recall that Maven is an Apache project. In other words, if there is something like "Apache-specific", then the "Maven standard" should at least make it possible to follow.

          Additionally, I'd like to point out a problem with Bretts suggestion to use the <resource> mechanism: If I do specify a resource, which lives in the base directory, then I'll encounter problems while building a source jar: The maven-source-plugin will include my whole project into the jar file. (This may be a bug in the maven-source-plugin, I am unsure what to think of it.)

          Show
          Jochen Wiedmann added a comment - I'd like to recall that Maven is an Apache project. In other words, if there is something like "Apache-specific", then the "Maven standard" should at least make it possible to follow. Additionally, I'd like to point out a problem with Bretts suggestion to use the <resource> mechanism: If I do specify a resource, which lives in the base directory, then I'll encounter problems while building a source jar: The maven-source-plugin will include my whole project into the jar file. (This may be a bug in the maven-source-plugin, I am unsure what to think of it.)
          Hide
          Olivier Lamy added a comment -

          This is now dealt with by the remote resources plugin.

          Show
          Olivier Lamy added a comment - This is now dealt with by the remote resources plugin.

            People

            • Assignee:
              Unassigned
              Reporter:
              Jeremy Boynes
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: