JDK-8169925 : Organize licenses by module in source, JMOD file, and run-time image
  • Type: Enhancement
  • Component: tools
  • Sub-Component: jlink
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2016-11-18
  • Updated: 2020-08-28
  • Resolved: 2016-12-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9 Other
9 b150Fixed openjdk8u272Fixed
Related Reports
Blocks :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
This tool support enables to package license files in JMOD file and copy in the runtime image at link-time.

The proposal is to add a new legal notice section in JMOD format.  jlink will copy the license files to the `legal` directory in the runtime image and organized by module:
     image/legal/$MODULE/*

The same copy of license file may be carried in more than one JMOD files.  A jlink plugin can be provided to deduplicate the legal notices when copied to the runtime image.
Comments
Proposal of the source layout for third party notices: ### Third party Notices The JDK source code includes dozens of third party libraries, each subject to license. Historically, third party licenses from across the JDK were aggregated by hand into a single file, `THIRD_PARTY_README`, at the end of a JDK release. Maintaining this file by hand is: 1. Tedious, because a person who wishes to add the license for a new third party library must check whether the license already exists in the file due to use by another third party library. 2. Error prone, because if the license doesn't exist in the file, it must be copy-pasted and then eyeballed for accuracy. 3. Redundant, because if a third party library changes its license, the person who copy-pastes the new license is unlikely to check if the old license is still needed by a third party library elsewhere in the JDK. Further redundancy occurs because a copy of the file exists in each JDK repository, above the `src` directory, even if only a fraction of the file's contents are relevant to third party code in that repository. To simplify maintenance, we propose to drop the aggregated `THIRD_PARTY_README` file from each JDK repository. To enhance precision, we propose to store each third party notices in the module that contains the third party code subject to the license. Under this scheme, the source layout is: src/$MODULE/{share,$OS}/legal/*.md The `legal` directory contains one file for each third party library in the module, for example, src/java.base/share/legal/asm.md unicode.md zlib.md This co-location makes it easy to check if a third party library in the JDK source code is accompanied by the correct license, and if a third party license is actually applying to source code in the JDK. Such file is in [MarkDown](http://daringfireball.net/projects/markdown) format. Documentation tools such as `pandoc` can easily transform such files and aggregate into another format, such as HTML. The name of the file is the name of the third party library subject to the license. The format is as follows: ## $LIBNAME $VERSION ### Notice <Content of the Notice> ### $LICENSE-NAME $LICENSE-VERSION <Content of the license> where: - `$LIBNAME` and `$VERSION` is the name and version of the third party library respectively - `$LICENSE-NAME` and `$LICENSE-VERSION` is the name and version of the license. The popular license names can be found from [Open Source Licenses](https://opensource.org/licenses). If the license is not named, the recommended section name is `$LIBNAME License`. - The Notice section is optional
07-12-2016