+ // license
+ String spdxLicenseId = manifest.getMainAttributes().getValue(SPDX_LICENSE_IDENTIFIER.toString());
+ if (spdxLicenseId == null)
+ throw new IllegalStateException("An SPDX license id must have beend defined at this stage.");
+ writer.append("\nIt is redistributed under the following license:\n\n");
+ writer.append("SPDX-Identifier: " + spdxLicenseId + "\n\n");
+
+ if (!spdxLicenseId.startsWith("LicenseRef")) {// standard
+ int withIndex = spdxLicenseId.indexOf(" WITH ");
+ if (withIndex >= 0) {
+ String simpleId = spdxLicenseId.substring(0, withIndex).trim();
+ String exception = spdxLicenseId.substring(withIndex + " WITH ".length());
+ writer.append("which are available here: https://spdx.org/licenses/" + simpleId
+ + "\nand here: https://spdx.org/licenses/" + exception + "\n");
+ } else {
+ writer.append("which is available here: https://spdx.org/licenses/" + spdxLicenseId + "\n");
+ }
+ } else {
+ String url = manifest.getMainAttributes().getValue(BUNDLE_LICENSE.toString());
+ if (url != null) {
+ writer.write("which is available here: " + url + "\n");
+ } else {
+ logger.log(ERROR, "No licne URL for " + jarDir);
+ }
+ }
+ writer.write("\n");
+
+ // origin