From 507d1bc761b83f3ab9570b4b2fdaed01b713a908 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Sun, 2 Jul 2023 13:27:17 +0200 Subject: [PATCH] Enable spotless - code reformat --- pom.xml | 69 +- .../license/AbstractAddThirdPartyMojo.java | 514 +- .../license/AbstractDownloadLicensesMojo.java | 773 +- .../mojo/license/AbstractFileHeaderMojo.java | 559 +- .../mojo/license/AbstractLicenseMojo.java | 168 +- .../mojo/license/AbstractLicenseNameMojo.java | 360 +- .../AbstractLicenseReportRenderer.java | 366 +- .../mojo/license/AbstractLicensesXmlMojo.java | 90 +- .../license/AbstractThirdPartyReportMojo.java | 308 +- .../mojo/license/AddThirdPartyMojo.java | 247 +- .../AggregateDownloadLicensesMojo.java | 49 +- .../license/AggregatorAddThirdPartyMojo.java | 187 +- .../AggregatorThirdPartyReportMojo.java | 53 +- .../mojo/license/CheckFileHeaderMojo.java | 23 +- .../mojo/license/CommentStyleListMojo.java | 86 +- .../mojo/license/DownloadLicensesMojo.java | 25 +- .../java/org/codehaus/mojo/license/Eol.java | 38 +- .../org/codehaus/mojo/license/FileState.java | 15 +- .../mojo/license/LicenseContentSanitizer.java | 15 +- .../mojo/license/LicenseListMojo.java | 85 +- .../mojo/license/LicenseMojoUtils.java | 128 +- .../mojo/license/LicenseUrlReplacement.java | 20 +- .../LicensesXmlInsertVersionsMojo.java | 110 +- .../mojo/license/RemoveFileHeaderMojo.java | 349 +- .../mojo/license/ThirdPartyReportMojo.java | 26 +- .../license/ThirdPartyReportRenderer.java | 167 +- .../mojo/license/UpdateFileHeaderMojo.java | 26 +- .../license/UpdateProjectLicenseMojo.java | 91 +- .../mojo/license/api/ArtifactFilters.java | 434 +- .../license/api/DefaultThirdPartyDetails.java | 85 +- .../license/api/DefaultThirdPartyHelper.java | 222 +- .../license/api/DefaultThirdPartyTool.java | 691 +- .../mojo/license/api/DependenciesTool.java | 176 +- .../api/DependenciesToolException.java | 9 +- .../mojo/license/api/FreeMarkerHelper.java | 82 +- .../MavenProjectDependenciesConfigurator.java | 3 +- .../api/ResolvedProjectDependencies.java | 18 +- .../mojo/license/api/ThirdPartyDetails.java | 7 +- .../mojo/license/api/ThirdPartyHelper.java | 65 +- .../mojo/license/api/ThirdPartyTool.java | 68 +- .../license/api/ThirdPartyToolException.java | 19 +- .../codehaus/mojo/license/download/Cache.java | 52 +- .../mojo/license/download/FileNameEntry.java | 17 +- .../mojo/license/download/License.java | 19 +- .../license/download/LicenseDownloader.java | 324 +- .../license/download/LicenseMatchers.java | 232 +- .../download/LicenseSummaryReader.java | 158 +- .../download/LicenseSummaryWriter.java | 230 +- .../license/download/LicensedArtifact.java | 117 +- .../download/LicensedArtifactResolver.java | 122 +- .../license/download/PreferredFileNames.java | 285 +- .../mojo/license/download/ProjectLicense.java | 126 +- .../license/download/ProjectLicenseInfo.java | 144 +- .../license/download/UrlReplacements.java | 111 +- .../mojo/license/header/FileHeader.java | 21 +- .../mojo/license/header/FileHeaderFilter.java | 111 +- .../license/header/FileHeaderProcessor.java | 73 +- .../header/InvalideFileHeaderException.java | 13 +- .../header/UpdateFileHeaderFilter.java | 63 +- .../AbstractFileHeaderTransformer.java | 308 +- .../transformer/AptFileHeaderTransformer.java | 14 +- .../transformer/FileHeaderTransformer.java | 49 +- .../FreeMarkerFileHeaderTransformer.java | 14 +- .../HtmlFileHeaderTransformer.java | 42 +- .../JavaFileHeaderTransformer.java | 71 +- .../transformer/JspFileHeaderTransformer.java | 15 +- .../MySqlFileHeaderTransformer.java | 15 +- .../transformer/PhpFileHeaderTransformer.java | 15 +- .../PropertiesFileHeaderTransformer.java | 42 +- .../transformer/RstFileHeaderTransformer.java | 14 +- .../transformer/SqlFileHeaderTransformer.java | 14 +- .../transformer/XmlFileHeaderTransformer.java | 43 +- .../mojo/license/model/Copyright.java | 113 +- .../codehaus/mojo/license/model/License.java | 120 +- .../mojo/license/model/LicenseMap.java | 107 +- .../mojo/license/model/LicenseRepository.java | 195 +- .../mojo/license/model/LicenseStore.java | 216 +- ...RootPackageClassPathLicenseRepository.java | 15 +- .../mojo/license/spdx/SpdxLicenseInfo.java | 145 +- .../mojo/license/spdx/SpdxLicenseList.java | 192 +- .../license/spdx/SpdxLicenseListData.java | 21699 +++++++++++----- .../codehaus/mojo/license/utils/FileUtil.java | 237 +- .../mojo/license/utils/MojoHelper.java | 209 +- .../mojo/license/utils/SortedProperties.java | 88 +- .../mojo/license/utils/StringToList.java | 57 +- .../mojo/license/utils/UrlRequester.java | 140 +- .../mojo/license/LicenseMojoUtilsTest.java | 152 +- .../org/codehaus/mojo/license/MockLogger.java | 38 +- .../mojo/license/api/ArtifactFiltersTest.java | 334 +- .../license/api/FreeMarkerHelperTest.java | 152 +- .../download/LicenseDownloaderTest.java | 17 +- .../license/download/LicenseMatchersTest.java | 187 +- .../license/download/LicenseSummaryTest.java | 146 +- .../AbstractFileHeaderTransformerTest.java | 330 +- .../JavaFileHeaderTransformerTest.java | 22 +- .../XmlFileHeaderTransformerTest.java | 23 +- .../mojo/license/model/LicenseMapTest.java | 11 +- .../license/model/LicenseRepositoryTest.java | 72 +- .../mojo/license/model/LicenseStoreTest.java | 123 +- .../license/spdx/SpdxLicenseListDataTest.java | 8 +- .../license/spdx/SpdxLicenseListTest.java | 56 +- .../mojo/license/utils/UrlRequesterTest.java | 36 +- 102 files changed, 20566 insertions(+), 14374 deletions(-) diff --git a/pom.xml b/pom.xml index 786ad2ad1..e1b2c6a1c 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 @@ -52,11 +50,11 @@ Tony Chemit dev@tchemit.fr + Ultreia.io + https://www.ultreia.io Lead Developer - Ultreia.io - https://www.ultreia.io Europe/Paris @@ -94,8 +92,8 @@ scm:git:https://github.com/mojohaus/license-maven-plugin.git scm:git:ssh://git@github.com/mojohaus/license-maven-plugin.git - https://github.com/mojohaus/license-maven-plugin/tree/master HEAD + https://github.com/mojohaus/license-maven-plugin/tree/master @@ -339,6 +337,13 @@ org.apache.maven.plugins maven-checkstyle-plugin + + + true + config/checkstyle-header.txt + **/HelpMojo.java,**/SpdxLicenseListData.java + + checkstyle-check @@ -348,23 +353,10 @@ verify - - - true - config/checkstyle-header.txt - **/HelpMojo.java,**/SpdxLicenseListData.java - org.codehaus.mojo animal-sniffer-maven-plugin - - - - check - - - org.codehaus.mojo.signature @@ -372,6 +364,13 @@ 1.0 + + + + check + + + org.eclipse.sisu @@ -381,6 +380,13 @@ org.codehaus.gmaven groovy-maven-plugin + + + org.apache.httpcomponents + httpclient + ${version.httpcomponents.httpclient} + + @@ -395,13 +401,6 @@ - - - org.apache.httpcomponents - httpclient - ${version.httpcomponents.httpclient} - - @@ -427,10 +426,10 @@ attach-artifacts - package attach-artifact + package @@ -447,6 +446,13 @@ org.codehaus.gmaven groovy-maven-plugin + + + org.littleshoot + littleproxy + 1.1.2 + + LittleProxyStart @@ -469,13 +475,6 @@ - - - org.littleshoot - littleproxy - 1.1.2 - - maven-invoker-plugin @@ -555,6 +554,7 @@ src/it/settings.xml ${project.build.directory}/local-repo + one-integration-test @@ -570,9 +570,6 @@ - - - diff --git a/src/main/java/org/codehaus/mojo/license/AbstractAddThirdPartyMojo.java b/src/main/java/org/codehaus/mojo/license/AbstractAddThirdPartyMojo.java index 4fbadf2c6..0a0711877 100644 --- a/src/main/java/org/codehaus/mojo/license/AbstractAddThirdPartyMojo.java +++ b/src/main/java/org/codehaus/mojo/license/AbstractAddThirdPartyMojo.java @@ -22,6 +22,17 @@ * #L% */ +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.SortedMap; +import java.util.SortedSet; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; @@ -34,6 +45,7 @@ import org.apache.maven.project.ProjectBuildingException; import org.codehaus.mojo.license.api.DefaultThirdPartyHelper; import org.codehaus.mojo.license.api.DependenciesTool; +import org.codehaus.mojo.license.api.DependenciesToolException; import org.codehaus.mojo.license.api.ThirdPartyHelper; import org.codehaus.mojo.license.api.ThirdPartyTool; import org.codehaus.mojo.license.api.ThirdPartyToolException; @@ -43,18 +55,6 @@ import org.codehaus.mojo.license.utils.SortedProperties; import org.codehaus.mojo.license.utils.StringToList; import org.codehaus.mojo.license.utils.UrlRequester; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.SortedSet; -import org.codehaus.mojo.license.api.DependenciesToolException; import org.eclipse.aether.resolution.ArtifactResolutionException; import org.eclipse.aether.transfer.ArtifactNotFoundException; import org.slf4j.Logger; @@ -66,10 +66,8 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public abstract class AbstractAddThirdPartyMojo - extends AbstractLicenseMojo -{ - private static final Logger LOG = LoggerFactory.getLogger( AbstractAddThirdPartyMojo.class ); +public abstract class AbstractAddThirdPartyMojo extends AbstractLicenseMojo { + private static final Logger LOG = LoggerFactory.getLogger(AbstractAddThirdPartyMojo.class); // ---------------------------------------------------------------------- // Mojo Parameters @@ -80,8 +78,10 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.0 */ - @Parameter( property = "license.outputDirectory", - defaultValue = "${project.build.directory}/generated-sources/license", required = true ) + @Parameter( + property = "license.outputDirectory", + defaultValue = "${project.build.directory}/generated-sources/license", + required = true) protected File outputDirectory; /** @@ -89,7 +89,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.0 */ - @Parameter( property = "license.deployMissingFile", defaultValue = "true" ) + @Parameter(property = "license.deployMissingFile", defaultValue = "true") protected boolean deployMissingFile; /** @@ -100,7 +100,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.0 */ - @Parameter( property = "license.useRepositoryMissingFiles", defaultValue = "true" ) + @Parameter(property = "license.useRepositoryMissingFiles", defaultValue = "true") protected boolean useRepositoryMissingFiles; /** @@ -115,7 +115,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.1 */ - @Parameter( property = "license.acceptPomPackaging", defaultValue = "false" ) + @Parameter(property = "license.acceptPomPackaging", defaultValue = "false") protected boolean acceptPomPackaging; /** @@ -131,7 +131,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.1 */ - @Parameter( property = "license.excludedScopes", defaultValue = "system" ) + @Parameter(property = "license.excludedScopes", defaultValue = "system") protected String excludedScopes; /** @@ -147,7 +147,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.1 */ - @Parameter( property = "license.includedScopes" ) + @Parameter(property = "license.includedScopes") protected String includedScopes; /** @@ -163,7 +163,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.15 */ - @Parameter( property = "license.excludedTypes" ) + @Parameter(property = "license.excludedTypes") protected String excludedTypes; /** @@ -178,7 +178,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.15 */ - @Parameter( property = "license.includedTypes" ) + @Parameter(property = "license.includedTypes") protected String includedTypes; /** @@ -195,7 +195,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.1 */ - @Parameter( property = "license.excludedGroups" ) + @Parameter(property = "license.excludedGroups") protected String excludedGroups; /** @@ -210,7 +210,8 @@ public abstract class AbstractAddThirdPartyMojo * {@link #includeTransitiveDependencies}. * * @since 1.1 - */ @Parameter( property = "license.includedGroups" ) + */ + @Parameter(property = "license.includedGroups") protected String includedGroups; /** @@ -227,7 +228,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.1 */ - @Parameter( property = "license.excludedArtifacts" ) + @Parameter(property = "license.excludedArtifacts") protected String excludedArtifacts; /** @@ -243,7 +244,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.1 */ - @Parameter( property = "license.includedArtifacts" ) + @Parameter(property = "license.includedArtifacts") protected String includedArtifacts; /** @@ -253,7 +254,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.1 */ - @Parameter( property = "license.includeTransitiveDependencies", defaultValue = "true" ) + @Parameter(property = "license.includeTransitiveDependencies", defaultValue = "true") boolean includeTransitiveDependencies; /** @@ -263,7 +264,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.13 */ - @Parameter( property = "license.excludeTransitiveDependencies", defaultValue = "false" ) + @Parameter(property = "license.excludeTransitiveDependencies", defaultValue = "false") boolean excludeTransitiveDependencies; /** @@ -272,7 +273,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.19 */ - @Parameter( property = "license.includeOptional", defaultValue = "true" ) + @Parameter(property = "license.includeOptional", defaultValue = "true") boolean includeOptional; /** @@ -280,7 +281,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.0 */ - @Parameter( property = "license.thirdPartyFilename", defaultValue = "THIRD-PARTY.txt", required = true ) + @Parameter(property = "license.thirdPartyFilename", defaultValue = "THIRD-PARTY.txt", required = true) protected String thirdPartyFilename; /** @@ -288,7 +289,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.0 */ - @Parameter( property = "license.useMissingFile", defaultValue = "false" ) + @Parameter(property = "license.useMissingFile", defaultValue = "false") protected boolean useMissingFile; /** @@ -296,7 +297,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.0 */ - @Parameter( property = "license.missingFile", defaultValue = "src/license/THIRD-PARTY.properties" ) + @Parameter(property = "license.missingFile", defaultValue = "src/license/THIRD-PARTY.properties") protected File missingFile; /** @@ -309,7 +310,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.15 */ - @Parameter( property = "license.missingFileUrl" ) + @Parameter(property = "license.missingFileUrl") protected String missingFileUrl; /** @@ -317,10 +318,9 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.14 */ - @Parameter( property = "license.missingLicensesFileArtifact" ) + @Parameter(property = "license.missingLicensesFileArtifact") protected String missingLicensesFileArtifact; - /** * A file containing the override license information for dependencies. * Note: Specify either {@link #overrideUrl} (preferred) or {@link #overrideFile}. @@ -331,7 +331,7 @@ public abstract class AbstractAddThirdPartyMojo * @deprecated Use {@link #overrideUrl} instead */ @Deprecated - @Parameter( property = "license.overrideFile" ) + @Parameter(property = "license.overrideFile") private File overrideFile; /** @@ -347,7 +347,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.17 */ - @Parameter( property = "license.overrideUrl" ) + @Parameter(property = "license.overrideUrl") private String overrideUrl; /** @@ -376,7 +376,7 @@ public abstract class AbstractAddThirdPartyMojo @Parameter protected List licenseMerges; - /** + /** * The file with the merge licenses in order to be used by command line. * Note: This option overrides {@link #licenseMerges}. * @@ -384,16 +384,16 @@ public abstract class AbstractAddThirdPartyMojo * @deprecated prefer use now {@link #licenseMergesUrl} */ @Deprecated - @Parameter( property = "license.licenseMergesFile" ) + @Parameter(property = "license.licenseMergesFile") protected String licenseMergesFile; - /** + /** * Location of file with the merge licenses in order to be used by command line. * Note: This option overrides {@link #licenseMerges}. * * @since 1.17 */ - @Parameter( property = "license.licenseMergesUrl" ) + @Parameter(property = "license.licenseMergesUrl") protected String licenseMergesUrl; /** @@ -447,7 +447,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.1 */ - @Parameter( property = "license.includedLicenses" ) + @Parameter(property = "license.includedLicenses") protected IncludedLicenses includedLicenses; /** @@ -500,7 +500,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.1 */ - @Parameter( property = "license.excludedLicenses" ) + @Parameter(property = "license.excludedLicenses") protected ExcludedLicenses excludedLicenses; /** @@ -511,8 +511,9 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.0 */ - @Parameter( property = "license.bundleThirdPartyPath", - defaultValue = "META-INF/${project.artifactId}-THIRD-PARTY.txt" ) + @Parameter( + property = "license.bundleThirdPartyPath", + defaultValue = "META-INF/${project.artifactId}-THIRD-PARTY.txt") protected String bundleThirdPartyPath; /** @@ -523,7 +524,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.0 */ - @Parameter( property = "license.generateBundle", defaultValue = "false" ) + @Parameter(property = "license.generateBundle", defaultValue = "false") protected boolean generateBundle; /** @@ -531,7 +532,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.0 */ - @Parameter( property = "license.force", defaultValue = "false" ) + @Parameter(property = "license.force", defaultValue = "false") protected boolean force; /** @@ -541,7 +542,7 @@ public abstract class AbstractAddThirdPartyMojo * @deprecated since 1.14, use now {@link #failOnMissing} or {@link #failOnBlacklist}. */ @Deprecated - @Parameter( property = "license.failIfWarning", defaultValue = "false" ) + @Parameter(property = "license.failIfWarning", defaultValue = "false") protected boolean failIfWarning; /** @@ -549,7 +550,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.14 */ - @Parameter( property = "license.failOnMissing", defaultValue = "false" ) + @Parameter(property = "license.failOnMissing", defaultValue = "false") protected boolean failOnMissing; /** @@ -557,7 +558,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.14 */ - @Parameter( property = "license.failOnBlacklist", defaultValue = "false" ) + @Parameter(property = "license.failOnBlacklist", defaultValue = "false") protected boolean failOnBlacklist; /** @@ -567,7 +568,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.6 */ - @Parameter( property = "license.sortArtifactByName", defaultValue = "false" ) + @Parameter(property = "license.sortArtifactByName", defaultValue = "false") protected boolean sortArtifactByName; /** @@ -582,13 +583,13 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.1 */ - @Parameter( property = "license.fileTemplate", defaultValue = "/org/codehaus/mojo/license/third-party-file.ftl" ) + @Parameter(property = "license.fileTemplate", defaultValue = "/org/codehaus/mojo/license/third-party-file.ftl") protected String fileTemplate; /** * The set of dependencies for the current project, used to locate license databases. */ - @Parameter( property = "project.artifacts", required = true, readonly = true ) + @Parameter(property = "project.artifacts", required = true, readonly = true) protected Set dependencies; // ---------------------------------------------------------------------- @@ -666,7 +667,7 @@ public abstract class AbstractAddThirdPartyMojo * * @since 1.18 */ - @Parameter( property = "license.artifactFiltersUrl" ) + @Parameter(property = "license.artifactFiltersUrl") protected String artifactFiltersUrl; // ---------------------------------------------------------------------- @@ -693,8 +694,8 @@ public abstract class AbstractAddThirdPartyMojo * @throws DependenciesToolException if the dependencies could not be loaded */ protected abstract SortedProperties createUnsafeMapping() - throws ProjectBuildingException, IOException, ThirdPartyToolException, - MojoExecutionException, DependenciesToolException; + throws ProjectBuildingException, IOException, ThirdPartyToolException, MojoExecutionException, + DependenciesToolException; // ---------------------------------------------------------------------- // AbstractLicenseMojo Implementaton @@ -704,116 +705,100 @@ protected abstract SortedProperties createUnsafeMapping() * {@inheritDoc} */ @Override - protected void init() - throws Exception - { + protected void init() throws Exception { - if ( getLog().isDebugEnabled() ) - { + if (getLog().isDebugEnabled()) { // always be verbose in debug mode - setVerbose( true ); + setVerbose(true); } - thirdPartyFile = new File( outputDirectory, thirdPartyFilename ); + thirdPartyFile = new File(outputDirectory, thirdPartyFilename); File projectFile = project.getFile() != null ? project.getFile() : new File(""); - LOG.debug( "project file: {} last modified: {}", projectFile, projectFile.lastModified() ); - LOG.debug( "third-party file: {} last modified: {}", thirdPartyFile, thirdPartyFile.lastModified() ); + LOG.debug("project file: {} last modified: {}", projectFile, projectFile.lastModified()); + LOG.debug("third-party file: {} last modified: {}", thirdPartyFile, thirdPartyFile.lastModified()); doGenerate = force || !thirdPartyFile.exists() || projectFile.lastModified() > thirdPartyFile.lastModified(); - if ( generateBundle ) - { + if (generateBundle) { - File bundleFile = FileUtil.getFile( outputDirectory, bundleThirdPartyPath ); + File bundleFile = FileUtil.getFile(outputDirectory, bundleThirdPartyPath); - LOG.debug( "bundle third-party file: {} last modified: {}", bundleFile, bundleFile.lastModified() ); + LOG.debug("bundle third-party file: {} last modified: {}", bundleFile, bundleFile.lastModified()); doGenerateBundle = force || !bundleFile.exists() || projectFile.lastModified() > bundleFile.lastModified(); - } - else - { + } else { // not generating bundled file doGenerateBundle = false; } - if ( shouldSkip() ) { + if (shouldSkip()) { return; } projectDependencies = loadDependencies(); - licenseMap = getHelper().createLicenseMap( projectDependencies ); + licenseMap = getHelper().createLicenseMap(projectDependencies); - if ( licenseMergesFile != null ) - { - if ( licenseMergesUrl != null ) - { - throw new MojoExecutionException( "You can't use both licenseMergesFile and licenseMergesUrl" ); + if (licenseMergesFile != null) { + if (licenseMergesUrl != null) { + throw new MojoExecutionException("You can't use both licenseMergesFile and licenseMergesUrl"); } - LOG.warn( "" ); - LOG.warn( "!!! licenseMergesFile is deprecated, use now licenseMergesUrl !!!" ); - LOG.warn( "" ); - LOG.warn( "licenseMerges will be overridden by licenseMergesFile." ); - LOG.warn( "" ); - licenseMerges = FileUtils.readLines( new File( licenseMergesFile ), "utf-8" ); - } - else if ( licenseMergesUrl != null ) - { - if ( licenseMerges != null ) - { - LOG.warn( "" ); - LOG.warn( "licenseMerges will be overridden by licenseMergesUrl." ); - LOG.warn( "" ); + LOG.warn(""); + LOG.warn("!!! licenseMergesFile is deprecated, use now licenseMergesUrl !!!"); + LOG.warn(""); + LOG.warn("licenseMerges will be overridden by licenseMergesFile."); + LOG.warn(""); + licenseMerges = FileUtils.readLines(new File(licenseMergesFile), "utf-8"); + } else if (licenseMergesUrl != null) { + if (licenseMerges != null) { + LOG.warn(""); + LOG.warn("licenseMerges will be overridden by licenseMergesUrl."); + LOG.warn(""); } - if ( UrlRequester.isStringUrl( licenseMergesUrl ) ) - { - licenseMerges = Arrays.asList( UrlRequester.getFromUrl( licenseMergesUrl ).split( "[\n\r]+" ) ); + if (UrlRequester.isStringUrl(licenseMergesUrl)) { + licenseMerges = + Arrays.asList(UrlRequester.getFromUrl(licenseMergesUrl).split("[\n\r]+")); } } - resolvedOverrideUrl = LicenseMojoUtils.prepareThirdPartyOverrideUrl( resolvedOverrideUrl, overrideFile, - overrideUrl, project.getBasedir() ); + resolvedOverrideUrl = LicenseMojoUtils.prepareThirdPartyOverrideUrl( + resolvedOverrideUrl, overrideFile, overrideUrl, project.getBasedir()); } - void consolidate() throws IOException, ArtifactNotFoundException, ArtifactResolutionException, MojoFailureException, - ProjectBuildingException, ThirdPartyToolException, - MojoExecutionException, DependenciesToolException - { + void consolidate() + throws IOException, ArtifactNotFoundException, ArtifactResolutionException, MojoFailureException, + ProjectBuildingException, ThirdPartyToolException, MojoExecutionException, + DependenciesToolException { - unsafeDependencies = getHelper().getProjectsWithNoLicense( licenseMap ); + unsafeDependencies = getHelper().getProjectsWithNoLicense(licenseMap); - if ( !CollectionUtils.isEmpty( unsafeDependencies ) ) - { - if ( useMissingFile && doGenerate ) - { + if (!CollectionUtils.isEmpty(unsafeDependencies)) { + if (useMissingFile && doGenerate) { // load unsafeMapping from local file and/or third-party classified items. unsafeMappings = createUnsafeMapping(); } } - getHelper().mergeLicenses( licenseMerges, licenseMap ); + getHelper().mergeLicenses(licenseMerges, licenseMap); - if ( CollectionUtils.isNotEmpty( unsafeDependencies ) ) - { - resolveUnsafeDependenciesFromFile( missingFile ); + if (CollectionUtils.isNotEmpty(unsafeDependencies)) { + resolveUnsafeDependenciesFromFile(missingFile); } - if ( !StringUtils.isBlank( missingLicensesFileArtifact ) && CollectionUtils.isNotEmpty( unsafeDependencies ) ) - { - String[] tokens = StringUtils.split( missingLicensesFileArtifact, ":" ); - if ( tokens.length != 3 ) - { + if (!StringUtils.isBlank(missingLicensesFileArtifact) && CollectionUtils.isNotEmpty(unsafeDependencies)) { + String[] tokens = StringUtils.split(missingLicensesFileArtifact, ":"); + if (tokens.length != 3) { throw new MojoFailureException( "Invalid missing licenses artifact, you must specify groupId:artifactId:version " - + missingLicensesFileArtifact ); + + missingLicensesFileArtifact); } String groupId = tokens[0]; String artifactId = tokens[1]; String version = tokens[2]; - resolveUnsafeDependenciesFromArtifact( groupId, artifactId, version ); + resolveUnsafeDependenciesFromArtifact(groupId, artifactId, version); } overrideLicenses(); @@ -822,16 +807,14 @@ void consolidate() throws IOException, ArtifactNotFoundException, ArtifactResolu /** * @return list of license to exclude. */ - private List getExcludedLicenses() - { + private List getExcludedLicenses() { return excludedLicenses.getData(); } /** * @return list of license to include. */ - private List getIncludedLicenses() - { + private List getIncludedLicenses() { return includedLicenses.getData(); } @@ -840,9 +823,8 @@ private List getIncludedLicenses() * * @param includedLicenses license to excludes separated by a {@code |}. */ - public void setIncludedLicenses( String includedLicenses ) throws MojoExecutionException - { - this.includedLicenses = new IncludedLicenses( includedLicenses ); + public void setIncludedLicenses(String includedLicenses) throws MojoExecutionException { + this.includedLicenses = new IncludedLicenses(includedLicenses); } /** @@ -850,171 +832,147 @@ public void setIncludedLicenses( String includedLicenses ) throws MojoExecutionE * * @param excludedLicenses license to excludes separated by a {@code |}. */ - public void setExcludedLicenses( String excludedLicenses ) throws MojoExecutionException - { - this.excludedLicenses = new ExcludedLicenses( excludedLicenses ); + public void setExcludedLicenses(String excludedLicenses) throws MojoExecutionException { + this.excludedLicenses = new ExcludedLicenses(excludedLicenses); } // ---------------------------------------------------------------------- // Protected Methods // ---------------------------------------------------------------------- - protected ThirdPartyHelper getHelper() - { - if ( helper == null ) - { - helper = new DefaultThirdPartyHelper( getProject(), getEncoding(), isVerbose(), dependenciesTool, - thirdPartyTool, getProject().getRemoteArtifactRepositories(), - getProject().getRemoteProjectRepositories() ); + protected ThirdPartyHelper getHelper() { + if (helper == null) { + helper = new DefaultThirdPartyHelper( + getProject(), + getEncoding(), + isVerbose(), + dependenciesTool, + thirdPartyTool, + getProject().getRemoteArtifactRepositories(), + getProject().getRemoteProjectRepositories()); } return helper; } - void resolveUnsafeDependenciesFromArtifact( String groupId, String artifactId, String version ) - throws ArtifactNotFoundException, IOException, ArtifactResolutionException, MojoExecutionException - { - File missingLicensesFromArtifact = thirdPartyTool.resolveMissingLicensesDescriptor( groupId, artifactId, - version, getProject().getRemoteProjectRepositories() ); - resolveUnsafeDependenciesFromFile( missingLicensesFromArtifact ); + void resolveUnsafeDependenciesFromArtifact(String groupId, String artifactId, String version) + throws ArtifactNotFoundException, IOException, ArtifactResolutionException, MojoExecutionException { + File missingLicensesFromArtifact = thirdPartyTool.resolveMissingLicensesDescriptor( + groupId, artifactId, version, getProject().getRemoteProjectRepositories()); + resolveUnsafeDependenciesFromFile(missingLicensesFromArtifact); } - void resolveUnsafeDependenciesFromFile( File missingLicenses ) throws IOException, MojoExecutionException - { - if ( missingLicenses == null ) - { + void resolveUnsafeDependenciesFromFile(File missingLicenses) throws IOException, MojoExecutionException { + if (missingLicenses == null) { return; } // there are missing licenses available from the artifact - SortedProperties unsafeMappings = new SortedProperties( getEncoding() ); + SortedProperties unsafeMappings = new SortedProperties(getEncoding()); - if ( missingLicenses.exists() && missingLicenses.length() > 0 ) - { + if (missingLicenses.exists() && missingLicenses.length() > 0) { // load the missing file - unsafeMappings.load( missingLicenses ); + unsafeMappings.load(missingLicenses); } - if ( useMissingFile && UrlRequester.isStringUrl( missingFileUrl ) ) - { - String httpRequestResult = UrlRequester.getFromUrl( missingFileUrl ); - unsafeMappings.load( new ByteArrayInputStream( httpRequestResult.getBytes() ) ); + if (useMissingFile && UrlRequester.isStringUrl(missingFileUrl)) { + String httpRequestResult = UrlRequester.getFromUrl(missingFileUrl); + unsafeMappings.load(new ByteArrayInputStream(httpRequestResult.getBytes())); } - if ( !unsafeMappings.isEmpty() ) - { + if (!unsafeMappings.isEmpty()) { Set resolvedDependencies = new HashSet<>(); - for ( MavenProject unsafeDependency : unsafeDependencies ) - { - String id = MojoHelper.getArtifactId( unsafeDependency.getArtifact() ); + for (MavenProject unsafeDependency : unsafeDependencies) { + String id = MojoHelper.getArtifactId(unsafeDependency.getArtifact()); - if ( unsafeMappings.containsKey( id ) && StringUtils.isNotBlank( unsafeMappings.getProperty( id ) ) ) - { + if (unsafeMappings.containsKey(id) && StringUtils.isNotBlank(unsafeMappings.getProperty(id))) { // update license map - thirdPartyTool.addLicense( licenseMap, unsafeDependency, unsafeMappings.getProperty( id ) ); + thirdPartyTool.addLicense(licenseMap, unsafeDependency, unsafeMappings.getProperty(id)); // remove - resolvedDependencies.add( unsafeDependency ); + resolvedDependencies.add(unsafeDependency); } } // remove resolvedDependencies from unsafeDeps; - unsafeDependencies.removeAll( resolvedDependencies ); + unsafeDependencies.removeAll(resolvedDependencies); } } - void checkUnsafeDependencies() - { - if ( CollectionUtils.isNotEmpty( unsafeDependencies ) ) - { - if ( LOG.isWarnEnabled() ) - { + void checkUnsafeDependencies() { + if (CollectionUtils.isNotEmpty(unsafeDependencies)) { + if (LOG.isWarnEnabled()) { boolean plural = unsafeDependencies.size() > 1; - String message = String.format( "There %s %d %s with no license :", - plural ? "are" : "is", - unsafeDependencies.size(), - plural ? "dependencies" : "dependency" ); - LOG.warn( message ); - for ( MavenProject dep : unsafeDependencies ) - { + String message = String.format( + "There %s %d %s with no license :", + plural ? "are" : "is", unsafeDependencies.size(), plural ? "dependencies" : "dependency"); + LOG.warn(message); + for (MavenProject dep : unsafeDependencies) { // no license found for the dependency - LOG.warn( " - {}", MojoHelper.getArtifactId( dep.getArtifact() ) ); + LOG.warn(" - {}", MojoHelper.getArtifactId(dep.getArtifact())); } } } } - boolean checkForbiddenLicenses() - { + boolean checkForbiddenLicenses() { List whiteLicenses = getIncludedLicenses(); List blackLicenses = getExcludedLicenses(); Set unsafeLicenses = new HashSet<>(); - if ( CollectionUtils.isNotEmpty( blackLicenses ) ) - { + if (CollectionUtils.isNotEmpty(blackLicenses)) { Set licenses = licenseMap.keySet(); - LOG.info( "Excluded licenses (blacklist): {}", blackLicenses ); - - for ( String excludeLicense : blackLicenses ) - { - if ( licenses.contains( excludeLicense ) - && CollectionUtils.isNotEmpty( licenseMap.get( excludeLicense ) ) ) - { - //bad license found - unsafeLicenses.add( excludeLicense ); + LOG.info("Excluded licenses (blacklist): {}", blackLicenses); + + for (String excludeLicense : blackLicenses) { + if (licenses.contains(excludeLicense) && CollectionUtils.isNotEmpty(licenseMap.get(excludeLicense))) { + // bad license found + unsafeLicenses.add(excludeLicense); } } } - if ( CollectionUtils.isNotEmpty( whiteLicenses ) ) - { + if (CollectionUtils.isNotEmpty(whiteLicenses)) { Set dependencyLicenses = licenseMap.keySet(); - LOG.info( "Included licenses (whitelist): {}", whiteLicenses ); + LOG.info("Included licenses (whitelist): {}", whiteLicenses); - for ( String dependencyLicense : dependencyLicenses ) - { - LOG.debug( "Testing license '{}'", dependencyLicense ); - if ( !whiteLicenses.contains( dependencyLicense ) - && CollectionUtils.isNotEmpty( licenseMap.get( dependencyLicense ) ) ) - { - LOG.debug( "Testing dependency license '{}' against all other licenses", dependencyLicense ); + for (String dependencyLicense : dependencyLicenses) { + LOG.debug("Testing license '{}'", dependencyLicense); + if (!whiteLicenses.contains(dependencyLicense) + && CollectionUtils.isNotEmpty(licenseMap.get(dependencyLicense))) { + LOG.debug("Testing dependency license '{}' against all other licenses", dependencyLicense); - for ( MavenProject dependency : licenseMap.get( dependencyLicense ) ) - { - LOG.debug( "- testing dependency {}" + dependency ); + for (MavenProject dependency : licenseMap.get(dependencyLicense)) { + LOG.debug("- testing dependency {}" + dependency); boolean forbiddenLicenseUsed = true; - for ( String otherLicense : dependencyLicenses ) - { + for (String otherLicense : dependencyLicenses) { // skip this license if it is the same as the dependency license // skip this license if it has no projects assigned - if ( otherLicense.equals( dependencyLicense ) - || licenseMap.get( dependencyLicense ).isEmpty() ) - { + if (otherLicense.equals(dependencyLicense) + || licenseMap.get(dependencyLicense).isEmpty()) { continue; } // skip this license if it isn't one of the whitelisted - if ( !whiteLicenses.contains( otherLicense ) ) - { + if (!whiteLicenses.contains(otherLicense)) { continue; } - if ( licenseMap.get( otherLicense ).contains( dependency ) ) - { - LOG.info( "License: '{}' for '{}' is OK since it is also licensed under '{}'", - dependencyLicense, - dependency, - otherLicense ); + if (licenseMap.get(otherLicense).contains(dependency)) { + LOG.info( + "License: '{}' for '{}' is OK since it is also licensed under '{}'", + dependencyLicense, + dependency, + otherLicense); // this dependency is licensed under another license from white list forbiddenLicenseUsed = false; break; } } - //bad license found - if ( forbiddenLicenseUsed ) - { - unsafeLicenses.add( dependencyLicense ); + // bad license found + if (forbiddenLicenseUsed) { + unsafeLicenses.add(dependencyLicense); break; } } @@ -1022,84 +980,71 @@ boolean checkForbiddenLicenses() } } - boolean safe = CollectionUtils.isEmpty( unsafeLicenses ); + boolean safe = CollectionUtils.isEmpty(unsafeLicenses); - if ( !safe ) - { - LOG.warn( "There are {} forbidden licenses used:", unsafeLicenses.size() ); - for ( String unsafeLicense : unsafeLicenses ) - { + if (!safe) { + LOG.warn("There are {} forbidden licenses used:", unsafeLicenses.size()); + for (String unsafeLicense : unsafeLicenses) { - SortedSet deps = licenseMap.get( unsafeLicense ); - if ( !deps.isEmpty() ) - { + SortedSet deps = licenseMap.get(unsafeLicense); + if (!deps.isEmpty()) { StringBuilder sb = new StringBuilder(); - sb.append( "License: '" ).append( unsafeLicense ).append( "' used by " ).append( deps.size() ) - .append( " dependencies:" ); - for ( MavenProject dep : deps ) - { - sb.append( "\n -" ).append( MojoHelper.getArtifactName( dep ) ); + sb.append("License: '") + .append(unsafeLicense) + .append("' used by ") + .append(deps.size()) + .append(" dependencies:"); + for (MavenProject dep : deps) { + sb.append("\n -").append(MojoHelper.getArtifactName(dep)); } - LOG.warn( "{}", sb ); + LOG.warn("{}", sb); } } } return safe; } - void writeThirdPartyFile() - throws IOException - { + void writeThirdPartyFile() throws IOException { - if ( doGenerate ) - { + if (doGenerate) { LicenseMap licenseMap1 = licenseMap; - if ( sortArtifactByName ) - { + if (sortArtifactByName) { licenseMap1 = licenseMap.toLicenseMapOrderByName(); } - thirdPartyTool.writeThirdPartyFile( licenseMap1, thirdPartyFile, isVerbose(), getEncoding(), fileTemplate ); + thirdPartyTool.writeThirdPartyFile(licenseMap1, thirdPartyFile, isVerbose(), getEncoding(), fileTemplate); } - if ( doGenerateBundle ) - { + if (doGenerateBundle) { - thirdPartyTool.writeBundleThirdPartyFile( thirdPartyFile, outputDirectory, bundleThirdPartyPath ); + thirdPartyTool.writeBundleThirdPartyFile(thirdPartyFile, outputDirectory, bundleThirdPartyPath); } } - void overrideLicenses() throws IOException - { - thirdPartyTool.overrideLicenses( licenseMap, projectDependencies, getEncoding(), resolvedOverrideUrl ); + void overrideLicenses() throws IOException { + thirdPartyTool.overrideLicenses(licenseMap, projectDependencies, getEncoding(), resolvedOverrideUrl); } - private boolean isFailOnMissing() - { + private boolean isFailOnMissing() { return failOnMissing; } - private boolean isFailOnBlacklist() - { + private boolean isFailOnBlacklist() { return failOnBlacklist; } - void checkMissing( boolean unsafe ) throws MojoFailureException - { + void checkMissing(boolean unsafe) throws MojoFailureException { - if ( unsafe && ( isFailOnMissing() || failIfWarning ) ) - { + if (unsafe && (isFailOnMissing() || failIfWarning)) { throw new MojoFailureException( - "There are some dependencies with no license, please fill the file " + missingFile ); + "There are some dependencies with no license, please fill the file " + missingFile); } } - void checkBlacklist( boolean safeLicense ) throws MojoFailureException - { - if ( !safeLicense && ( isFailOnBlacklist() || failIfWarning ) ) - { - throw new MojoFailureException( "There are some forbidden licenses used, please check your dependencies." ); + void checkBlacklist(boolean safeLicense) throws MojoFailureException { + if (!safeLicense && (isFailOnBlacklist() || failIfWarning)) { + throw new MojoFailureException("There are some forbidden licenses used, please check your dependencies."); } } @@ -1110,25 +1055,20 @@ void checkBlacklist( boolean safeLicense ) throws MojoFailureException * * @since 1.4 */ - public static class IncludedLicenses - extends StringToList - { + public static class IncludedLicenses extends StringToList { /** * Default constructor used when {@link #includedLicenses} parameter is configured by a list. */ - public IncludedLicenses() - { - } + public IncludedLicenses() {} /** * Constructor used when {@link #includedLicenses} parameter is configured by a string to split. * * @param data the string to split to fill the list of data of the object. */ - IncludedLicenses( String data ) throws MojoExecutionException - { - super( data ); + IncludedLicenses(String data) throws MojoExecutionException { + super(data); } /** @@ -1136,9 +1076,8 @@ public IncludedLicenses() * * @param includeLicense the include license to add. */ - public void setIncludedLicense( String includeLicense ) - { - addEntryToList( includeLicense ); + public void setIncludedLicense(String includeLicense) { + addEntryToList(includeLicense); } } @@ -1149,25 +1088,20 @@ public void setIncludedLicense( String includeLicense ) * * @since 1.4 */ - public static class ExcludedLicenses - extends StringToList - { + public static class ExcludedLicenses extends StringToList { /** * Default constructor used when {@link #excludedLicenses} parameter is configured by a list. */ - public ExcludedLicenses() - { - } + public ExcludedLicenses() {} /** * Constructor used when {@link #excludedLicenses} parameter is configured by a string to split. * * @param data the string to split to fill the list of data of the object. */ - ExcludedLicenses( String data ) throws MojoExecutionException - { - super( data ); + ExcludedLicenses(String data) throws MojoExecutionException { + super(data); } /** @@ -1175,10 +1109,8 @@ public ExcludedLicenses() * * @param excludeLicense the excludelicense to add. */ - public void setExcludedLicense( String excludeLicense ) - { - addEntryToList( excludeLicense ); + public void setExcludedLicense(String excludeLicense) { + addEntryToList(excludeLicense); } } - } diff --git a/src/main/java/org/codehaus/mojo/license/AbstractDownloadLicensesMojo.java b/src/main/java/org/codehaus/mojo/license/AbstractDownloadLicensesMojo.java index 0393f4bc5..c93c65027 100644 --- a/src/main/java/org/codehaus/mojo/license/AbstractDownloadLicensesMojo.java +++ b/src/main/java/org/codehaus/mojo/license/AbstractDownloadLicensesMojo.java @@ -40,6 +40,7 @@ import java.util.Set; import java.util.TreeMap; import java.util.regex.Pattern; + import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringEscapeUtils; import org.apache.maven.artifact.repository.ArtifactRepository; @@ -72,11 +73,9 @@ * * @author Tony Chemit - chemit@codelutin.com */ -public abstract class AbstractDownloadLicensesMojo - extends AbstractLicensesXmlMojo - implements MavenProjectDependenciesConfigurator -{ - private static final Logger LOG = LoggerFactory.getLogger( AbstractDownloadLicensesMojo.class ); +public abstract class AbstractDownloadLicensesMojo extends AbstractLicensesXmlMojo + implements MavenProjectDependenciesConfigurator { + private static final Logger LOG = LoggerFactory.getLogger(AbstractDownloadLicensesMojo.class); // ---------------------------------------------------------------------- // Mojo Parameters @@ -87,7 +86,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.0 */ - @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true ) + @Parameter(defaultValue = "${project.remoteArtifactRepositories}", readonly = true) protected List remoteRepositories; // CHECKSTYLE_OFF: LineLength @@ -176,7 +175,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.0 */ - @Parameter( property = "licensesConfigFile", defaultValue = "${project.basedir}/src/license/licenses.xml" ) + @Parameter(property = "licensesConfigFile", defaultValue = "${project.basedir}/src/license/licenses.xml") protected File licensesConfigFile; // CHECKSTYLE_ON: LineLength @@ -185,8 +184,9 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.0 */ - @Parameter( property = "licensesOutputDirectory", - defaultValue = "${project.build.directory}/generated-resources/licenses" ) + @Parameter( + property = "licensesOutputDirectory", + defaultValue = "${project.build.directory}/generated-resources/licenses") protected File licensesOutputDirectory; /** @@ -201,7 +201,7 @@ public abstract class AbstractDownloadLicensesMojo * @see #removeOrphanLicenseFiles * @since 1.18 */ - @Parameter( property = "license.cleanLicensesOutputDirectory", defaultValue = "false" ) + @Parameter(property = "license.cleanLicensesOutputDirectory", defaultValue = "false") private boolean cleanLicensesOutputDirectory; /** @@ -218,7 +218,7 @@ public abstract class AbstractDownloadLicensesMojo * @see #cleanLicensesOutputDirectory * @since 1.19 */ - @Parameter( property = "license.removeOrphanLicenseFiles", defaultValue = "true" ) + @Parameter(property = "license.removeOrphanLicenseFiles", defaultValue = "true") private boolean removeOrphanLicenseFiles; /** @@ -229,8 +229,9 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.18 */ - @Parameter( property = "license.licensesErrorsFile", - defaultValue = "${project.build.directory}/generated-resources/licenses-errors.xml" ) + @Parameter( + property = "license.licensesErrorsFile", + defaultValue = "${project.build.directory}/generated-resources/licenses-errors.xml") private File licensesErrorsFile; /** @@ -238,7 +239,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.0 */ - @Parameter( property = "license.excludedScopes", defaultValue = "system" ) + @Parameter(property = "license.excludedScopes", defaultValue = "system") private String excludedScopes; /** @@ -246,7 +247,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.0 */ - @Parameter( property = "license.includedScopes" ) + @Parameter(property = "license.includedScopes") private String includedScopes; /** @@ -254,7 +255,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.15 */ - @Parameter( property = "license.excludedTypes" ) + @Parameter(property = "license.excludedTypes") private String excludedTypes; /** @@ -262,7 +263,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.15 */ - @Parameter( property = "license.includedTypes" ) + @Parameter(property = "license.includedTypes") private String includedTypes; /** @@ -282,7 +283,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.18 */ - @Parameter( property = "license.artifactFiltersUrl" ) + @Parameter(property = "license.artifactFiltersUrl") private String artifactFiltersUrl; /** @@ -290,7 +291,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.0 */ - @Parameter( defaultValue = "${settings.offline}" ) + @Parameter(defaultValue = "${settings.offline}") private boolean offline; /** @@ -308,7 +309,7 @@ public abstract class AbstractDownloadLicensesMojo * @since 1.0 * @deprecated Use {@link #errorRemedy} instead */ - @Parameter( defaultValue = "false" ) + @Parameter(defaultValue = "false") private boolean quiet; /** @@ -320,11 +321,11 @@ public abstract class AbstractDownloadLicensesMojo * error *
    {@link ErrorRemedy#xmlOutput}: error messages are added as {@code } to * {@link AbstractDownloadLicensesMojo#licensesErrorsFile}; in case there are error messages, the build will - * fail after processing all dependencies
+ * fail after processing all dependencies * * @since 1.18 */ - @Parameter( property = "license.errorRemedy", defaultValue = "warn" ) + @Parameter(property = "license.errorRemedy", defaultValue = "warn") protected ErrorRemedy errorRemedy; /** @@ -339,7 +340,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.18 */ - @Parameter( property = "license.forceDownload", defaultValue = "false" ) + @Parameter(property = "license.forceDownload", defaultValue = "false") private boolean forceDownload; /** @@ -347,7 +348,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.0 */ - @Parameter( defaultValue = "true" ) + @Parameter(defaultValue = "true") private boolean includeTransitiveDependencies; /** @@ -355,7 +356,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.13 */ - @Parameter( property = "license.excludeTransitiveDependencies", defaultValue = "false" ) + @Parameter(property = "license.excludeTransitiveDependencies", defaultValue = "false") private boolean excludeTransitiveDependencies; /** @@ -364,7 +365,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.19 */ - @Parameter( property = "license.includeOptional", defaultValue = "true" ) + @Parameter(property = "license.includeOptional", defaultValue = "true") boolean includeOptional; /** @@ -372,7 +373,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.4 */ - @Parameter( defaultValue = "${settings.proxies}", readonly = true ) + @Parameter(defaultValue = "${settings.proxies}", readonly = true) private List proxies; /** @@ -381,10 +382,10 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.9 */ - @Parameter( property = "license.organizeLicensesByDependencies", defaultValue = "false" ) + @Parameter(property = "license.organizeLicensesByDependencies", defaultValue = "false") protected boolean organizeLicensesByDependencies; - @Parameter( property = "license.sortByGroupIdAndArtifactId", defaultValue = "false" ) + @Parameter(property = "license.sortByGroupIdAndArtifactId", defaultValue = "false") private boolean sortByGroupIdAndArtifactId; /** @@ -393,7 +394,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.11 */ - @Parameter( property = "license.excludedGroups" ) + @Parameter(property = "license.excludedGroups") private String excludedGroups; /** @@ -402,7 +403,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.11 */ - @Parameter( property = "license.includedGroups" ) + @Parameter(property = "license.includedGroups") private String includedGroups; /** @@ -411,7 +412,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.11 */ - @Parameter( property = "license.excludedArtifacts" ) + @Parameter(property = "license.excludedArtifacts") private String excludedArtifacts; /** @@ -420,7 +421,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.11 */ - @Parameter( property = "license.includedArtifacts" ) + @Parameter(property = "license.includedArtifacts") private String includedArtifacts; /** @@ -428,7 +429,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.0 */ - @Parameter( defaultValue = "${project}", readonly = true ) + @Parameter(defaultValue = "${project}", readonly = true) protected MavenProject project; /** @@ -500,10 +501,9 @@ public abstract class AbstractDownloadLicensesMojo * @since 1.20 * @see #licenseUrlReplacements */ - @Parameter( property = "license.useDefaultUrlReplacements", defaultValue = "false" ) + @Parameter(property = "license.useDefaultUrlReplacements", defaultValue = "false") protected boolean useDefaultUrlReplacements; - /** * A map that helps to select local files names for the content downloaded from license URLs. *

@@ -578,7 +578,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.18 */ - @Parameter( property = "license.writeVersions", defaultValue = "true" ) + @Parameter(property = "license.writeVersions", defaultValue = "true") private boolean writeVersions; /** @@ -586,7 +586,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.18 */ - @Parameter( property = "license.connectTimeout", defaultValue = "5000" ) + @Parameter(property = "license.connectTimeout", defaultValue = "5000") private int connectTimeout; /** @@ -594,7 +594,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.18 */ - @Parameter( property = "license.socketTimeout", defaultValue = "5000" ) + @Parameter(property = "license.socketTimeout", defaultValue = "5000") private int socketTimeout; /** @@ -602,7 +602,7 @@ public abstract class AbstractDownloadLicensesMojo * * @since 1.18 */ - @Parameter( property = "license.connectionRequestTimeout", defaultValue = "5000" ) + @Parameter(property = "license.connectionRequestTimeout", defaultValue = "5000") private int connectionRequestTimeout; /** @@ -639,7 +639,7 @@ public abstract class AbstractDownloadLicensesMojo * @since 1.20 * @see #useDefaultContentSanitizers */ - @Parameter( property = "license.licenseContentSanitizers" ) + @Parameter(property = "license.licenseContentSanitizers") private List licenseContentSanitizers; /** @@ -657,7 +657,7 @@ public abstract class AbstractDownloadLicensesMojo * @since 1.20 * @see #licenseContentSanitizers */ - @Parameter( property = "license.useDefaultContentSanitizers", defaultValue = "false" ) + @Parameter(property = "license.useDefaultContentSanitizers", defaultValue = "false") private boolean useDefaultContentSanitizers; // ---------------------------------------------------------------------- @@ -684,8 +684,7 @@ public abstract class AbstractDownloadLicensesMojo protected abstract boolean isSkip(); - protected MavenProject getProject() - { + protected MavenProject getProject() { return project; } @@ -699,57 +698,45 @@ protected MavenProject getProject() * {@inheritDoc} * @throws MojoFailureException */ - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { - if ( isSkip() ) - { - LOG.info( "skip flag is on, will skip goal." ); + if (isSkip()) { + LOG.info("skip flag is on, will skip goal."); return; } - this.errorRemedy = getEffectiveErrorRemedy( this.quiet, this.errorRemedy ); - this.preferredFileNames = PreferredFileNames.build( licensesOutputDirectory, licenseUrlFileNames ); - this.cache = new Cache( licenseUrlFileNames != null && !licenseUrlFileNames.isEmpty() ); + this.errorRemedy = getEffectiveErrorRemedy(this.quiet, this.errorRemedy); + this.preferredFileNames = PreferredFileNames.build(licensesOutputDirectory, licenseUrlFileNames); + this.cache = new Cache(licenseUrlFileNames != null && !licenseUrlFileNames.isEmpty()); this.urlReplacements = urlReplacements(); initDirectories(); - final LicenseMatchers matchers = LicenseMatchers.load( licensesConfigFile ); + final LicenseMatchers matchers = LicenseMatchers.load(licensesConfigFile); - if ( !forceDownload ) - { - try - { + if (!forceDownload) { + try { final List projectLicenseInfos = - LicenseSummaryReader.parseLicenseSummary( licensesOutputFile ); - for ( ProjectLicenseInfo dep : projectLicenseInfos ) - { - for ( ProjectLicense lic : dep.getLicenses() ) - { + LicenseSummaryReader.parseLicenseSummary(licensesOutputFile); + for (ProjectLicenseInfo dep : projectLicenseInfos) { + for (ProjectLicense lic : dep.getLicenses()) { final String fileName = lic.getFile(); - if ( fileName != null ) - { - orphanFileNames.add( fileName ); + if (fileName != null) { + orphanFileNames.add(fileName); final String url = lic.getUrl(); - if ( url != null ) - { - final File file = new File( licensesOutputDirectory, fileName ); - if ( file.exists() ) - { + if (url != null) { + final File file = new File(licensesOutputDirectory, fileName); + if (file.exists()) { final LicenseDownloadResult entry = - LicenseDownloadResult.success( file, FileUtil.sha1( file.toPath() ), false ); - cache.put( url, entry ); + LicenseDownloadResult.success(file, FileUtil.sha1(file.toPath()), false); + cache.put(url, entry); } } } } } - } - catch ( Exception e ) - { - throw new MojoExecutionException( "Unable to process license summary file: " + licensesOutputFile, e ); + } catch (Exception e) { + throw new MojoExecutionException("Unable to process license summary file: " + licensesOutputFile, e); } } @@ -758,71 +745,62 @@ public void execute() // The resulting list of licenses after dependency resolution final List depProjectLicenses = new ArrayList<>(); - try ( LicenseDownloader licenseDownloader = - new LicenseDownloader( findActiveProxy(), connectTimeout, socketTimeout, connectionRequestTimeout, - contentSanitizers(), getCharset() ) ) - { - for ( LicensedArtifact artifact : dependencies.values() ) - { - LOG.debug( "Checking licenses for project " + artifact ); - final ProjectLicenseInfo depProject = createDependencyProject( artifact ); - matchers.replaceMatches( depProject ); + try (LicenseDownloader licenseDownloader = new LicenseDownloader( + findActiveProxy(), + connectTimeout, + socketTimeout, + connectionRequestTimeout, + contentSanitizers(), + getCharset())) { + for (LicensedArtifact artifact : dependencies.values()) { + LOG.debug("Checking licenses for project " + artifact); + final ProjectLicenseInfo depProject = createDependencyProject(artifact); + matchers.replaceMatches(depProject); /* Copy the messages and handle them via handleError() that may eventually add them back */ - final List msgs = new ArrayList<>( depProject.getDownloaderMessages() ); + final List msgs = new ArrayList<>(depProject.getDownloaderMessages()); depProject.getDownloaderMessages().clear(); - for ( String msg : msgs ) - { - handleError( depProject, msg ); + for (String msg : msgs) { + handleError(depProject, msg); } - depProjectLicenses.add( depProject ); + depProjectLicenses.add(depProject); } - if ( !offline ) - { + if (!offline) { /* First save the matching URLs into the cache */ - for ( ProjectLicenseInfo depProject : depProjectLicenses ) - { - downloadLicenses( licenseDownloader, depProject, true ); + for (ProjectLicenseInfo depProject : depProjectLicenses) { + downloadLicenses(licenseDownloader, depProject, true); } - LOG.debug( "Finished populating cache" ); + LOG.debug("Finished populating cache"); /* * Then attempt to download the rest of the URLs using the available cache entries to select local * file names based on file content sha1 */ - for ( ProjectLicenseInfo depProject : depProjectLicenses ) - { - downloadLicenses( licenseDownloader, depProject, false ); + for (ProjectLicenseInfo depProject : depProjectLicenses) { + downloadLicenses(licenseDownloader, depProject, false); } } - } - catch ( IOException e ) - { - throw new RuntimeException( e ); + } catch (IOException e) { + throw new RuntimeException(e); } - try - { - if ( sortByGroupIdAndArtifactId ) - { - sortByGroupIdAndArtifactId( depProjectLicenses ); + try { + if (sortByGroupIdAndArtifactId) { + sortByGroupIdAndArtifactId(depProjectLicenses); } - List depProjectLicensesWithErrors = filterErrors( depProjectLicenses ); - writeLicenseSummary( depProjectLicenses, licensesOutputFile, writeVersions ); - if ( depProjectLicensesWithErrors != null && !depProjectLicensesWithErrors.isEmpty() ) - { - writeLicenseSummary( depProjectLicensesWithErrors, licensesErrorsFile, writeVersions ); + List depProjectLicensesWithErrors = filterErrors(depProjectLicenses); + writeLicenseSummary(depProjectLicenses, licensesOutputFile, writeVersions); + if (depProjectLicensesWithErrors != null && !depProjectLicensesWithErrors.isEmpty()) { + writeLicenseSummary(depProjectLicensesWithErrors, licensesErrorsFile, writeVersions); } - removeOrphanFiles( depProjectLicenses ); - } - catch ( Exception e ) - { - throw new MojoExecutionException( "Unable to write license summary file: " + licensesOutputFile, e ); + removeOrphanFiles(depProjectLicenses); + } catch (Exception e) { + throw new MojoExecutionException("Unable to write license summary file: " + licensesOutputFile, e); } - if ( downloadErrorCount > 0 ) { + if (downloadErrorCount > 0) { switch (errorRemedy) { case ignore: case failFast: @@ -832,95 +810,83 @@ public void execute() LOG.warn("There were {} download errors - check the warnings above", downloadErrorCount); break; case xmlOutput: - throw new MojoFailureException("There were " + downloadErrorCount + " download errors - check " + licensesErrorsFile.getAbsolutePath()); + throw new MojoFailureException("There were " + downloadErrorCount + " download errors - check " + + licensesErrorsFile.getAbsolutePath()); default: - throw new IllegalStateException("Unexpected value of " + ErrorRemedy.class.getName() + ": " + errorRemedy); + throw new IllegalStateException( + "Unexpected value of " + ErrorRemedy.class.getName() + ": " + errorRemedy); } } } - private UrlReplacements urlReplacements() - { - UrlReplacements.Builder b = UrlReplacements.builder().useDefaults( useDefaultUrlReplacements ); - if ( licenseUrlReplacements != null ) - { - for ( LicenseUrlReplacement r : licenseUrlReplacements ) - { - b.replacement( r.getId(), r.getRegexp(), r.getReplacement() ); + private UrlReplacements urlReplacements() { + UrlReplacements.Builder b = UrlReplacements.builder().useDefaults(useDefaultUrlReplacements); + if (licenseUrlReplacements != null) { + for (LicenseUrlReplacement r : licenseUrlReplacements) { + b.replacement(r.getId(), r.getRegexp(), r.getReplacement()); } } return b.build(); } - private Map contentSanitizers() - { - Map result = - new TreeMap(); - if ( useDefaultContentSanitizers ) - { + private Map contentSanitizers() { + Map result = new TreeMap(); + if (useDefaultContentSanitizers) { final Map defaultSanitizers = - SpdxLicenseList.getLatest().getAttachments().getContentSanitizers(); - result.putAll( defaultSanitizers ); - if ( LOG.isDebugEnabled() && !defaultSanitizers.isEmpty() ) - { + SpdxLicenseList.getLatest().getAttachments().getContentSanitizers(); + result.putAll(defaultSanitizers); + if (LOG.isDebugEnabled() && !defaultSanitizers.isEmpty()) { final StringBuilder sb = new StringBuilder() // - .append( "Applied " ) // - .append( defaultSanitizers.size() ) // - .append( " licenseContentSanitizers:\n\n" ); - for ( ContentSanitizer sanitizer : defaultSanitizers.values() ) - { - sb.append( " \n" ) // - .append( " " ) // - .append( sanitizer.getId() ) // - .append( "\n" ) // - .append( " " ) // - .append( StringEscapeUtils.escapeJava( sanitizer.getUrlPattern().pattern() ) ) // - .append( "\n" ) // - .append( " " ) // - .append( StringEscapeUtils.escapeJava( sanitizer.getContentPattern().pattern() ) ) // - .append( "\n" ) // - .append( " " ) // - .append( StringEscapeUtils.escapeJava( sanitizer.getContentReplacement() ) ) // - .append( "\n" ) // - .append( " \n" ); + .append("Applied ") // + .append(defaultSanitizers.size()) // + .append(" licenseContentSanitizers:\n\n"); + for (ContentSanitizer sanitizer : defaultSanitizers.values()) { + sb.append(" \n") // + .append(" ") // + .append(sanitizer.getId()) // + .append("\n") // + .append(" ") // + .append(StringEscapeUtils.escapeJava( + sanitizer.getUrlPattern().pattern())) // + .append("\n") // + .append(" ") // + .append(StringEscapeUtils.escapeJava( + sanitizer.getContentPattern().pattern())) // + .append("\n") // + .append(" ") // + .append(StringEscapeUtils.escapeJava(sanitizer.getContentReplacement())) // + .append("\n") // + .append(" \n"); } - sb.append( "" ); + sb.append(""); - LOG.debug( sb.toString() ); + LOG.debug(sb.toString()); } } - if ( licenseContentSanitizers != null ) - { - for ( LicenseContentSanitizer s : licenseContentSanitizers ) - { - result.put( s.getId(), - ContentSanitizer.compile( s.getId(), s.getUrlRegexp(), - s.getContentRegexp(), - s.getContentReplacement() ) ); + if (licenseContentSanitizers != null) { + for (LicenseContentSanitizer s : licenseContentSanitizers) { + result.put( + s.getId(), + ContentSanitizer.compile( + s.getId(), s.getUrlRegexp(), s.getContentRegexp(), s.getContentReplacement())); } } - return Collections.unmodifiableMap( result ); + return Collections.unmodifiableMap(result); } - private void removeOrphanFiles( List deps ) - { - if ( removeOrphanLicenseFiles ) - { - for ( ProjectLicenseInfo dep : deps ) - { - for ( ProjectLicense lic : dep.getLicenses() ) - { - orphanFileNames.remove( lic.getFile() ); + private void removeOrphanFiles(List deps) { + if (removeOrphanLicenseFiles) { + for (ProjectLicenseInfo dep : deps) { + for (ProjectLicense lic : dep.getLicenses()) { + orphanFileNames.remove(lic.getFile()); } } - for ( String fileName : orphanFileNames ) - { - final File file = new File( licensesOutputDirectory, fileName ); - if ( file.exists() ) - { - LOG.info( "Removing orphan license file \"{}\"", file ); + for (String fileName : orphanFileNames) { + final File file = new File(licensesOutputDirectory, fileName); + if (file.exists()) { + LOG.info("Removing orphan license file \"{}\"", file); file.delete(); } } @@ -935,27 +901,22 @@ private void removeOrphanFiles( List deps ) * @return a new {@link List} of {@link ProjectLicenseInfo}s containing only elements with non-empty * {@link ProjectLicenseInfo#getDownloaderMessages()} */ - private List filterErrors( List depProjectLicenses ) - { + private List filterErrors(List depProjectLicenses) { final List result = new ArrayList<>(); final Iterator it = depProjectLicenses.iterator(); - while ( it.hasNext() ) - { + while (it.hasNext()) { final ProjectLicenseInfo dep = it.next(); final List messages = dep.getDownloaderMessages(); - if ( messages != null && !messages.isEmpty() ) - { + if (messages != null && !messages.isEmpty()) { it.remove(); - result.add( dep ); + result.add(dep); } } return result; } - private static ErrorRemedy getEffectiveErrorRemedy( boolean quiet, ErrorRemedy errorRemedy ) - { - switch ( errorRemedy ) - { + private static ErrorRemedy getEffectiveErrorRemedy(boolean quiet, ErrorRemedy errorRemedy) { + switch (errorRemedy) { case warn: return quiet ? ErrorRemedy.ignore : ErrorRemedy.warn; default: @@ -963,18 +924,15 @@ private static ErrorRemedy getEffectiveErrorRemedy( boolean quiet, ErrorRemedy e } } - private void sortByGroupIdAndArtifactId( List depProjectLicenses ) - { - Comparator comparator = new Comparator() - { - public int compare( ProjectLicenseInfo info1, ProjectLicenseInfo info2 ) - { - //ProjectLicenseInfo::getId() can not be used because . is before : thus a:b.c would be after a.b:c - return ( info1.getGroupId() + "+" + info1.getArtifactId() ).compareTo( info2.getGroupId() - + "+" + info2.getArtifactId() ); + private void sortByGroupIdAndArtifactId(List depProjectLicenses) { + Comparator comparator = new Comparator() { + public int compare(ProjectLicenseInfo info1, ProjectLicenseInfo info2) { + // ProjectLicenseInfo::getId() can not be used because . is before : thus a:b.c would be after a.b:c + return (info1.getGroupId() + "+" + info1.getArtifactId()) + .compareTo(info2.getGroupId() + "+" + info2.getArtifactId()); } }; - Collections.sort( depProjectLicenses, comparator ); + Collections.sort(depProjectLicenses, comparator); } // ---------------------------------------------------------------------- @@ -984,27 +942,32 @@ public int compare( ProjectLicenseInfo info1, ProjectLicenseInfo info2 ) /** * {@inheritDoc} */ - public boolean isIncludeTransitiveDependencies() - { + public boolean isIncludeTransitiveDependencies() { return includeTransitiveDependencies; } /** * {@inheritDoc} */ - public boolean isExcludeTransitiveDependencies() - { + public boolean isExcludeTransitiveDependencies() { return excludeTransitiveDependencies; } /** {@inheritDoc} */ - public ArtifactFilters getArtifactFilters() - { - if ( artifactFilters == null ) - { - artifactFilters = ArtifactFilters.of( includedGroups, excludedGroups, includedArtifacts, excludedArtifacts, - includedScopes, excludedScopes, includedTypes, excludedTypes, - includeOptional, artifactFiltersUrl , getEncoding() ); + public ArtifactFilters getArtifactFilters() { + if (artifactFilters == null) { + artifactFilters = ArtifactFilters.of( + includedGroups, + excludedGroups, + includedArtifacts, + excludedArtifacts, + includedScopes, + excludedScopes, + includedTypes, + excludedTypes, + includeOptional, + artifactFiltersUrl, + getEncoding()); } return artifactFilters; } @@ -1012,8 +975,7 @@ public ArtifactFilters getArtifactFilters() /** * {@inheritDoc} */ - public boolean isVerbose() - { + public boolean isVerbose() { return getLog().isDebugEnabled(); } @@ -1021,47 +983,35 @@ public boolean isVerbose() // Private Methods // ---------------------------------------------------------------------- - private void initDirectories() - throws MojoExecutionException - { - try - { - if ( licensesOutputDirectory.exists() ) - { - if ( cleanLicensesOutputDirectory ) - { - LOG.info( "Cleaning licensesOutputDirectory '{}'", licensesOutputDirectory ); - FileUtils.cleanDirectory( licensesOutputDirectory ); + private void initDirectories() throws MojoExecutionException { + try { + if (licensesOutputDirectory.exists()) { + if (cleanLicensesOutputDirectory) { + LOG.info("Cleaning licensesOutputDirectory '{}'", licensesOutputDirectory); + FileUtils.cleanDirectory(licensesOutputDirectory); } - } - else - { - FileUtil.createDirectoryIfNecessary( licensesOutputDirectory ); + } else { + FileUtil.createDirectoryIfNecessary(licensesOutputDirectory); } - FileUtil.createDirectoryIfNecessary( licensesOutputFile.getParentFile() ); + FileUtil.createDirectoryIfNecessary(licensesOutputFile.getParentFile()); - FileUtil.createDirectoryIfNecessary( licensesErrorsFile.getParentFile() ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Unable to create a directory...", e ); + FileUtil.createDirectoryIfNecessary(licensesErrorsFile.getParentFile()); + } catch (IOException e) { + throw new MojoExecutionException("Unable to create a directory...", e); } } /** {@inheritDoc} */ - protected Path[] getAutodetectEolFiles() - { - return new Path[] { licensesConfigFile.toPath(), project.getBasedir().toPath().resolve( "pom.xml" ) }; + protected Path[] getAutodetectEolFiles() { + return new Path[] { + licensesConfigFile.toPath(), project.getBasedir().toPath().resolve("pom.xml") + }; } - private Proxy findActiveProxy() - throws MojoExecutionException - { - for ( Proxy proxy : proxies ) - { - if ( proxy.isActive() && "http".equals( proxy.getProtocol() ) ) - { + private Proxy findActiveProxy() throws MojoExecutionException { + for (Proxy proxy : proxies) { + if (proxy.isActive() && "http".equals(proxy.getProtocol())) { return proxy; } } @@ -1075,22 +1025,17 @@ private Proxy findActiveProxy() * @return DependencyProject with artifact and license info * @throws MojoFailureException */ - private ProjectLicenseInfo createDependencyProject( LicensedArtifact depMavenProject ) throws MojoFailureException - { - final ProjectLicenseInfo dependencyProject = - new ProjectLicenseInfo( depMavenProject.getGroupId(), depMavenProject.getArtifactId(), - depMavenProject.getVersion() ); + private ProjectLicenseInfo createDependencyProject(LicensedArtifact depMavenProject) throws MojoFailureException { + final ProjectLicenseInfo dependencyProject = new ProjectLicenseInfo( + depMavenProject.getGroupId(), depMavenProject.getArtifactId(), depMavenProject.getVersion()); final List licenses = depMavenProject.getLicenses(); - for ( org.codehaus.mojo.license.download.License license : licenses ) - { - dependencyProject.addLicense( new ProjectLicense( license.getName(), license.getUrl(), - license.getDistribution(), license.getComments(), - null ) ); + for (org.codehaus.mojo.license.download.License license : licenses) { + dependencyProject.addLicense(new ProjectLicense( + license.getName(), license.getUrl(), license.getDistribution(), license.getComments(), null)); } List msgs = depMavenProject.getErrorMessages(); - for ( String msg : msgs ) - { - dependencyProject.addDownloaderMessage( msg ); + for (String msg : msgs) { + dependencyProject.addDownloaderMessage(msg); } return dependencyProject; @@ -1107,71 +1052,60 @@ private ProjectLicenseInfo createDependencyProject( LicensedArtifact depMavenPro * @return A filename to be used for the downloaded license file * @throws URISyntaxException */ - private FileNameEntry getLicenseFileName( ProjectLicenseInfo depProject, final String url, - final String licenseName, String licenseFileName ) - throws URISyntaxException - { - - final URI licenseUrl = new URI( url ); - File licenseUrlFile = new File( licenseUrl.getPath() ); - - if ( organizeLicensesByDependencies ) - { - if ( licenseFileName != null && !licenseFileName.isEmpty() ) - { - return new FileNameEntry( new File( licensesOutputDirectory, new File( licenseFileName ).getName() ), - false, null ); + private FileNameEntry getLicenseFileName( + ProjectLicenseInfo depProject, final String url, final String licenseName, String licenseFileName) + throws URISyntaxException { + + final URI licenseUrl = new URI(url); + File licenseUrlFile = new File(licenseUrl.getPath()); + + if (organizeLicensesByDependencies) { + if (licenseFileName != null && !licenseFileName.isEmpty()) { + return new FileNameEntry( + new File(licensesOutputDirectory, new File(licenseFileName).getName()), false, null); } - licenseFileName = String.format( "%s.%s%s.txt", depProject.getGroupId(), depProject.getArtifactId(), - licenseName != null - ? "_" + licenseName - : "" ).replaceAll( "\\s+", "_" ); - } - else - { - final FileNameEntry preferredFileNameEntry = preferredFileNames.getEntryByUrl( url ); - if ( preferredFileNameEntry != null ) - { + licenseFileName = String.format( + "%s.%s%s.txt", + depProject.getGroupId(), + depProject.getArtifactId(), + licenseName != null ? "_" + licenseName : "") + .replaceAll("\\s+", "_"); + } else { + final FileNameEntry preferredFileNameEntry = preferredFileNames.getEntryByUrl(url); + if (preferredFileNameEntry != null) { return preferredFileNameEntry; } - if ( licenseFileName != null && !licenseFileName.isEmpty() ) - { - return new FileNameEntry( new File( licensesOutputDirectory, - new File( licenseFileName ).getName() ), - false, null ); + if (licenseFileName != null && !licenseFileName.isEmpty()) { + return new FileNameEntry( + new File(licensesOutputDirectory, new File(licenseFileName).getName()), false, null); } licenseFileName = licenseUrlFile.getName(); - if ( licenseName != null ) - { + if (licenseName != null) { licenseFileName = licenseName + " - " + licenseUrlFile.getName(); } // Normalize whitespace - licenseFileName = licenseFileName.replaceAll( "\\s+", " " ); + licenseFileName = licenseFileName.replaceAll("\\s+", " "); } // lower case and (back)slash removal - licenseFileName = licenseFileName.toLowerCase( Locale.US ).replaceAll( "[\\\\/]+", "_" ); + licenseFileName = licenseFileName.toLowerCase(Locale.US).replaceAll("[\\\\/]+", "_"); - licenseFileName = sanitize( licenseFileName ); + licenseFileName = sanitize(licenseFileName); - return new FileNameEntry( new File( licensesOutputDirectory, licenseFileName ), false, null ); + return new FileNameEntry(new File(licensesOutputDirectory, licenseFileName), false, null); } - private String sanitize( String licenseFileName ) - { - if ( licenseUrlFileNameSanitizers != null ) - { - for ( LicenseUrlReplacement sanitizer : licenseUrlFileNameSanitizers ) - { + private String sanitize(String licenseFileName) { + if (licenseUrlFileNameSanitizers != null) { + for (LicenseUrlReplacement sanitizer : licenseUrlFileNameSanitizers) { Pattern regexp = sanitizer.getPattern(); String replacement = sanitizer.getReplacement() == null ? "" : sanitizer.getReplacement(); - if ( regexp != null ) - { - licenseFileName = regexp.matcher( licenseFileName ).replaceAll( replacement ); + if (regexp != null) { + licenseFileName = regexp.matcher(licenseFileName).replaceAll(replacement); } } } @@ -1185,189 +1119,147 @@ private String sanitize( String licenseFileName ) * @param matchingUrlsOnly * @throws MojoFailureException */ - private void downloadLicenses( LicenseDownloader licenseDownloader, ProjectLicenseInfo depProject, - boolean matchingUrlsOnly ) - throws MojoFailureException - { - LOG.debug( "Downloading license(s) for project {}", depProject ); + private void downloadLicenses( + LicenseDownloader licenseDownloader, ProjectLicenseInfo depProject, boolean matchingUrlsOnly) + throws MojoFailureException { + LOG.debug("Downloading license(s) for project {}", depProject); List licenses = depProject.getLicenses(); - if ( matchingUrlsOnly && ( depProject.getLicenses() == null || depProject.getLicenses().isEmpty() ) ) - { - handleError( depProject, "No license information available for: " + depProject.toGavString() ); + if (matchingUrlsOnly + && (depProject.getLicenses() == null || depProject.getLicenses().isEmpty())) { + handleError(depProject, "No license information available for: " + depProject.toGavString()); return; } int licenseIndex = 0; - for ( ProjectLicense license : licenses ) - { - if ( matchingUrlsOnly && license.getUrl() == null ) - { - handleError( depProject, "No URL for license at index " + licenseIndex + " in dependency " - + depProject.toGavString() ); - } - else if ( license.getUrl() != null ) - { - final String licenseUrl = urlReplacements.rewriteIfNecessary( license.getUrl() ); - - final LicenseDownloadResult cachedResult = cache.get( licenseUrl ); - try - { - - if ( cachedResult != null ) - { - if ( cachedResult.isPreferredFileName() == matchingUrlsOnly ) - { - if ( organizeLicensesByDependencies ) - { - final FileNameEntry fileNameEntry = - getLicenseFileName( depProject, licenseUrl, license.getName(), license.getFile() ); + for (ProjectLicense license : licenses) { + if (matchingUrlsOnly && license.getUrl() == null) { + handleError( + depProject, + "No URL for license at index " + licenseIndex + " in dependency " + depProject.toGavString()); + } else if (license.getUrl() != null) { + final String licenseUrl = urlReplacements.rewriteIfNecessary(license.getUrl()); + + final LicenseDownloadResult cachedResult = cache.get(licenseUrl); + try { + + if (cachedResult != null) { + if (cachedResult.isPreferredFileName() == matchingUrlsOnly) { + if (organizeLicensesByDependencies) { + final FileNameEntry fileNameEntry = getLicenseFileName( + depProject, licenseUrl, license.getName(), license.getFile()); final File cachedFile = cachedResult.getFile(); final LicenseDownloadResult byDepsResult; final File byDepsFile = fileNameEntry.getFile(); - if ( cachedResult.isSuccess() && !cachedFile.equals( byDepsFile ) ) - { - if ( ! byDepsFile.exists() ) - { - Files.copy( cachedFile.toPath(), byDepsFile.toPath() ); + if (cachedResult.isSuccess() && !cachedFile.equals(byDepsFile)) { + if (!byDepsFile.exists()) { + Files.copy(cachedFile.toPath(), byDepsFile.toPath()); } - byDepsResult = cachedResult.withFile( byDepsFile ); - } - else - { + byDepsResult = cachedResult.withFile(byDepsFile); + } else { byDepsResult = cachedResult; } - handleResult( licenseUrl, byDepsResult, depProject, license ); - } - else - { - handleResult( licenseUrl, cachedResult, depProject, license ); + handleResult(licenseUrl, byDepsResult, depProject, license); + } else { + handleResult(licenseUrl, cachedResult, depProject, license); } } - } - else - { + } else { /* No cache entry for the current URL */ final FileNameEntry fileNameEntry = - getLicenseFileName( depProject, licenseUrl, license.getName(), license.getFile() ); + getLicenseFileName(depProject, licenseUrl, license.getName(), license.getFile()); final File licenseOutputFile = fileNameEntry.getFile(); - if ( matchingUrlsOnly == fileNameEntry.isPreferred() ) - { - if ( !licenseOutputFile.exists() || forceDownload ) - { + if (matchingUrlsOnly == fileNameEntry.isPreferred()) { + if (!licenseOutputFile.exists() || forceDownload) { LicenseDownloadResult result = - licenseDownloader.downloadLicense( licenseUrl, fileNameEntry ); - if ( !organizeLicensesByDependencies && result.isSuccess() ) - { + licenseDownloader.downloadLicense(licenseUrl, fileNameEntry); + if (!organizeLicensesByDependencies && result.isSuccess()) { /* check if we can re-use an existing file that has the same content */ - final String name = preferredFileNames.getFileNameBySha1( result.getSha1() ); - if ( name != null ) - { + final String name = preferredFileNames.getFileNameBySha1(result.getSha1()); + if (name != null) { final File oldFile = result.getFile(); - if ( !oldFile.getName().equals( name ) ) - { + if (!oldFile.getName().equals(name)) { LOG.debug( - "Found preferred name '{}' by SHA1 after downloading '{}'; " - + "renaming from '{}'", - name, - licenseUrl, - oldFile.getName() ); - final File newFile = new File( licensesOutputDirectory, name ); - if ( newFile.exists() ) - { + "Found preferred name '{}' by SHA1 after downloading '{}'; " + + "renaming from '{}'", + name, + licenseUrl, + oldFile.getName()); + final File newFile = new File(licensesOutputDirectory, name); + if (newFile.exists()) { oldFile.delete(); + } else { + oldFile.renameTo(newFile); } - else - { - oldFile.renameTo( newFile ); - } - result = result.withFile( newFile ); + result = result.withFile(newFile); } } } - handleResult( licenseUrl, result, depProject, license ); - cache.put( licenseUrl, result ); - } - else if ( licenseOutputFile.exists() ) - { - final LicenseDownloadResult result = - LicenseDownloadResult.success( licenseOutputFile, - FileUtil.sha1( licenseOutputFile.toPath() ), - fileNameEntry.isPreferred() ); - handleResult( licenseUrl, result, depProject, license ); - cache.put( licenseUrl, result ); + handleResult(licenseUrl, result, depProject, license); + cache.put(licenseUrl, result); + } else if (licenseOutputFile.exists()) { + final LicenseDownloadResult result = LicenseDownloadResult.success( + licenseOutputFile, + FileUtil.sha1(licenseOutputFile.toPath()), + fileNameEntry.isPreferred()); + handleResult(licenseUrl, result, depProject, license); + cache.put(licenseUrl, result); } } } - } - catch ( URISyntaxException e ) - { - String msg = "POM for dependency " + depProject.toGavString() - + " has an invalid license URL: " + licenseUrl; - handleError( depProject, msg ); - LOG.debug( msg, e ); - } - catch ( FileNotFoundException e ) - { + } catch (URISyntaxException e) { + String msg = "POM for dependency " + depProject.toGavString() + " has an invalid license URL: " + + licenseUrl; + handleError(depProject, msg); + LOG.debug(msg, e); + } catch (FileNotFoundException e) { String msg = "POM for dependency " + depProject.toGavString() - + " has a license URL that returns file not found: " + licenseUrl; - handleError( depProject, msg ); - LOG.debug( msg, e ); - } - catch ( IOException e ) - { + + " has a license URL that returns file not found: " + licenseUrl; + handleError(depProject, msg); + LOG.debug(msg, e); + } catch (IOException e) { String msg = "Unable to retrieve license from URL '" + licenseUrl + "' for dependency '" - + depProject.toGavString() + "': " + e.getMessage(); - handleError( depProject, msg ); - LOG.debug( msg, e ); + + depProject.toGavString() + "': " + e.getMessage(); + handleError(depProject, msg); + LOG.debug(msg, e); } } licenseIndex++; } - } - private void handleResult( String licenseUrl, LicenseDownloadResult result, ProjectLicenseInfo depProject, - ProjectLicense license ) - throws MojoFailureException - { - if ( result.isSuccess() ) - { - license.setFile( result.getFile().getName() ); - } - else - { - handleError( depProject, result.getErrorMessage() ); + private void handleResult( + String licenseUrl, LicenseDownloadResult result, ProjectLicenseInfo depProject, ProjectLicense license) + throws MojoFailureException { + if (result.isSuccess()) { + license.setFile(result.getFile().getName()); + } else { + handleError(depProject, result.getErrorMessage()); } } - private void handleError( ProjectLicenseInfo depProject, String msg ) throws MojoFailureException - { - if ( depProject.isApproved() ) - { - LOG.debug( "Suppressing manually approved license issue: {}", msg ); - } - else - { - switch ( errorRemedy ) - { + private void handleError(ProjectLicenseInfo depProject, String msg) throws MojoFailureException { + if (depProject.isApproved()) { + LOG.debug("Suppressing manually approved license issue: {}", msg); + } else { + switch (errorRemedy) { case ignore: /* do nothing */ break; case warn: - LOG.warn( msg ); + LOG.warn(msg); break; case failFast: - throw new MojoFailureException( msg ); + throw new MojoFailureException(msg); case xmlOutput: - LOG.error( msg ); - depProject.addDownloaderMessage( msg ); + LOG.error(msg); + depProject.addDownloaderMessage(msg); break; default: - throw new IllegalStateException( "Unexpected value of " + ErrorRemedy.class.getName() + ": " - + errorRemedy ); + throw new IllegalStateException( + "Unexpected value of " + ErrorRemedy.class.getName() + ": " + errorRemedy); } downloadErrorCount++; } @@ -1378,8 +1270,7 @@ private void handleError( ProjectLicenseInfo depProject, String msg ) throws Moj * * @since 1.18 */ - public enum ErrorRemedy - { + public enum ErrorRemedy { /** All errors are ignored */ ignore, /** All errors are output to the log as warnings */ diff --git a/src/main/java/org/codehaus/mojo/license/AbstractFileHeaderMojo.java b/src/main/java/org/codehaus/mojo/license/AbstractFileHeaderMojo.java index fb1656e07..d7c361bf0 100644 --- a/src/main/java/org/codehaus/mojo/license/AbstractFileHeaderMojo.java +++ b/src/main/java/org/codehaus/mojo/license/AbstractFileHeaderMojo.java @@ -22,6 +22,19 @@ * #L% */ +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + import freemarker.template.Template; import org.apache.commons.lang3.StringUtils; import org.apache.maven.plugin.MojoFailureException; @@ -41,28 +54,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import java.util.Collections; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - /** * Abstract mojo for file-header operations (check, update, report,...). * * @author tchemit dev@tchemit.fr * @since 1.2 */ -public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo -{ - private static final Logger LOG = LoggerFactory.getLogger( AbstractFileHeaderMojo.class ); +public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo { + private static final Logger LOG = LoggerFactory.getLogger(AbstractFileHeaderMojo.class); // ---------------------------------------------------------------------- // Mojo Parameters @@ -75,7 +74,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.1 */ - @Parameter( property = "license.processStartTag" ) + @Parameter(property = "license.processStartTag") private String processStartTag; /** @@ -85,7 +84,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.1 */ - @Parameter( property = "license.processEndTag" ) + @Parameter(property = "license.processEndTag") private String processEndTag; /** @@ -95,7 +94,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.1 */ - @Parameter( property = "license.sectionDelimiter" ) + @Parameter(property = "license.sectionDelimiter") private String sectionDelimiter; /** @@ -103,7 +102,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * If not set, will use system property {@code line.separator}. */ - @Parameter( property = "license.lineSeparator" ) + @Parameter(property = "license.lineSeparator") private String lineSeparator; /** @@ -117,7 +116,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.0 */ - @Parameter( property = "license.addSvnKeyWords", defaultValue = "false" ) + @Parameter(property = "license.addSvnKeyWords", defaultValue = "false") private boolean addSvnKeyWords; /** @@ -128,7 +127,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.0 */ - @Parameter( property = "license.canUpdateDescription", defaultValue = "false" ) + @Parameter(property = "license.canUpdateDescription", defaultValue = "false") private boolean canUpdateDescription; /** @@ -139,7 +138,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.0 */ - @Parameter( property = "license.canUpdateCopyright", defaultValue = "false" ) + @Parameter(property = "license.canUpdateCopyright", defaultValue = "false") private boolean canUpdateCopyright; /** @@ -150,7 +149,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.0 */ - @Parameter( property = "license.canUpdateLicense", defaultValue = "true" ) + @Parameter(property = "license.canUpdateLicense", defaultValue = "true") private boolean canUpdateLicense; /** @@ -162,7 +161,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.0 */ - @Parameter( property = "license.ignoreTag" ) + @Parameter(property = "license.ignoreTag") private String ignoreTag; /** @@ -174,7 +173,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.2 */ - @Parameter( property = "license.addJavaLicenseAfterPackage", defaultValue = "true" ) + @Parameter(property = "license.addJavaLicenseAfterPackage", defaultValue = "true") private boolean addJavaLicenseAfterPackage; /** @@ -184,7 +183,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.9 */ - @Parameter( property = "license.useJavaNoReformatCommentStartTag", defaultValue = "true" ) + @Parameter(property = "license.useJavaNoReformatCommentStartTag", defaultValue = "true") private boolean useJavaNoReformatCommentStartTag; /** @@ -197,7 +196,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.9 */ - @Parameter( property = "license.emptyLineAfterHeader", defaultValue = "false" ) + @Parameter(property = "license.emptyLineAfterHeader", defaultValue = "false") private boolean emptyLineAfterHeader; /** @@ -210,7 +209,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.14 */ - @Parameter( property = "license.trimHeaderLine", defaultValue = "false" ) + @Parameter(property = "license.trimHeaderLine", defaultValue = "false") private boolean trimHeaderLine; /** @@ -223,7 +222,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.9 */ - @Parameter( property = "license.ignoreNoFileToScan", defaultValue = "false" ) + @Parameter(property = "license.ignoreNoFileToScan", defaultValue = "false") private boolean ignoreNoFileToScan; /** @@ -240,7 +239,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.0 */ - @Parameter( property = "license.roots" ) + @Parameter(property = "license.roots") private String[] roots; /** @@ -250,7 +249,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.0 */ - @Parameter( property = "license.includes" ) + @Parameter(property = "license.includes") private String[] includes; /** @@ -263,7 +262,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.0 */ - @Parameter( property = "license.excludes" ) + @Parameter(property = "license.excludes") private String[] excludes; /** @@ -313,8 +312,9 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.1 */ - @Parameter( property = "license.descriptionTemplate", - defaultValue = "/org/codehaus/mojo/license/default-file-header-description.ftl" ) + @Parameter( + property = "license.descriptionTemplate", + defaultValue = "/org/codehaus/mojo/license/default-file-header-description.ftl") private String descriptionTemplate; // ---------------------------------------------------------------------- @@ -326,7 +326,7 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.0 */ - @Component( role = FileHeaderTransformer.class ) + @Component(role = FileHeaderTransformer.class) private Map transformers; // ---------------------------------------------------------------------- @@ -390,7 +390,6 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo */ protected abstract boolean isFailOnMissingHeader(); - /** * @return {@code true} if mojo should fails if dryRun and there is some obsolete license header, {@code false} * otherwise. @@ -402,215 +401,177 @@ public abstract class AbstractFileHeaderMojo extends AbstractLicenseNameMojo // ---------------------------------------------------------------------- @Override - public void init() throws Exception - { - if ( StringUtils.isEmpty( ignoreTag ) ) - { + public void init() throws Exception { + if (StringUtils.isEmpty(ignoreTag)) { // use default value this.ignoreTag = "%" + "%Ignore-License"; } - if ( !isDryRun() ) - { - if ( isFailOnMissingHeader() ) - { - LOG.warn( "The failOnMissingHeader has no effect if the property dryRun is not set." ); + if (!isDryRun()) { + if (isFailOnMissingHeader()) { + LOG.warn("The failOnMissingHeader has no effect if the property dryRun is not set."); } - if ( isFailOnNotUptodateHeader() ) - { - LOG.warn( "The failOnNotUptodateHeader has no effect if the property dryRun is not set." ); + if (isFailOnNotUptodateHeader()) { + LOG.warn("The failOnNotUptodateHeader has no effect if the property dryRun is not set."); } } - if ( isVerbose() ) - { + if (isVerbose()) { // print available comment styles (transformers) StringBuilder buffer = new StringBuilder(); - buffer.append( "config - available comment styles :" ); + buffer.append("config - available comment styles :"); String commentFormat = "\n * %1$s (%2$s)"; - for ( String transformerName : transformers.keySet() ) - { - FileHeaderTransformer aTransformer = getTransformer( transformers, transformerName ); - String str = String.format( commentFormat, aTransformer.getName(), aTransformer.getDescription() ); - buffer.append( str ); + for (String transformerName : transformers.keySet()) { + FileHeaderTransformer aTransformer = getTransformer(transformers, transformerName); + String str = String.format(commentFormat, aTransformer.getName(), aTransformer.getDescription()); + buffer.append(str); } - LOG.info( "{}", buffer ); + LOG.info("{}", buffer); } // set timestamp used for temporary files this.timestamp = System.nanoTime(); super.init(); - if ( roots == null || roots.length == 0 ) - { + if (roots == null || roots.length == 0) { roots = DEFAULT_ROOTS; - if ( isVerbose() ) - { - LOG.info( "Will use default roots {}", ( Object ) roots ); + if (isVerbose()) { + LOG.info("Will use default roots {}", (Object) roots); } } - if ( includes == null || includes.length == 0 ) - { + if (includes == null || includes.length == 0) { includes = DEFAULT_INCLUDES; - if ( isVerbose() ) - { - LOG.info( "Will use default includes {}", ( Object ) includes ); + if (isVerbose()) { + LOG.info("Will use default includes {}", (Object) includes); } } - if ( excludes == null || excludes.length == 0 ) - { + if (excludes == null || excludes.length == 0) { excludes = DEFAULT_EXCLUDES; - if ( isVerbose() ) - { - LOG.info( "Will use default excludes {}", ( Object ) excludes ); + if (isVerbose()) { + LOG.info("Will use default excludes {}", (Object) excludes); } } extensionToCommentStyle = new TreeMap<>(); - processStartTag = cleanHeaderConfiguration( processStartTag, FileHeaderTransformer.DEFAULT_PROCESS_START_TAG ); - if ( isVerbose() ) - { - LOG.info( "Will use processStartTag: {}", processStartTag ); + processStartTag = cleanHeaderConfiguration(processStartTag, FileHeaderTransformer.DEFAULT_PROCESS_START_TAG); + if (isVerbose()) { + LOG.info("Will use processStartTag: {}", processStartTag); } - processEndTag = cleanHeaderConfiguration( processEndTag, FileHeaderTransformer.DEFAULT_PROCESS_END_TAG ); - if ( isVerbose() ) - { - LOG.info( "Will use processEndTag: {}", processEndTag ); + processEndTag = cleanHeaderConfiguration(processEndTag, FileHeaderTransformer.DEFAULT_PROCESS_END_TAG); + if (isVerbose()) { + LOG.info("Will use processEndTag: {}", processEndTag); } - sectionDelimiter = cleanHeaderConfiguration( sectionDelimiter, - FileHeaderTransformer.DEFAULT_SECTION_DELIMITER ); - if ( isVerbose() ) - { - LOG.info( "Will use sectionDelimiter: {}", sectionDelimiter ); + sectionDelimiter = cleanHeaderConfiguration(sectionDelimiter, FileHeaderTransformer.DEFAULT_SECTION_DELIMITER); + if (isVerbose()) { + LOG.info("Will use sectionDelimiter: {}", sectionDelimiter); } // add default extensions from header transformers - for ( Map.Entry entry : transformers.entrySet() ) - { + for (Map.Entry entry : transformers.entrySet()) { String commentStyle = entry.getKey(); FileHeaderTransformer aTransformer = entry.getValue(); - aTransformer.setProcessStartTag( processStartTag ); - aTransformer.setProcessEndTag( processEndTag ); - aTransformer.setSectionDelimiter( sectionDelimiter ); - aTransformer.setEmptyLineAfterHeader( emptyLineAfterHeader ); - aTransformer.setTrimHeaderLine( trimHeaderLine ); - aTransformer.setLineSeparator( lineSeparator ); + aTransformer.setProcessStartTag(processStartTag); + aTransformer.setProcessEndTag(processEndTag); + aTransformer.setSectionDelimiter(sectionDelimiter); + aTransformer.setEmptyLineAfterHeader(emptyLineAfterHeader); + aTransformer.setTrimHeaderLine(trimHeaderLine); + aTransformer.setLineSeparator(lineSeparator); - if ( aTransformer instanceof JavaFileHeaderTransformer ) - { + if (aTransformer instanceof JavaFileHeaderTransformer) { JavaFileHeaderTransformer javaFileHeaderTransformer = (JavaFileHeaderTransformer) aTransformer; - javaFileHeaderTransformer.setAddJavaLicenseAfterPackage( addJavaLicenseAfterPackage ); - javaFileHeaderTransformer.setUseNoReformatCommentStartTag( useJavaNoReformatCommentStartTag ); + javaFileHeaderTransformer.setAddJavaLicenseAfterPackage(addJavaLicenseAfterPackage); + javaFileHeaderTransformer.setUseNoReformatCommentStartTag(useJavaNoReformatCommentStartTag); } String[] extensions = aTransformer.getDefaultAcceptedExtensions(); - for ( String extension : extensions ) - { - if ( isVerbose() ) - { - LOG.info( "Associate extension '{}' to comment style '{}'", extension, commentStyle ); + for (String extension : extensions) { + if (isVerbose()) { + LOG.info("Associate extension '{}' to comment style '{}'", extension, commentStyle); } - extensionToCommentStyle.put( extension, commentStyle ); + extensionToCommentStyle.put(extension, commentStyle); } } - if ( extraExtensions != null ) - { + if (extraExtensions != null) { // fill extra extensions for each transformer - for ( Map.Entry entry : extraExtensions.entrySet() ) - { + for (Map.Entry entry : extraExtensions.entrySet()) { String extension = entry.getKey(); - if ( extensionToCommentStyle.containsKey( extension ) ) - { + if (extensionToCommentStyle.containsKey(extension)) { // override existing extension mapping - LOG.warn( "The extension '{}' is already accepted for comment style '{}'", - extension, extensionToCommentStyle.get( extension ) ); + LOG.warn( + "The extension '{}' is already accepted for comment style '{}'", + extension, + extensionToCommentStyle.get(extension)); } String commentStyle = entry.getValue(); // check transformer exists - getTransformer( transformers, commentStyle ); - if ( isVerbose() ) - { - LOG.info( "Associate extension '{}' to comment style '{}'", extension, commentStyle ); + getTransformer(transformers, commentStyle); + if (isVerbose()) { + LOG.info("Associate extension '{}' to comment style '{}'", extension, commentStyle); } - extensionToCommentStyle.put( extension, commentStyle ); + extensionToCommentStyle.put(extension, commentStyle); } } - if ( extraFiles == null ) - { + if (extraFiles == null) { extraFiles = Collections.emptyMap(); } // get all files to treat indexed by their comment style - filesToTreatByCommentStyle = obtainFilesToProcessByCommentStyle( extraFiles, roots, includes, excludes, - extensionToCommentStyle, transformers ); + filesToTreatByCommentStyle = obtainFilesToProcessByCommentStyle( + extraFiles, roots, includes, excludes, extensionToCommentStyle, transformers); // build the description template - if ( isVerbose() ) - { - LOG.info( "Use description template: {}", descriptionTemplate ); + if (isVerbose()) { + LOG.info("Use description template: {}", descriptionTemplate); } - descriptionTemplate0 = freeMarkerHelper.getTemplate( descriptionTemplate ); + descriptionTemplate0 = freeMarkerHelper.getTemplate(descriptionTemplate); } @Override - public void doAction() throws Exception - { + public void doAction() throws Exception { long t0 = System.nanoTime(); processedFiles = new HashSet<>(); - result = new EnumMap<>( FileState.class ); + result = new EnumMap<>(FileState.class); - try - { + try { - for ( Map.Entry> commentStyleFiles : filesToTreatByCommentStyle.entrySet() ) - { + for (Map.Entry> commentStyleFiles : filesToTreatByCommentStyle.entrySet()) { String commentStyle = commentStyleFiles.getKey(); List files = commentStyleFiles.getValue(); - processCommentStyle( commentStyle, files ); + processCommentStyle(commentStyle, files); } - } - finally - { - checkResults( result ); + } finally { + checkResults(result); int nbFiles = processedFiles.size(); - if ( nbFiles == 0 && !ignoreNoFileToScan ) - { - LOG.warn( "No file to scan." ); - } - else - { - String delay = MojoHelper.convertTime( System.nanoTime() - t0 ); + if (nbFiles == 0 && !ignoreNoFileToScan) { + LOG.warn("No file to scan."); + } else { + String delay = MojoHelper.convertTime(System.nanoTime() - t0); String message = - String.format( "Scan %s file%s header done in %s.", nbFiles, nbFiles > 1 ? "s" : "", delay ); - LOG.info( message ); + String.format("Scan %s file%s header done in %s.", nbFiles, nbFiles > 1 ? "s" : "", delay); + LOG.info(message); } Set states = result.keySet(); - if ( states.size() == 1 && states.contains( FileState.uptodate ) ) - { + if (states.size() == 1 && states.contains(FileState.uptodate)) { // all files where up to date - LOG.info( "All files are up-to-date." ); - } - else - { + LOG.info("All files are up-to-date."); + } else { StringBuilder buffer = new StringBuilder(); - for ( FileState state : FileState.values() ) - { + for (FileState state : FileState.values()) { - reportType( result, state, buffer ); + reportType(result, state, buffer); } - LOG.info( buffer.toString() ); + LOG.info(buffer.toString()); } - } } @@ -625,37 +586,31 @@ public void doAction() throws Exception * @param result processed files by their status * @throws MojoFailureException if check is not ok (some file with no header or to update) */ - private void checkResults( EnumMap> result ) throws MojoFailureException - { + private void checkResults(EnumMap> result) throws MojoFailureException { Set states = result.keySet(); StringBuilder builder = new StringBuilder(); - if ( isDryRun() && isFailOnMissingHeader() && states.contains( FileState.add ) ) - { - List files = FileUtil.orderFiles( result.get( FileState.add ) ); - - builder.append( "There are " ).append( files.size() ).append( " file(s) with no header :" ); - for ( File file : files ) - { - builder.append( "\n" ).append( file ); + if (isDryRun() && isFailOnMissingHeader() && states.contains(FileState.add)) { + List files = FileUtil.orderFiles(result.get(FileState.add)); + + builder.append("There are ").append(files.size()).append(" file(s) with no header :"); + for (File file : files) { + builder.append("\n").append(file); } } - if ( isDryRun() && isFailOnNotUptodateHeader() && states.contains( FileState.update ) ) - { - List files = FileUtil.orderFiles( result.get( FileState.update ) ); + if (isDryRun() && isFailOnNotUptodateHeader() && states.contains(FileState.update)) { + List files = FileUtil.orderFiles(result.get(FileState.update)); - builder.append( "\nThere are " ).append( files.size() ).append( " file(s) with header to update:" ); - for ( File file : files ) - { - builder.append( "\n" ).append( file ); + builder.append("\nThere are ").append(files.size()).append(" file(s) with header to update:"); + for (File file : files) { + builder.append("\n").append(file); } } String message = builder.toString(); - if ( StringUtils.isNotBlank( message ) ) - { - throw new MojoFailureException( builder.toString() ); + if (StringUtils.isNotBlank(message)) { + throw new MojoFailureException(builder.toString()); } } @@ -666,58 +621,51 @@ private void checkResults( EnumMap> result ) throws MojoFai * @param filesToTreat files using this comment style to treat * @throws IOException if any IO error while processing files */ - private void processCommentStyle( String commentStyle, List filesToTreat ) throws IOException - { + private void processCommentStyle(String commentStyle, List filesToTreat) throws IOException { // obtain license from definition - License license = getLicense( getLicenseName(), true ); + License license = getLicense(getLicenseName(), true); - if ( isVerbose() ) - { - LOG.info( "Process header '{}'", commentStyle ); - LOG.info( " - using {}", license.getDescription() ); + if (isVerbose()) { + LOG.info("Process header '{}'", commentStyle); + LOG.info(" - using {}", license.getDescription()); } // use header transformer according to comment style given in header - FileHeaderTransformer transformer = getTransformer( transformers, commentStyle ); - FileHeaderProcessor processor = getFileHeaderProcessor( license, transformer ); + FileHeaderTransformer transformer = getTransformer(transformers, commentStyle); + FileHeaderProcessor processor = getFileHeaderProcessor(license, transformer); - - for ( File file : filesToTreat ) - { - processFile( processor, file ); + for (File file : filesToTreat) { + processFile(processor, file); } filesToTreat.clear(); } - private FileHeaderProcessor getFileHeaderProcessor( License license, FileHeaderTransformer transformer ) - throws IOException - { + private FileHeaderProcessor getFileHeaderProcessor(License license, FileHeaderTransformer transformer) + throws IOException { // file header to use if no header is found on a file FileHeader header = new FileHeader(); - if ( inceptionYear == null ) - { - LOG.warn( "No inceptionYear defined (will use current year)" ); + if (inceptionYear == null) { + LOG.warn("No inceptionYear defined (will use current year)"); } - Copyright copyright = getCopyright( copyrightStringFormat, getCopyrightOwners() ); - header.setCopyright( copyright ); + Copyright copyright = getCopyright(copyrightStringFormat, getCopyrightOwners()); + header.setCopyright(copyright); - String licenseContent = license.getHeaderContent( getEncoding() ); - if ( license.isHeaderContentTemplateAware() ) - { - licenseContent = processLicenseContext( licenseContent ); + String licenseContent = license.getHeaderContent(getEncoding()); + if (license.isHeaderContentTemplateAware()) { + licenseContent = processLicenseContext(licenseContent); } - header.setLicense( licenseContent ); + header.setLicense(licenseContent); UpdateFileHeaderFilter filter = new UpdateFileHeaderFilter(); - filter.setUpdateCopyright( canUpdateCopyright ); - filter.setUpdateDescription( canUpdateDescription ); - filter.setUpdateLicense( canUpdateLicense ); + filter.setUpdateCopyright(canUpdateCopyright); + filter.setUpdateDescription(canUpdateDescription); + filter.setUpdateLicense(canUpdateLicense); // update processor filter - return new FileHeaderProcessor( filter, header, transformer ); + return new FileHeaderProcessor(filter, header, transformer); } /** @@ -727,42 +675,36 @@ private FileHeaderProcessor getFileHeaderProcessor( License license, FileHeaderT * @param file original file to process * @throws IOException if any IO error while processing this file */ - private void processFile( FileHeaderProcessor processor, File file ) throws IOException - { + private void processFile(FileHeaderProcessor processor, File file) throws IOException { - if ( processedFiles.contains( file ) ) - { - LOG.info( " - skip already processed file {}", file ); + if (processedFiles.contains(file)) { + LOG.info(" - skip already processed file {}", file); return; } // output file - File processFile = new File( file.getAbsolutePath() + "_" + timestamp ); + File processFile = new File(file.getAbsolutePath() + "_" + timestamp); boolean doFinalize = false; - try - { - doFinalize = processFile( processor, file, processFile ); - } - catch ( Exception e ) - { - LOG.warn( "skip failed file: " + e.getMessage() - + ( e.getCause() == null ? "" : " Cause : " + e.getCause().getMessage() ), e ); - FileState.fail.addFile( file, result ); + try { + doFinalize = processFile(processor, file, processFile); + } catch (Exception e) { + LOG.warn( + "skip failed file: " + e.getMessage() + + (e.getCause() == null + ? "" + : " Cause : " + e.getCause().getMessage()), + e); + FileState.fail.addFile(file, result); doFinalize = false; - } - finally - { + } finally { // whatever was the result, this file is treated. - processedFiles.add( file ); + processedFiles.add(file); - if ( doFinalize ) - { - finalizeFile( file, processFile ); - } - else - { - FileUtil.deleteFile( processFile ); + if (doFinalize) { + finalizeFile(file, processFile); + } else { + FileUtil.deleteFile(processFile); } } } @@ -776,126 +718,107 @@ private void processFile( FileHeaderProcessor processor, File file ) throws IOEx * @return {@code true} if prepareProcessFile can be finalize, otherwise need to be delete * @throws java.io.IOException if any pb while treatment */ - private boolean processFile( FileHeaderProcessor processor, File file, File processFile ) throws IOException - { + private boolean processFile(FileHeaderProcessor processor, File file, File processFile) throws IOException { - if ( getLog().isDebugEnabled() ) - { - LOG.debug( " - process file {}", file ); - LOG.debug( " - will process into file {}", processFile ); + if (getLog().isDebugEnabled()) { + LOG.debug(" - process file {}", file); + LOG.debug(" - will process into file {}", processFile); } // update the file header description Map descriptionParameters = new HashMap<>(); - descriptionParameters.put( "project", getProject() ); - descriptionParameters.put( "addSvnKeyWords", addSvnKeyWords ); - descriptionParameters.put( "projectName", projectName ); - descriptionParameters.put( "inceptionYear", inceptionYear ); - descriptionParameters.put( "organizationName", organizationName ); - descriptionParameters.put( "file", file ); + descriptionParameters.put("project", getProject()); + descriptionParameters.put("addSvnKeyWords", addSvnKeyWords); + descriptionParameters.put("projectName", projectName); + descriptionParameters.put("inceptionYear", inceptionYear); + descriptionParameters.put("organizationName", organizationName); + descriptionParameters.put("file", file); - LOG.debug( "Description parameters: {}", descriptionParameters ); + LOG.debug("Description parameters: {}", descriptionParameters); - String description = freeMarkerHelper.renderTemplate( descriptionTemplate0, descriptionParameters ); - processor.updateDescription( description ); + String description = freeMarkerHelper.renderTemplate(descriptionTemplate0, descriptionParameters); + processor.updateDescription(description); - LOG.debug( "header description : " + processor.getFileHeaderDescription() ); + LOG.debug("header description : " + processor.getFileHeaderDescription()); String content; - try - { + try { // check before all that file should not be skip by the ignoreTag // this is a costy operation - //TODO-TC-20100411 We should process always from the read content not reading again from file + // TODO-TC-20100411 We should process always from the read content not reading again from file - content = FileUtil.readAsString( file, getEncoding() ); + content = FileUtil.readAsString(file, getEncoding()); - } - catch ( IOException e ) - { - throw new IOException( "Could not obtain content of file " + file ); + } catch (IOException e) { + throw new IOException("Could not obtain content of file " + file); } - //check that file is not marked to be ignored - if ( content.contains( ignoreTag ) ) - { - LOG.info( " - ignore file (detected {}) {}", ignoreTag, file ); + // check that file is not marked to be ignored + if (content.contains(ignoreTag)) { + LOG.info(" - ignore file (detected {}) {}", ignoreTag, file); - FileState.ignore.addFile( file, result ); + FileState.ignore.addFile(file, result); return false; } // process file to detect header - try - { - processor.process( content, processFile, getEncoding() ); - } - catch ( IllegalStateException e ) - { + try { + processor.process(content, processFile, getEncoding()); + } catch (IllegalStateException e) { // could not obtain existing header throw new InvalideFileHeaderException( - "Could not extract header on file " + file + " for reason " + e.getMessage() ); - } - catch ( Exception e ) - { - if ( e instanceof InvalideFileHeaderException ) - { + "Could not extract header on file " + file + " for reason " + e.getMessage()); + } catch (Exception e) { + if (e instanceof InvalideFileHeaderException) { throw (InvalideFileHeaderException) e; } - throw new IOException( "Could not process file " + file + " for reason " + e.getMessage() ); + throw new IOException("Could not process file " + file + " for reason " + e.getMessage()); } - if ( processor.isTouched() ) - { + if (processor.isTouched()) { - if ( isVerbose() ) - { - LOG.info( " - header was updated for {}", file ); + if (isVerbose()) { + LOG.info(" - header was updated for {}", file); } - if ( processor.isModified() ) - { + if (processor.isModified()) { // header content has changed // must copy back process file to file (if not dry run) - FileState.update.addFile( file, result ); + FileState.update.addFile(file, result); return true; - } - FileState.uptodate.addFile( file, result ); + FileState.uptodate.addFile(file, result); return false; } // header was not fully (or not at all) detected in file - if ( processor.isDetectHeader() ) - { + if (processor.isDetectHeader()) { // file has not a valid header (found a start process atg, but // not an ending one), can not do anything - throw new InvalideFileHeaderException( "Could not find header end on file " + file ); + throw new InvalideFileHeaderException("Could not find header end on file " + file); } // no header at all, add a new header - if ( isVerbose() ) - { - LOG.info( " - adding license header on file {}", file ); + if (isVerbose()) { + LOG.info(" - adding license header on file {}", file); } - //FIXME tchemit 20100409 xml files must add header after a xml prolog line - content = processor.addHeader( content ); + // FIXME tchemit 20100409 xml files must add header after a xml prolog line + content = processor.addHeader(content); - if ( !isDryRun() ) - { - FileUtil.printString( processFile, content, getEncoding() ); + if (!isDryRun()) { + FileUtil.printString(processFile, content, getEncoding()); } - FileState.add.addFile( file, result ); + FileState.add.addFile(file, result); return true; } @@ -908,44 +831,34 @@ private boolean processFile( FileHeaderProcessor processor, File file, File proc * @param processFile the processed file * @throws IOException if any IO error while finalizing file */ - private void finalizeFile( File file, File processFile ) throws IOException - { + private void finalizeFile(File file, File processFile) throws IOException { - if ( isKeepBackup() && !isDryRun() ) - { - File backupFile = FileUtil.getBackupFile( file ); + if (isKeepBackup() && !isDryRun()) { + File backupFile = FileUtil.getBackupFile(file); - if ( backupFile.exists() ) - { + if (backupFile.exists()) { // always delete backup file, before the renaming - FileUtil.deleteFile( backupFile ); + FileUtil.deleteFile(backupFile); } - LOG.debug( " - backup original file {}", file ); - Files.copy( file.toPath(), backupFile.toPath(), StandardCopyOption.COPY_ATTRIBUTES ); + LOG.debug(" - backup original file {}", file); + Files.copy(file.toPath(), backupFile.toPath(), StandardCopyOption.COPY_ATTRIBUTES); } - if ( isDryRun() ) - { + if (isDryRun()) { // dry run, delete temporary file - FileUtil.deleteFile( processFile ); - } - else - { - try - { + FileUtil.deleteFile(processFile); + } else { + try { // replace file with the updated one - String updatedContent = FileUtil.readAsString( processFile, getEncoding() ); - FileUtil.printString( file, updatedContent, getEncoding() ); - FileUtil.deleteFile( processFile ); - } - catch ( IOException e ) - { - LOG.warn( "Error updating {} -> {}", processFile, file, e ); + String updatedContent = FileUtil.readAsString(processFile, getEncoding()); + FileUtil.printString(file, updatedContent, getEncoding()); + FileUtil.deleteFile(processFile); + } catch (IOException e) { + LOG.warn("Error updating {} -> {}", processFile, file, e); } } } - } diff --git a/src/main/java/org/codehaus/mojo/license/AbstractLicenseMojo.java b/src/main/java/org/codehaus/mojo/license/AbstractLicenseMojo.java index a837d618e..91bfef235 100644 --- a/src/main/java/org/codehaus/mojo/license/AbstractLicenseMojo.java +++ b/src/main/java/org/codehaus/mojo/license/AbstractLicenseMojo.java @@ -22,6 +22,8 @@ * #L% */ +import java.io.File; + import org.apache.commons.lang3.StringUtils; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.AbstractMojo; @@ -34,18 +36,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; - /** * Abstract license mojo. * * @author tchemit dev@tchemit.fr * @since 1.0 */ -public abstract class AbstractLicenseMojo - extends AbstractMojo -{ - private static final Logger LOG = LoggerFactory.getLogger( AbstractLicenseMojo.class ); +public abstract class AbstractLicenseMojo extends AbstractMojo { + private static final Logger LOG = LoggerFactory.getLogger(AbstractLicenseMojo.class); // ---------------------------------------------------------------------- // Mojo Parameters @@ -59,7 +57,7 @@ public abstract class AbstractLicenseMojo * * @since 1.0 */ - @Parameter( property = "license.verbose", defaultValue = "${maven.verbose}" ) + @Parameter(property = "license.verbose", defaultValue = "${maven.verbose}") boolean verbose; /** @@ -70,7 +68,7 @@ public abstract class AbstractLicenseMojo * * @since 1.0 */ - @Parameter( property = "license.encoding", defaultValue = "${project.build.sourceEncoding}" ) + @Parameter(property = "license.encoding", defaultValue = "${project.build.sourceEncoding}") String encoding; /** @@ -78,7 +76,7 @@ public abstract class AbstractLicenseMojo * * @since 1.0 */ - @Parameter( defaultValue = "${session}", readonly = true ) + @Parameter(defaultValue = "${session}", readonly = true) MavenSession session; /** @@ -86,7 +84,7 @@ public abstract class AbstractLicenseMojo * * @since 1.0 */ - @Parameter( defaultValue = "${project}", readonly = true ) + @Parameter(defaultValue = "${project}", readonly = true) MavenProject project; // ---------------------------------------------------------------------- @@ -110,8 +108,7 @@ public abstract class AbstractLicenseMojo * * @throws Exception if any */ - protected abstract void init() - throws Exception; + protected abstract void init() throws Exception; /** * Do plugin action. @@ -124,8 +121,7 @@ protected abstract void init() * * @throws Exception if any */ - protected abstract void doAction() - throws Exception; + protected abstract void doAction() throws Exception; // ---------------------------------------------------------------------- // Mojo Implementation @@ -134,86 +130,63 @@ protected abstract void doAction() /** * {@inheritDoc} */ - public final void execute() - throws MojoExecutionException, MojoFailureException - { - try - { - if ( getLog().isDebugEnabled() ) - { + public final void execute() throws MojoExecutionException, MojoFailureException { + try { + if (getLog().isDebugEnabled()) { // always be verbose in debug mode - setVerbose( true ); + setVerbose(true); } boolean mustSkip = isSkip(); - if ( mustSkip ) - { - LOG.info( "skip flag is on, will skip goal." ); + if (mustSkip) { + LOG.info("skip flag is on, will skip goal."); return; } // check if project packaging is compatible with the mojo boolean canContinue = checkPackaging(); - if ( !canContinue ) - { - LOG.info( "The goal is skip due to packaging '{}'", getProject().getPackaging() ); + if (!canContinue) { + LOG.info("The goal is skip due to packaging '{}'", getProject().getPackaging()); return; } // init the mojo - try - { + try { checkEncoding(); init(); - } - catch ( MojoFailureException e ) - { + } catch (MojoFailureException e) { throw e; - } - catch ( MojoExecutionException e ) - { + } catch (MojoExecutionException e) { throw e; - } - catch ( Exception e ) - { + } catch (Exception e) { throw new MojoExecutionException( - "could not init goal " + getClass().getSimpleName() + " for reason : " + e.getMessage(), e ); + "could not init goal " + getClass().getSimpleName() + " for reason : " + e.getMessage(), e); } // check if mojo can be skipped - if ( shouldSkip() ) - { - LOG.info( "All files are up to date, skip goal execution." ); + if (shouldSkip()) { + LOG.info("All files are up to date, skip goal execution."); return; } // can really execute the mojo - try - { + try { doAction(); - } - catch ( MojoFailureException e ) - { + } catch (MojoFailureException e) { throw e; - } - catch ( MojoExecutionException e ) - { + } catch (MojoExecutionException e) { throw e; - } - catch ( Exception e ) - { + } catch (Exception e) { throw new MojoExecutionException( - "could not execute goal " + getClass().getSimpleName() + " for reason : " + e.getMessage(), e ); + "could not execute goal " + getClass().getSimpleName() + " for reason : " + e.getMessage(), e); } - } - finally - { + } finally { afterExecute(); } } @@ -225,8 +198,7 @@ public final void execute() /** * @return the enconding used to read and write files. */ - public final String getEncoding() - { + public final String getEncoding() { return encoding; } @@ -235,24 +207,21 @@ public final String getEncoding() * * @param encoding new encodnignt ing to use */ - public final void setEncoding( String encoding ) - { + public final void setEncoding(String encoding) { this.encoding = encoding; } /** * @return the current maven project */ - public final MavenProject getProject() - { + public final MavenProject getProject() { return project; } /** * @return {@code true} if verbose flag is on, {@code false} otherwise */ - public final boolean isVerbose() - { + public final boolean isVerbose() { return verbose; } @@ -261,16 +230,14 @@ public final boolean isVerbose() * * @param verbose new value to set */ - public final void setVerbose( boolean verbose ) - { + public final void setVerbose(boolean verbose) { this.verbose = verbose; } /** * @return the {@link MavenSession}. */ - public final MavenSession getSession() - { + public final MavenSession getSession() { return session; } @@ -281,8 +248,7 @@ public final MavenSession getSession() /** * A call back to execute after the {@link #execute()} is done. */ - protected void afterExecute() - { + protected void afterExecute() { // by default do nothing } @@ -305,8 +271,7 @@ protected void afterExecute() * @return {@code true} if can execute the goal for the packaging of the * project, {@code false} otherwise. */ - protected boolean checkPackaging() - { + protected boolean checkPackaging() { // by default, accept every type of packaging return true; } @@ -316,8 +281,7 @@ protected boolean checkPackaging() * * @return {@code true} if the mojo should not be executed. */ - protected boolean shouldSkip() - { + protected boolean shouldSkip() { // by default, never skip goal return false; } @@ -328,14 +292,11 @@ protected boolean shouldSkip() * @param packages the accepted packaging * @return {@code true} if the project's packaging is one of the given ones. */ - protected boolean acceptPackaging( String... packages ) - { + protected boolean acceptPackaging(String... packages) { String projectPackaging = getProject().getPackaging(); - for ( String p : packages ) - { - if ( p.equals( projectPackaging ) ) - { + for (String p : packages) { + if (p.equals(projectPackaging)) { // accept packaging return true; } @@ -350,14 +311,11 @@ protected boolean acceptPackaging( String... packages ) * @param packages the rejecting packagings * @return {@code true} if the project's packaging is not in the given ones. */ - protected boolean rejectPackaging( String... packages ) - { + protected boolean rejectPackaging(String... packages) { String projectPackaging = getProject().getPackaging(); - for ( String p : packages ) - { - if ( p.equals( projectPackaging ) ) - { + for (String p : packages) { + if (p.equals(projectPackaging)) { // reject this packaging return false; } @@ -372,18 +330,16 @@ protected boolean rejectPackaging( String... packages ) * If no encoding was filled, then use the default for system * (via {@code file.encoding} environement property). */ - protected void checkEncoding() - { + protected void checkEncoding() { - if ( isVerbose() ) - { - LOG.info( "Will check encoding: {}", getEncoding() ); + if (isVerbose()) { + LOG.info("Will check encoding: {}", getEncoding()); } - if ( StringUtils.isEmpty( getEncoding() ) ) - { - LOG.warn( "File encoding has not been set, using platform encoding {}, i.e. build is platform dependent!", - ReaderFactory.FILE_ENCODING ); - setEncoding( ReaderFactory.FILE_ENCODING ); + if (StringUtils.isEmpty(getEncoding())) { + LOG.warn( + "File encoding has not been set, using platform encoding {}, i.e. build is platform dependent!", + ReaderFactory.FILE_ENCODING); + setEncoding(ReaderFactory.FILE_ENCODING); } } @@ -394,21 +350,17 @@ protected void checkEncoding() * @param dir the new resource location to add * @param includes files to include */ - protected void addResourceDir( File dir, String... includes ) - { - boolean added = MojoHelper.addResourceDir( dir, getProject(), includes ); - if ( added && isVerbose() ) - { - LOG.info( "add resource {} with includes {}", dir, ( Object ) includes ); + protected void addResourceDir(File dir, String... includes) { + boolean added = MojoHelper.addResourceDir(dir, getProject(), includes); + if (added && isVerbose()) { + LOG.info("add resource {} with includes {}", dir, (Object) includes); } } /** * @return {@code true} if project is not a pom, {@code false} otherwise. */ - protected boolean hasClassPath() - { - return rejectPackaging( "pom" ); + protected boolean hasClassPath() { + return rejectPackaging("pom"); } - } diff --git a/src/main/java/org/codehaus/mojo/license/AbstractLicenseNameMojo.java b/src/main/java/org/codehaus/mojo/license/AbstractLicenseNameMojo.java index c8cac0653..56e9ef61c 100644 --- a/src/main/java/org/codehaus/mojo/license/AbstractLicenseNameMojo.java +++ b/src/main/java/org/codehaus/mojo/license/AbstractLicenseNameMojo.java @@ -22,18 +22,6 @@ * #L% */ -import org.apache.commons.lang3.StringUtils; -import org.apache.maven.plugins.annotations.Parameter; -import org.codehaus.mojo.license.api.FreeMarkerHelper; -import org.codehaus.mojo.license.header.transformer.FileHeaderTransformer; -import org.codehaus.mojo.license.model.Copyright; -import org.codehaus.mojo.license.model.License; -import org.codehaus.mojo.license.model.LicenseStore; -import org.codehaus.plexus.util.DirectoryScanner; -import org.codehaus.plexus.util.FileUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -46,6 +34,18 @@ import java.util.Properties; import java.util.Set; +import org.apache.commons.lang3.StringUtils; +import org.apache.maven.plugins.annotations.Parameter; +import org.codehaus.mojo.license.api.FreeMarkerHelper; +import org.codehaus.mojo.license.header.transformer.FileHeaderTransformer; +import org.codehaus.mojo.license.model.Copyright; +import org.codehaus.mojo.license.model.License; +import org.codehaus.mojo.license.model.LicenseStore; +import org.codehaus.plexus.util.DirectoryScanner; +import org.codehaus.plexus.util.FileUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * Abstract mojo which using a {@link #licenseName} and owns a * {@link #licenseStore}. @@ -53,25 +53,35 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public abstract class AbstractLicenseNameMojo - extends AbstractLicenseMojo -{ - private static final Logger LOG = LoggerFactory.getLogger( AbstractLicenseNameMojo.class ); +public abstract class AbstractLicenseNameMojo extends AbstractLicenseMojo { + private static final Logger LOG = LoggerFactory.getLogger(AbstractLicenseNameMojo.class); // ---------------------------------------------------------------------- // Constants // ---------------------------------------------------------------------- - protected static final String[] DEFAULT_INCLUDES = new String[]{"**/*"}; - - protected static final String[] DEFAULT_EXCLUDES = - new String[]{"**/*.zargo", "**/*.uml", "**/*.umldi", "**/*.xmi", /* modelisation */ - "**/*.img", "**/*.png", "**/*.jpg", "**/*.jpeg", "**/*.gif", /* images */ - "**/*.zip", "**/*.jar", "**/*.war", "**/*.ear", "**/*.tgz", "**/*.gz"}; + protected static final String[] DEFAULT_INCLUDES = new String[] {"**/*"}; + + protected static final String[] DEFAULT_EXCLUDES = new String[] { + "**/*.zargo", + "**/*.uml", + "**/*.umldi", + "**/*.xmi", /* modelisation */ + "**/*.img", + "**/*.png", + "**/*.jpg", + "**/*.jpeg", + "**/*.gif", /* images */ + "**/*.zip", + "**/*.jar", + "**/*.war", + "**/*.ear", + "**/*.tgz", + "**/*.gz" + }; protected static final String[] DEFAULT_ROOTS = - new String[]{"src", "target/generated-sources", "target/processed-sources"}; - + new String[] {"src", "target/generated-sources", "target/processed-sources"}; // ---------------------------------------------------------------------- // Mojo Parameters @@ -88,7 +98,7 @@ public abstract class AbstractLicenseNameMojo * * @since 1.0 */ - @Parameter( property = "license.licenseResolver" ) + @Parameter(property = "license.licenseResolver") private String licenseResolver; /** @@ -96,7 +106,7 @@ public abstract class AbstractLicenseNameMojo * * @since 1.0 */ - @Parameter( property = "license.keepBackup", defaultValue = "false" ) + @Parameter(property = "license.keepBackup", defaultValue = "false") private boolean keepBackup; /** @@ -105,7 +115,7 @@ public abstract class AbstractLicenseNameMojo * @parameter property="license.licenseName" * @since 1.0 */ - @Parameter( property = "license.licenseName" ) + @Parameter(property = "license.licenseName") private String licenseName; /** @@ -115,7 +125,7 @@ public abstract class AbstractLicenseNameMojo * * @since 1.0 */ - @Parameter( property = "license.projectName", defaultValue = "${project.name}", required = true ) + @Parameter(property = "license.projectName", defaultValue = "${project.name}", required = true) protected String projectName; /** @@ -125,7 +135,7 @@ public abstract class AbstractLicenseNameMojo * * @since 1.0 */ - @Parameter( property = "license.organizationName", defaultValue = "${project.organization.name}", required = true ) + @Parameter(property = "license.organizationName", defaultValue = "${project.organization.name}", required = true) protected String organizationName; /** @@ -135,7 +145,7 @@ public abstract class AbstractLicenseNameMojo * * @since 1.0 */ - @Parameter( property = "license.inceptionYear", defaultValue = "${project.inceptionYear}", required = true ) + @Parameter(property = "license.inceptionYear", defaultValue = "${project.inceptionYear}", required = true) protected Integer inceptionYear; /** @@ -145,7 +155,7 @@ public abstract class AbstractLicenseNameMojo * * @since 1.6 */ - @Parameter( property = "license.copyrightOwners" ) + @Parameter(property = "license.copyrightOwners") protected String copyrightOwners; /** @@ -156,7 +166,7 @@ public abstract class AbstractLicenseNameMojo * * @since 2.1.0 */ - @Parameter( property = "license.copyrightStringFormat" ) + @Parameter(property = "license.copyrightStringFormat") protected String copyrightStringFormat; /** @@ -192,18 +202,15 @@ public abstract class AbstractLicenseNameMojo * {@inheritDoc} */ @Override - protected void init() - throws Exception - { + protected void init() throws Exception { // init licenses store - licenseStore = LicenseStore.createLicenseStore( licenseResolver ); + licenseStore = LicenseStore.createLicenseStore(licenseResolver); // check licenseName exists - license = getLicense( licenseName, true ); + license = getLicense(licenseName, true); - if ( StringUtils.isBlank( copyrightOwners ) ) - { + if (StringUtils.isBlank(copyrightOwners)) { copyrightOwners = organizationName; } } @@ -212,76 +219,64 @@ protected void init() // Protected Methods // ---------------------------------------------------------------------- - protected License getLicense( String licenseName, boolean checkIfExists ) - { - if ( StringUtils.isEmpty( licenseName ) ) - { - throw new IllegalArgumentException( "licenseName can not be null, nor empty" ); + protected License getLicense(String licenseName, boolean checkIfExists) { + if (StringUtils.isEmpty(licenseName)) { + throw new IllegalArgumentException("licenseName can not be null, nor empty"); } - if ( licenseStore == null ) - { - throw new IllegalStateException( "No license store initialized!" ); + if (licenseStore == null) { + throw new IllegalStateException("No license store initialized!"); } - License result = licenseStore.getLicense( licenseName ); - if ( checkIfExists && result == null ) - { - throw new IllegalArgumentException( "License named '" + licenseName + "' is unknown, use one of " - + Arrays.toString( licenseStore.getLicenseNames() ) ); + License result = licenseStore.getLicense(licenseName); + if (checkIfExists && result == null) { + throw new IllegalArgumentException("License named '" + licenseName + "' is unknown, use one of " + + Arrays.toString(licenseStore.getLicenseNames())); } return result; } - protected boolean isKeepBackup() - { + protected boolean isKeepBackup() { return keepBackup; } - protected String getLicenseName() - { + protected String getLicenseName() { return licenseName; } - protected License getLicense() - { + protected License getLicense() { return license; } - protected String getCopyrightOwners() - { + protected String getCopyrightOwners() { String holder = copyrightOwners; - if ( holder == null ) - { + if (holder == null) { holder = organizationName; } return holder; } - protected String processLicenseContext( String licenseContent ) - throws IOException - { - FreeMarkerHelper licenseFreeMarkerHelper = FreeMarkerHelper.newHelperFromContent( licenseContent ); + protected String processLicenseContext(String licenseContent) throws IOException { + FreeMarkerHelper licenseFreeMarkerHelper = FreeMarkerHelper.newHelperFromContent(licenseContent); Map templateParameters = new HashMap<>(); - addPropertiesToContext( System.getProperties(), "env_", templateParameters ); - addPropertiesToContext( getProject().getProperties(), "project_", templateParameters ); + addPropertiesToContext(System.getProperties(), "env_", templateParameters); + addPropertiesToContext(getProject().getProperties(), "project_", templateParameters); - templateParameters.put( "project", getProject().getModel() ); + templateParameters.put("project", getProject().getModel()); - templateParameters.put( "organizationName", organizationName ); - templateParameters.put( "inceptionYear", inceptionYear ); - templateParameters.put( "copyright", getCopyright( copyrightStringFormat, getCopyrightOwners() ) ); - templateParameters.put( "projectName", projectName ); + templateParameters.put("organizationName", organizationName); + templateParameters.put("inceptionYear", inceptionYear); + templateParameters.put("copyright", getCopyright(copyrightStringFormat, getCopyrightOwners())); + templateParameters.put("projectName", projectName); - addPropertiesToContext( extraTemplateParameters, "extra_", templateParameters ); - return licenseFreeMarkerHelper.renderTemplate( FreeMarkerHelper.TEMPLATE, templateParameters ); + addPropertiesToContext(extraTemplateParameters, "extra_", templateParameters); + return licenseFreeMarkerHelper.renderTemplate(FreeMarkerHelper.TEMPLATE, templateParameters); } - Copyright getCopyright( String copyrightStringFormat, String holder ) - { - return Copyright.newCopyright( copyrightStringFormat, inceptionYear, holder ); + Copyright getCopyright(String copyrightStringFormat, String holder) { + return Copyright.newCopyright(copyrightStringFormat, inceptionYear, holder); } /** @@ -292,52 +287,46 @@ Copyright getCopyright( String copyrightStringFormat, String holder ) * @param roots root directories to treat * @param files cache of file detected indexed by their root directory */ - void getFilesToTreatForRoots( String[] includes, String[] excludes, List roots, Map files ) - { + void getFilesToTreatForRoots(String[] includes, String[] excludes, List roots, Map files) { DirectoryScanner ds = new DirectoryScanner(); - ds.setIncludes( includes ); - if ( excludes != null ) - { - ds.setExcludes( excludes ); + ds.setIncludes(includes); + if (excludes != null) { + ds.setExcludes(excludes); } - for ( String src : roots ) - { + for (String src : roots) { - File f = new File( src ); - if ( !f.exists() ) - { + File f = new File(src); + if (!f.exists()) { // do nothing on a non-existent continue; } - LOG.debug( "discovering source files in {}", src ); + LOG.debug("discovering source files in {}", src); - ds.setBasedir( f ); + ds.setBasedir(f); // scan ds.scan(); // get files String[] tmp = ds.getIncludedFiles(); - if ( tmp.length < 1 ) - { + if (tmp.length < 1) { // no files found continue; } List toTreate = new ArrayList<>(); - Collections.addAll( toTreate, tmp ); + Collections.addAll(toTreate, tmp); - if ( toTreate.isEmpty() ) - { + if (toTreate.isEmpty()) { // no file or all are up-to-date continue; } // register files - files.put( f, toTreate.toArray( new String[toTreate.size()] ) ); + files.put(f, toTreate.toArray(new String[toTreate.size()])); } } @@ -348,20 +337,16 @@ void getFilesToTreatForRoots( String[] includes, String[] excludes, List * @param defaultValue the default value to use if value is empty * @return the trim value (or default value if value is empty) */ - String cleanHeaderConfiguration( String value, String defaultValue ) - { + String cleanHeaderConfiguration(String value, String defaultValue) { String resultHeader; - if ( StringUtils.isEmpty( value ) ) - { + if (StringUtils.isEmpty(value)) { // use default value resultHeader = defaultValue; - } - else - { + } else { // clean all spaces of it - resultHeader = value.replaceAll( "\\s", "" ); + resultHeader = value.replaceAll("\\s", ""); } return resultHeader; } @@ -372,21 +357,17 @@ String cleanHeaderConfiguration( String value, String defaultValue ) * @param transformerName the name of the transformer to find * @return the transformer for the givne tramsformer name */ - FileHeaderTransformer getTransformer( Map transformers, String transformerName ) - { - if ( StringUtils.isEmpty( transformerName ) ) - { - throw new IllegalArgumentException( "transformerName can not be null, nor empty!" ); + FileHeaderTransformer getTransformer(Map transformers, String transformerName) { + if (StringUtils.isEmpty(transformerName)) { + throw new IllegalArgumentException("transformerName can not be null, nor empty!"); } - if ( transformers == null ) - { - throw new IllegalStateException( "No transformers initialized!" ); + if (transformers == null) { + throw new IllegalStateException("No transformers initialized!"); } - FileHeaderTransformer transformer = transformers.get( transformerName ); - if ( transformer == null ) - { + FileHeaderTransformer transformer = transformers.get(transformerName); + if (transformer == null) { throw new IllegalArgumentException( - "transformerName " + transformerName + " is unknow, use one this one : " + transformers.keySet() ); + "transformerName " + transformerName + " is unknow, use one this one : " + transformers.keySet()); } return transformer; } @@ -397,41 +378,32 @@ FileHeaderTransformer getTransformer( Map transfo * @param state state of file to report * @param buffer where to report */ - void reportType( EnumMap> result, FileState state, StringBuilder buffer ) - { + void reportType(EnumMap> result, FileState state, StringBuilder buffer) { String operation = state.name(); - Set set = getFiles( result, state ); - if ( set == null || set.isEmpty() ) - { - if ( isVerbose() ) - { - buffer.append( "\n * no header to " ); - buffer.append( operation ); - buffer.append( "." ); + Set set = getFiles(result, state); + if (set == null || set.isEmpty()) { + if (isVerbose()) { + buffer.append("\n * no header to "); + buffer.append(operation); + buffer.append("."); } return; } - buffer.append( "\n * " ).append( operation ).append( " header on " ); - buffer.append( set.size() ); - if ( set.size() == 1 ) - { - buffer.append( " file." ); - } - else - { - buffer.append( " files." ); + buffer.append("\n * ").append(operation).append(" header on "); + buffer.append(set.size()); + if (set.size() == 1) { + buffer.append(" file."); + } else { + buffer.append(" files."); } - if ( isVerbose() ) - { - for ( File file : set ) - { - buffer.append( "\n - " ).append( file ); + if (isVerbose()) { + for (File file : set) { + buffer.append("\n - ").append(file); } } } - /** * Gets all files to process indexed by their comment style. * @@ -443,79 +415,69 @@ void reportType( EnumMap> result, FileState state, StringBu * @param extensionToCommentStyle * @param transformers */ - Map> obtainFilesToProcessByCommentStyle( Map extraFiles, String[] roots, - String[] includes, String[] excludes, Map extensionToCommentStyle, Map transformers ) - { + Map> obtainFilesToProcessByCommentStyle( + Map extraFiles, + String[] roots, + String[] includes, + String[] excludes, + Map extensionToCommentStyle, + Map transformers) { Map> results = new HashMap<>(); // add for all known comment style (says transformer) a empty list // this permits not to have to test if there is an already list each time // we wants to add a new file... - for ( String commentStyle : transformers.keySet() ) - { - results.put( commentStyle, new ArrayList() ); + for (String commentStyle : transformers.keySet()) { + results.put(commentStyle, new ArrayList()); } - List rootsList = new ArrayList<>( roots.length ); - for ( String root : roots ) - { - File f = new File( root ); - if ( f.isAbsolute() ) - { - rootsList.add( f.getAbsolutePath() ); - } - else - { - f = new File( getProject().getBasedir(), root ); + List rootsList = new ArrayList<>(roots.length); + for (String root : roots) { + File f = new File(root); + if (f.isAbsolute()) { + rootsList.add(f.getAbsolutePath()); + } else { + f = new File(getProject().getBasedir(), root); } - if ( f.exists() ) - { - LOG.info( "Will search files to update from root {}", f ); - rootsList.add( f.getAbsolutePath() ); - } - else - { - if ( isVerbose() ) - { - LOG.info( "Skip not found root {}", f ); + if (f.exists()) { + LOG.info("Will search files to update from root {}", f); + rootsList.add(f.getAbsolutePath()); + } else { + if (isVerbose()) { + LOG.info("Skip not found root {}", f); } } } // Obtain all files to treat Map allFiles = new HashMap<>(); - getFilesToTreatForRoots( includes, excludes, rootsList, allFiles ); + getFilesToTreatForRoots(includes, excludes, rootsList, allFiles); // filter all these files according to their extension - for ( Map.Entry entry : allFiles.entrySet() ) - { + for (Map.Entry entry : allFiles.entrySet()) { File root = entry.getKey(); String[] filesPath = entry.getValue(); // sort them by the associated comment style to their extension - for ( String path : filesPath ) - { - String extension = FileUtils.extension( path ); - String commentStyle = extensionToCommentStyle.get( extension ); - if ( StringUtils.isEmpty( commentStyle ) ) - { + for (String path : filesPath) { + String extension = FileUtils.extension(path); + String commentStyle = extensionToCommentStyle.get(extension); + if (StringUtils.isEmpty(commentStyle)) { // unknown extension, try with extra files - File file = new File( root, path ); - commentStyle = extraFiles.get( file.getName() ); - if ( StringUtils.isEmpty( commentStyle ) ) - { + File file = new File(root, path); + commentStyle = extraFiles.get(file.getName()); + if (StringUtils.isEmpty(commentStyle)) { // do not treat this file continue; } } // - File file = new File( root, path ); - List files = results.get( commentStyle ); - files.add( file ); + File file = new File(root, path); + List files = results.get(commentStyle); + files.add(file); } } return results; @@ -527,32 +489,26 @@ Map> obtainFilesToProcessByCommentStyle( Map * @param state state of files to get * @return all files of the given state */ - private Set getFiles( EnumMap> result, FileState state ) - { - return result.get( state ); + private Set getFiles(EnumMap> result, FileState state) { + return result.get(state); } - // ---------------------------------------------------------------------- // Private Methods // ---------------------------------------------------------------------- - private void addPropertiesToContext( Properties properties, String prefix, Map context ) - { - @SuppressWarnings( { "rawtypes", "unchecked" } ) + private void addPropertiesToContext(Properties properties, String prefix, Map context) { + @SuppressWarnings({"rawtypes", "unchecked"}) Map cast = (Map) properties; - addPropertiesToContext( cast, prefix, context ); + addPropertiesToContext(cast, prefix, context); } - private void addPropertiesToContext( Map properties, String prefix, Map context ) - { - if ( properties != null ) - { - for ( Object o : properties.keySet() ) - { + private void addPropertiesToContext(Map properties, String prefix, Map context) { + if (properties != null) { + for (Object o : properties.keySet()) { String nextKey = (String) o; - Object nextValue = properties.get( nextKey ); - context.put( prefix + nextKey, nextValue.toString() ); + Object nextValue = properties.get(nextKey); + context.put(prefix + nextKey, nextValue.toString()); } } } diff --git a/src/main/java/org/codehaus/mojo/license/AbstractLicenseReportRenderer.java b/src/main/java/org/codehaus/mojo/license/AbstractLicenseReportRenderer.java index d8c7211f5..af52f2805 100644 --- a/src/main/java/org/codehaus/mojo/license/AbstractLicenseReportRenderer.java +++ b/src/main/java/org/codehaus/mojo/license/AbstractLicenseReportRenderer.java @@ -22,26 +22,24 @@ * #L% */ +import java.util.Collection; +import java.util.Locale; + import org.apache.maven.artifact.ArtifactUtils; import org.apache.maven.doxia.sink.Sink; -import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet; import org.apache.maven.doxia.sink.SinkEventAttributes; +import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet; import org.apache.maven.reporting.AbstractMavenReportRenderer; import org.codehaus.mojo.license.api.ThirdPartyDetails; import org.codehaus.plexus.i18n.I18N; -import java.util.Collection; -import java.util.Locale; - /** * Base class for report renderers. * * @author tchemit dev@tchemit.fr * @since 1.1 */ -public abstract class AbstractLicenseReportRenderer - extends AbstractMavenReportRenderer -{ +public abstract class AbstractLicenseReportRenderer extends AbstractMavenReportRenderer { /** * Internationalization component. * @@ -63,10 +61,9 @@ public abstract class AbstractLicenseReportRenderer */ protected final String bundleName; - public AbstractLicenseReportRenderer( org.apache.maven.doxia.sink.Sink sink, String bundleName, I18N i18n, - Locale locale ) - { - super( sink ); + public AbstractLicenseReportRenderer( + org.apache.maven.doxia.sink.Sink sink, String bundleName, I18N i18n, Locale locale) { + super(sink); this.bundleName = bundleName; this.i18n = i18n; this.locale = locale; @@ -75,9 +72,8 @@ public AbstractLicenseReportRenderer( org.apache.maven.doxia.sink.Sink sink, Str /** * {@inheritDoc} */ - public String getTitle() - { - return getText( "report.title" ); + public String getTitle() { + return getText("report.title"); } /** @@ -86,371 +82,301 @@ public String getTitle() * @param key the message key. * @return the message. */ - public String getText( String key ) - { - return i18n.getString( bundleName, locale, key ); + public String getText(String key) { + return i18n.getString(bundleName, locale, key); } - protected void renderWarningIcon() - { + protected void renderWarningIcon() { sink.figure(); - sink.figureGraphics( "images/icon_warning_sml.gif" ); + sink.figureGraphics("images/icon_warning_sml.gif"); sink.figure_(); } - protected void renderErrorIcon() - { + protected void renderErrorIcon() { sink.figure(); - sink.figureGraphics( "images/icon_error_sml.gif" ); + sink.figureGraphics("images/icon_error_sml.gif"); sink.figure_(); } - protected void renderSuccessIcon() - { + protected void renderSuccessIcon() { sink.figure(); - sink.figureGraphics( "images/icon_success_sml.gif" ); + sink.figureGraphics("images/icon_success_sml.gif"); sink.figure_(); } - protected void renderInfoIcon() - { + protected void renderInfoIcon() { sink.figure(); - sink.figureGraphics( "images/icon_info_sml.gif" ); + sink.figureGraphics("images/icon_info_sml.gif"); sink.figure_(); } - protected String getGAV( ThirdPartyDetails details ) - { - return ArtifactUtils.versionlessKey( details.getGroupId(), details.getArtifactId() ) + ":" - + details.getVersion(); + protected String getGAV(ThirdPartyDetails details) { + return ArtifactUtils.versionlessKey(details.getGroupId(), details.getArtifactId()) + ":" + details.getVersion(); } - protected void renderThirdPartySummaryTableHeader() - { - renderThirdPartySummaryTableHeader( true, true, true ); + protected void renderThirdPartySummaryTableHeader() { + renderThirdPartySummaryTableHeader(true, true, true); } - protected void renderThirdPartySummaryTableHeader( boolean includeScope, boolean includeClassifier, - boolean includeType ) - { + protected void renderThirdPartySummaryTableHeader( + boolean includeScope, boolean includeClassifier, boolean includeType) { sink.tableRow(); - sinkHeaderCellText( getText( "report.status" ) ); - sinkHeaderCellText( getText( "report.gav" ) ); -// sink.tableHeaderCell(); -// sink.text( getText( "report.artifactId" ) ); -// sink.tableHeaderCell_(); -// sink.tableHeaderCell(); -// sink.text( getText( "report.version" ) ); -// sink.tableHeaderCell_(); - if ( includeScope ) - { - sinkHeaderCellText( getText( "report.scope" ) ); + sinkHeaderCellText(getText("report.status")); + sinkHeaderCellText(getText("report.gav")); + // sink.tableHeaderCell(); + // sink.text( getText( "report.artifactId" ) ); + // sink.tableHeaderCell_(); + // sink.tableHeaderCell(); + // sink.text( getText( "report.version" ) ); + // sink.tableHeaderCell_(); + if (includeScope) { + sinkHeaderCellText(getText("report.scope")); } - if ( includeClassifier ) - { - sinkHeaderCellText( getText( "report.classifier" ) ); + if (includeClassifier) { + sinkHeaderCellText(getText("report.classifier")); } - if ( includeType ) - { - sinkHeaderCellText( getText( "report.type" ) ); + if (includeType) { + sinkHeaderCellText(getText("report.type")); } - sinkHeaderCellText( getText( "report.licenses" ) ); + sinkHeaderCellText(getText("report.licenses")); sink.tableRow_(); } - protected void renderThirdPartySummaryTableRow( ThirdPartyDetails details ) - { - renderThirdPartySummaryTableRow( details, true, true, true ); + protected void renderThirdPartySummaryTableRow(ThirdPartyDetails details) { + renderThirdPartySummaryTableRow(details, true, true, true); } - protected void sinkHeaderCellText( String text ) - { + protected void sinkHeaderCellText(String text) { sink.tableHeaderCell(); - sink.text( text ); + sink.text(text); sink.tableHeaderCell_(); } - protected void sinkHeaderCellText( String width, String text ) - { + protected void sinkHeaderCellText(String width, String text) { SinkEventAttributes attrs = new SinkEventAttributeSet(); - attrs.addAttribute( SinkEventAttributes.WIDTH, width ); + attrs.addAttribute(SinkEventAttributes.WIDTH, width); - sink.tableHeaderCell( attrs ); - sink.text( text ); + sink.tableHeaderCell(attrs); + sink.text(text); sink.tableHeaderCell_(); } - protected void sinkCellText( String width, String text ) - { + protected void sinkCellText(String width, String text) { SinkEventAttributes attrs = new SinkEventAttributeSet(); - attrs.addAttribute( SinkEventAttributes.WIDTH, width ); - sink.tableCell( attrs ); - sink.text( text ); + attrs.addAttribute(SinkEventAttributes.WIDTH, width); + sink.tableCell(attrs); + sink.text(text); sink.tableCell_(); } - protected void sinkCellText( String text ) - { + protected void sinkCellText(String text) { sink.tableCell(); - sink.text( text ); + sink.text(text); sink.tableCell_(); } - protected void renderThirdPartySummaryTableRow( ThirdPartyDetails details, boolean includeScope, - boolean includeClassifier, boolean includeType ) - { + protected void renderThirdPartySummaryTableRow( + ThirdPartyDetails details, boolean includeScope, boolean includeClassifier, boolean includeType) { sink.tableRow(); sink.tableCell(); - if ( details.hasPomLicenses() ) - { + if (details.hasPomLicenses()) { renderSuccessIcon(); - } - else if ( details.hasThirdPartyLicenses() ) - { + } else if (details.hasThirdPartyLicenses()) { renderWarningIcon(); - } - else - { + } else { renderErrorIcon(); } sink.tableCell(); - String gav = getGAV( details ); - sink.link( "#" + gav ); - sink.text( gav ); + String gav = getGAV(details); + sink.link("#" + gav); + sink.text(gav); sink.link_(); sink.tableCell_(); - if ( includeScope ) - { - sinkCellText( details.getScope() ); + if (includeScope) { + sinkCellText(details.getScope()); } - if ( includeClassifier ) - { - sinkCellText( details.getClassifier() ); + if (includeClassifier) { + sinkCellText(details.getClassifier()); } - if ( includeType ) - { - sinkCellText( details.getType() ); + if (includeType) { + sinkCellText(details.getType()); } sink.tableCell(); - if ( details.hasLicenses() ) - { + if (details.hasLicenses()) { String[] licenses = details.getLicenses(); - for ( int i = 0; i < licenses.length; i++ ) - { - if ( i > 0 ) - { + for (int i = 0; i < licenses.length; i++) { + if (i > 0) { sink.lineBreak(); } - sink.text( licenses[i] ); + sink.text(licenses[i]); } - } - else - { - sink.text( "-" ); - + } else { + sink.text("-"); } sink.tableCell_(); sink.tableRow_(); } - protected void safeBold() - { - try - { + protected void safeBold() { + try { sink.bold(); - } - catch ( NoSuchMethodError e ) - { + } catch (NoSuchMethodError e) { // ignore Maven 2.1.0 } } // CHECKSTYLE_OFF: MethodName - protected void safeBold_() - { + protected void safeBold_() { // CHECKSTYLE_ON: MethodName - try - { + try { sink.bold_(); - } - catch ( NoSuchMethodError e ) - { + } catch (NoSuchMethodError e) { // ignore Maven 2.1.0 } } - protected void safeItalic() - { - try - { + protected void safeItalic() { + try { sink.italic(); - } - catch ( NoSuchMethodError e ) - { + } catch (NoSuchMethodError e) { // ignore Maven 2.1.0 } } // CHECKSTYLE_OFF: MethodName - protected void safeItalic_() - { + protected void safeItalic_() { // CHECKSTYLE_ON: MethodName - try - { + try { sink.italic_(); - } - catch ( NoSuchMethodError e ) - { + } catch (NoSuchMethodError e) { // ignore Maven 2.1.0 } } - protected void renderThirdPartyDetailTable( ThirdPartyDetails details ) - { - renderThirdPartyDetailTable( details, true, true, true ); + protected void renderThirdPartyDetailTable(ThirdPartyDetails details) { + renderThirdPartyDetailTable(details, true, true, true); } - protected void renderThirdPartyDetailTable( ThirdPartyDetails details, boolean includeScope, - boolean includeClassifier, boolean includeType ) - { + protected void renderThirdPartyDetailTable( + ThirdPartyDetails details, boolean includeScope, boolean includeClassifier, boolean includeType) { final String cellWidth = "80%"; final String headerWidth = "20%"; sink.table(); - sink.tableRows( new int[]{ Sink.JUSTIFY_RIGHT, Sink.JUSTIFY_LEFT }, false ); + sink.tableRows(new int[] {Sink.JUSTIFY_RIGHT, Sink.JUSTIFY_LEFT}, false); sink.tableRow(); - sinkHeaderCellText( headerWidth, getText( "report.status" ) ); + sinkHeaderCellText(headerWidth, getText("report.status")); SinkEventAttributes attrs = new SinkEventAttributeSet(); - attrs.addAttribute( SinkEventAttributes.WIDTH, cellWidth ); - sink.tableCell( attrs ); - if ( details.hasPomLicenses() ) - { + attrs.addAttribute(SinkEventAttributes.WIDTH, cellWidth); + sink.tableCell(attrs); + if (details.hasPomLicenses()) { renderSuccessIcon(); sink.nonBreakingSpace(); - sink.text( getText( "report.status.licenseFromPom" ) ); - } - else if ( details.hasThirdPartyLicenses() ) - { + sink.text(getText("report.status.licenseFromPom")); + } else if (details.hasThirdPartyLicenses()) { renderWarningIcon(); sink.nonBreakingSpace(); - sink.text( getText( "report.status.licenseFromThirdParty" ) ); - } - else - { + sink.text(getText("report.status.licenseFromThirdParty")); + } else { renderErrorIcon(); sink.nonBreakingSpace(); - sink.text( getText( "report.status.noLicense" ) ); + sink.text(getText("report.status.noLicense")); } sink.tableCell_(); sink.tableRow_(); sink.tableRow(); - sinkHeaderCellText( headerWidth, getText( "report.gav" ) ); - sinkCellText( cellWidth, getGAV( details ) ); + sinkHeaderCellText(headerWidth, getText("report.gav")); + sinkCellText(cellWidth, getGAV(details)); sink.tableRow_(); - if ( includeScope ) - { + if (includeScope) { sink.tableRow(); - sinkHeaderCellText( headerWidth, getText( "report.scope" ) ); - sinkCellText( cellWidth, details.getScope() ); + sinkHeaderCellText(headerWidth, getText("report.scope")); + sinkCellText(cellWidth, details.getScope()); sink.tableRow_(); } - if ( includeClassifier ) - { + if (includeClassifier) { sink.tableRow(); - sinkHeaderCellText( headerWidth, getText( "report.classifier" ) ); - sinkCellText( cellWidth, details.getClassifier() ); + sinkHeaderCellText(headerWidth, getText("report.classifier")); + sinkCellText(cellWidth, details.getClassifier()); sink.tableRow_(); } - if ( includeType ) - { + if (includeType) { sink.tableRow(); - sinkHeaderCellText( headerWidth, getText( "report.type" ) ); - sinkCellText( cellWidth, details.getType() ); + sinkHeaderCellText(headerWidth, getText("report.type")); + sinkCellText(cellWidth, details.getType()); sink.tableRow_(); } String[] licenses = details.getLicenses(); - if ( details.hasPomLicenses() ) - { + if (details.hasPomLicenses()) { sink.tableRow(); - sinkHeaderCellText( headerWidth, getText( "report.licenses" ) ); + sinkHeaderCellText(headerWidth, getText("report.licenses")); - sink.tableCell( attrs ); - for ( int i = 0; i < licenses.length; i++ ) - { - if ( i > 0 ) - { + sink.tableCell(attrs); + for (int i = 0; i < licenses.length; i++) { + if (i > 0) { sink.lineBreak(); } - sink.text( licenses[i] ); - + sink.text(licenses[i]); } sink.tableCell_(); sink.tableRow_(); - } - else if ( details.hasThirdPartyLicenses() ) - { + } else if (details.hasThirdPartyLicenses()) { sink.tableRow(); - sinkHeaderCellText( headerWidth, getText( "report.licenses" ) ); - sink.tableCell( attrs ); - for ( int i = 0; i < licenses.length; i++ ) - { - if ( i > 0 ) - { + sinkHeaderCellText(headerWidth, getText("report.licenses")); + sink.tableCell(attrs); + for (int i = 0; i < licenses.length; i++) { + if (i > 0) { sink.lineBreak(); } - sink.text( licenses[i] ); - + sink.text(licenses[i]); } sink.tableCell_(); sink.tableRow_(); - } - else - { + } else { sink.tableRow(); - sinkHeaderCellText( headerWidth, getText( "report.licenses" ) ); - sinkCellText( cellWidth, getText( "report.no.license" ) ); + sinkHeaderCellText(headerWidth, getText("report.licenses")); + sinkCellText(cellWidth, getText("report.no.license")); sink.tableRow_(); } sink.tableRows_(); sink.table_(); } - protected void renderThirdPartySummaryTable( Collection collection ) - { - renderThirdPartySummaryTable( collection, true, true, true ); + protected void renderThirdPartySummaryTable(Collection collection) { + renderThirdPartySummaryTable(collection, true, true, true); } - protected void renderThirdPartySummaryTable( Collection collection, boolean includeScope, - boolean includeClassifier, boolean includeType ) - { + protected void renderThirdPartySummaryTable( + Collection collection, + boolean includeScope, + boolean includeClassifier, + boolean includeType) { sink.table(); - renderThirdPartySummaryTableHeader( includeScope, includeClassifier, includeType ); - for ( ThirdPartyDetails details : collection ) - { - renderThirdPartySummaryTableRow( details, includeScope, includeClassifier, includeType ); + renderThirdPartySummaryTableHeader(includeScope, includeClassifier, includeType); + for (ThirdPartyDetails details : collection) { + renderThirdPartySummaryTableRow(details, includeScope, includeClassifier, includeType); } - renderThirdPartySummaryTableHeader( includeScope, includeClassifier, includeType ); + renderThirdPartySummaryTableHeader(includeScope, includeClassifier, includeType); sink.table_(); } - protected void renderPropertySummaryTableHeader() - { + protected void renderPropertySummaryTableHeader() { sink.tableRow(); - sinkHeaderCellText( getText( "report.status" ) ); - sinkHeaderCellText( getText( "report.property" ) ); - sinkHeaderCellText( getText( "report.currentVersion" ) ); - sinkHeaderCellText( getText( "report.nextVersion" ) ); - sinkHeaderCellText( getText( "report.nextIncremental" ) ); - sinkHeaderCellText( getText( "report.nextMinor" ) ); - sinkHeaderCellText( getText( "report.nextMajor" ) ); + sinkHeaderCellText(getText("report.status")); + sinkHeaderCellText(getText("report.property")); + sinkHeaderCellText(getText("report.currentVersion")); + sinkHeaderCellText(getText("report.nextVersion")); + sinkHeaderCellText(getText("report.nextIncremental")); + sinkHeaderCellText(getText("report.nextMinor")); + sinkHeaderCellText(getText("report.nextMajor")); sink.tableRow_(); } } diff --git a/src/main/java/org/codehaus/mojo/license/AbstractLicensesXmlMojo.java b/src/main/java/org/codehaus/mojo/license/AbstractLicensesXmlMojo.java index fe0780ea6..cd20e2de2 100644 --- a/src/main/java/org/codehaus/mojo/license/AbstractLicensesXmlMojo.java +++ b/src/main/java/org/codehaus/mojo/license/AbstractLicensesXmlMojo.java @@ -22,6 +22,9 @@ * #L% */ +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.TransformerException; + import java.io.File; import java.io.IOException; import java.nio.charset.Charset; @@ -29,9 +32,6 @@ import java.nio.file.Path; import java.util.List; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerException; - import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugins.annotations.Component; @@ -49,18 +49,17 @@ * @author Peter Palaga * @since 1.19 */ -public abstract class AbstractLicensesXmlMojo - extends AbstractMojo -{ - private static final Logger LOG = LoggerFactory.getLogger( AbstractLicensesXmlMojo.class ); +public abstract class AbstractLicensesXmlMojo extends AbstractMojo { + private static final Logger LOG = LoggerFactory.getLogger(AbstractLicensesXmlMojo.class); /** * The output file containing a mapping between each dependency and it's license information. * * @since 1.0 */ - @Parameter( property = "licensesOutputFile", - defaultValue = "${project.build.directory}/generated-resources/licenses.xml" ) + @Parameter( + property = "licensesOutputFile", + defaultValue = "${project.build.directory}/generated-resources/licenses.xml") protected File licensesOutputFile; /** @@ -74,7 +73,7 @@ public abstract class AbstractLicensesXmlMojo * * @since 1.17 */ - @Parameter( property = "licensesOutputFileEol", defaultValue = "AUTODETECT" ) + @Parameter(property = "licensesOutputFileEol", defaultValue = "AUTODETECT") protected Eol licensesOutputFileEol; /** @@ -83,7 +82,7 @@ public abstract class AbstractLicensesXmlMojo * * @since 1.17 */ - @Parameter( property = "licensesOutputFileEncoding", defaultValue = "${project.build.sourceEncoding}" ) + @Parameter(property = "licensesOutputFileEncoding", defaultValue = "${project.build.sourceEncoding}") private String licensesOutputFileEncoding; /** @@ -91,7 +90,7 @@ public abstract class AbstractLicensesXmlMojo * * @since 1.0 */ - @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true ) + @Parameter(defaultValue = "${project.remoteArtifactRepositories}", readonly = true) protected List remoteRepositories; /** @@ -99,7 +98,7 @@ public abstract class AbstractLicensesXmlMojo * * @since 1.0 */ - @Parameter( defaultValue = "${project}", readonly = true ) + @Parameter(defaultValue = "${project}", readonly = true) protected MavenProject project; /** @@ -113,70 +112,55 @@ public abstract class AbstractLicensesXmlMojo private Charset charset; /** {@inheritDoc} */ - public String getEncoding() - { + public String getEncoding() { initEncoding(); return licensesOutputFileEncoding; } - Charset getCharset() - { + Charset getCharset() { initEncoding(); return charset; } - private void initEncoding() - { - if ( charset == null ) - { - if ( licensesOutputFileEncoding == null ) - { - licensesOutputFileEncoding = System.getProperty( "file.encoding" ); - LOG.warn( "Using the default system encoding for reading or writing licenses.xml file." - + " This makes your build platform dependent. You should set either" - + " project.build.sourceEncoding or licensesOutputFileEncoding" ); + private void initEncoding() { + if (charset == null) { + if (licensesOutputFileEncoding == null) { + licensesOutputFileEncoding = System.getProperty("file.encoding"); + LOG.warn("Using the default system encoding for reading or writing licenses.xml file." + + " This makes your build platform dependent. You should set either" + + " project.build.sourceEncoding or licensesOutputFileEncoding"); } - charset = Charset.forName( licensesOutputFileEncoding ); + charset = Charset.forName(licensesOutputFileEncoding); - if ( licensesOutputFileEol == Eol.AUTODETECT ) - { + if (licensesOutputFileEol == Eol.AUTODETECT) { final Path[] paths = getAutodetectEolFiles(); Path autodetectFromFile = null; - for ( Path path : paths ) - { - if ( Files.exists( path ) ) - { + for (Path path : paths) { + if (Files.exists(path)) { autodetectFromFile = path; break; } } - if ( autodetectFromFile != null ) - { - try - { - licensesOutputFileEol = Eol.autodetect( autodetectFromFile, charset ); - } - catch ( IOException e ) - { - throw new RuntimeException( "Cannot autodetect end of line from file \"" + autodetectFromFile - + "\"", e ); + if (autodetectFromFile != null) { + try { + licensesOutputFileEol = Eol.autodetect(autodetectFromFile, charset); + } catch (IOException e) { + throw new RuntimeException( + "Cannot autodetect end of line from file \"" + autodetectFromFile + "\"", e); } } } } } - protected Path[] getAutodetectEolFiles() - { - return new Path[] { licensesOutputFile.toPath() }; + protected Path[] getAutodetectEolFiles() { + return new Path[] {licensesOutputFile.toPath()}; } - protected void writeLicenseSummary( List deps, File licensesOutputFile, boolean writeVersions ) - throws ParserConfigurationException, TransformerException, IOException - { + protected void writeLicenseSummary(List deps, File licensesOutputFile, boolean writeVersions) + throws ParserConfigurationException, TransformerException, IOException { initEncoding(); - LicenseSummaryWriter.writeLicenseSummary( deps, licensesOutputFile, charset, licensesOutputFileEol, - writeVersions ); + LicenseSummaryWriter.writeLicenseSummary( + deps, licensesOutputFile, charset, licensesOutputFileEol, writeVersions); } - } diff --git a/src/main/java/org/codehaus/mojo/license/AbstractThirdPartyReportMojo.java b/src/main/java/org/codehaus/mojo/license/AbstractThirdPartyReportMojo.java index 103b2070b..9ee1082f0 100644 --- a/src/main/java/org/codehaus/mojo/license/AbstractThirdPartyReportMojo.java +++ b/src/main/java/org/codehaus/mojo/license/AbstractThirdPartyReportMojo.java @@ -22,6 +22,19 @@ * #L% */ +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.SortedMap; +import java.util.SortedSet; +import java.util.TreeSet; + import org.apache.commons.collections.CollectionUtils; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.resolver.ArtifactResolutionException; @@ -40,6 +53,7 @@ import org.codehaus.mojo.license.api.DependenciesTool; import org.codehaus.mojo.license.api.DependenciesToolException; import org.codehaus.mojo.license.api.MavenProjectDependenciesConfigurator; +import org.codehaus.mojo.license.api.ResolvedProjectDependencies; import org.codehaus.mojo.license.api.ThirdPartyDetails; import org.codehaus.mojo.license.api.ThirdPartyHelper; import org.codehaus.mojo.license.api.ThirdPartyTool; @@ -51,20 +65,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.SortedSet; -import java.util.TreeSet; -import org.codehaus.mojo.license.api.ResolvedProjectDependencies; - /** * Base class for third-party reports. * @@ -72,9 +72,8 @@ * @since 1.1 */ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport - implements MavenProjectDependenciesConfigurator -{ - private static final Logger LOG = LoggerFactory.getLogger( AbstractThirdPartyReportMojo.class ); + implements MavenProjectDependenciesConfigurator { + private static final Logger LOG = LoggerFactory.getLogger(AbstractThirdPartyReportMojo.class); // ---------------------------------------------------------------------- // Mojo Parameters @@ -85,7 +84,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.1 */ - @Parameter( property = "license.excludedScopes", defaultValue = "system" ) + @Parameter(property = "license.excludedScopes", defaultValue = "system") private String excludedScopes; /** @@ -93,7 +92,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.1 */ - @Parameter( property = "license.includedScopes" ) + @Parameter(property = "license.includedScopes") private String includedScopes; /** @@ -101,7 +100,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.15 */ - @Parameter( property = "license.excludedTypes" ) + @Parameter(property = "license.excludedTypes") private String excludedTypes; /** @@ -109,7 +108,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.15 */ - @Parameter( property = "license.includedTypes" ) + @Parameter(property = "license.includedTypes") private String includedTypes; /** @@ -117,7 +116,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.1 */ - @Parameter( property = "license.excludedGroups" ) + @Parameter(property = "license.excludedGroups") private String excludedGroups; /** @@ -125,7 +124,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.1 */ - @Parameter( property = "license.includedGroups" ) + @Parameter(property = "license.includedGroups") private String includedGroups; /** @@ -133,7 +132,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.1 */ - @Parameter( property = "license.excludedArtifacts" ) + @Parameter(property = "license.excludedArtifacts") private String excludedArtifacts; /** @@ -141,7 +140,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.1 */ - @Parameter( property = "license.includedArtifacts" ) + @Parameter(property = "license.includedArtifacts") private String includedArtifacts; /** @@ -149,7 +148,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.1 */ - @Parameter( property = "license.includeTransitiveDependencies", defaultValue = "true" ) + @Parameter(property = "license.includeTransitiveDependencies", defaultValue = "true") private boolean includeTransitiveDependencies; /** @@ -157,7 +156,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.13 */ - @Parameter( property = "license.excludeTransitiveDependencies", defaultValue = "false" ) + @Parameter(property = "license.excludeTransitiveDependencies", defaultValue = "false") private boolean excludeTransitiveDependencies; /** @@ -166,7 +165,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.19 */ - @Parameter( property = "license.includeOptional", defaultValue = "true" ) + @Parameter(property = "license.includeOptional", defaultValue = "true") boolean includeOptional; /** @@ -174,7 +173,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.1 */ - @Parameter( property = "license.useMissingFile", defaultValue = "false" ) + @Parameter(property = "license.useMissingFile", defaultValue = "false") private boolean useMissingFile; /** @@ -182,7 +181,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.1 */ - @Parameter( property = "license.missingFile", defaultValue = "src/license/THIRD-PARTY.properties" ) + @Parameter(property = "license.missingFile", defaultValue = "src/license/THIRD-PARTY.properties") private File missingFile; /** @@ -195,7 +194,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.15 */ - @Parameter( property = "license.missingFileUrl" ) + @Parameter(property = "license.missingFileUrl") String missingFileUrl; /** @@ -208,7 +207,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * @deprecated Use {@link #overrideUrl} instead */ @Deprecated - @Parameter( property = "license.overrideFile" ) + @Parameter(property = "license.overrideFile") private File overrideFile; /** @@ -224,7 +223,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.17 */ - @Parameter( property = "license.overrideUrl" ) + @Parameter(property = "license.overrideUrl") private String overrideUrl; /** @@ -239,7 +238,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.0 */ - @Parameter( property = "license.useRepositoryMissingFiles", defaultValue = "true" ) + @Parameter(property = "license.useRepositoryMissingFiles", defaultValue = "true") private boolean useRepositoryMissingFiles; /** @@ -262,13 +261,13 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport private List licenseMerges; /** - * Location of file with the merge licenses in order to be used by command line. - * Note: This option overrides {@link #licenseMerges}. - * - * @since 1.18 - */ - @Parameter( property = "license.licenseMergesUrl" ) - protected String licenseMergesUrl; + * Location of file with the merge licenses in order to be used by command line. + * Note: This option overrides {@link #licenseMerges}. + * + * @since 1.18 + */ + @Parameter(property = "license.licenseMergesUrl") + protected String licenseMergesUrl; /** * Flag to activate verbose mode. @@ -278,7 +277,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.0 */ - @Parameter( property = "license.verbose", defaultValue = "${maven.verbose}" ) + @Parameter(property = "license.verbose", defaultValue = "${maven.verbose}") private boolean verbose; /** @@ -289,7 +288,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.0 */ - @Parameter( property = "license.encoding", defaultValue = "${project.build.sourceEncoding}" ) + @Parameter(property = "license.encoding", defaultValue = "${project.build.sourceEncoding}") private String encoding; // ---------------------------------------------------------------------- @@ -337,7 +336,7 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport * * @since 1.18 */ - @Parameter( property = "license.artifactFiltersUrl" ) + @Parameter(property = "license.artifactFiltersUrl") private String artifactFiltersUrl; private ArtifactFilters artifactFilters; @@ -347,9 +346,9 @@ public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport // ---------------------------------------------------------------------- protected abstract Collection createThirdPartyDetails() - throws IOException, ThirdPartyToolException, ProjectBuildingException, MojoFailureException, - InvalidDependencyVersionException, ArtifactNotFoundException, ArtifactResolutionException, - DependenciesToolException, MojoExecutionException; + throws IOException, ThirdPartyToolException, ProjectBuildingException, MojoFailureException, + InvalidDependencyVersionException, ArtifactNotFoundException, ArtifactResolutionException, + DependenciesToolException, MojoExecutionException; // ---------------------------------------------------------------------- // AbstractMavenReport Implementation @@ -361,17 +360,14 @@ protected abstract Collection createThirdPartyDetails() * Note: The method is invoked before the {@link #executeReport()} method. * @throws IOException */ - protected void init() - throws IOException - { - if ( licenseMergesUrl != null ) - { - LOG.warn( "" ); - LOG.warn( "licenseMerges will be overridden by licenseMergesUrl." ); - LOG.warn( "" ); - if ( UrlRequester.isStringUrl( licenseMergesUrl ) ) - { - licenseMerges = Arrays.asList( UrlRequester.getFromUrl( licenseMergesUrl ).split( "[\n\r]+" ) ); + protected void init() throws IOException { + if (licenseMergesUrl != null) { + LOG.warn(""); + LOG.warn("licenseMerges will be overridden by licenseMergesUrl."); + LOG.warn(""); + if (UrlRequester.isStringUrl(licenseMergesUrl)) { + licenseMerges = + Arrays.asList(UrlRequester.getFromUrl(licenseMergesUrl).split("[\n\r]+")); } } } @@ -379,74 +375,52 @@ protected void init() /** * {@inheritDoc} */ - protected void executeReport( Locale locale ) - throws MavenReportException - { - resolvedOverrideUrl = LicenseMojoUtils.prepareThirdPartyOverrideUrl( resolvedOverrideUrl, overrideFile, - overrideUrl, project.getBasedir() ); + protected void executeReport(Locale locale) throws MavenReportException { + resolvedOverrideUrl = LicenseMojoUtils.prepareThirdPartyOverrideUrl( + resolvedOverrideUrl, overrideFile, overrideUrl, project.getBasedir()); Collection details; - try - { + try { init(); details = createThirdPartyDetails(); - } - catch ( IOException e ) - { - throw new MavenReportException( e.getMessage(), e ); - } - catch ( ThirdPartyToolException e ) - { - throw new MavenReportException( e.getMessage(), e ); - } - catch ( ProjectBuildingException e ) - { - throw new MavenReportException( e.getMessage(), e ); - } - catch ( ArtifactNotFoundException e ) - { - throw new MavenReportException( e.getMessage(), e ); - } - catch ( ArtifactResolutionException e ) - { - throw new MavenReportException( e.getMessage(), e ); - } - catch ( MojoFailureException e ) - { - throw new MavenReportException( e.getMessage(), e ); - } - catch ( DependenciesToolException e ) - { - throw new MavenReportException( e.getMessage(), e ); - } - catch ( MojoExecutionException e ) - { - throw new MavenReportException( e.getMessage(), e ); + } catch (IOException e) { + throw new MavenReportException(e.getMessage(), e); + } catch (ThirdPartyToolException e) { + throw new MavenReportException(e.getMessage(), e); + } catch (ProjectBuildingException e) { + throw new MavenReportException(e.getMessage(), e); + } catch (ArtifactNotFoundException e) { + throw new MavenReportException(e.getMessage(), e); + } catch (ArtifactResolutionException e) { + throw new MavenReportException(e.getMessage(), e); + } catch (MojoFailureException e) { + throw new MavenReportException(e.getMessage(), e); + } catch (DependenciesToolException e) { + throw new MavenReportException(e.getMessage(), e); + } catch (MojoExecutionException e) { + throw new MavenReportException(e.getMessage(), e); } ThirdPartyReportRenderer renderer = - new ThirdPartyReportRenderer( getSink(), i18n, getOutputName(), locale, details ); + new ThirdPartyReportRenderer(getSink(), i18n, getOutputName(), locale, details); renderer.render(); - } /** * {@inheritDoc} */ @Override - public String getDescription( Locale locale ) - { - return i18n.getString( getOutputName(), locale, "report.description" ); + public String getDescription(Locale locale) { + return i18n.getString(getOutputName(), locale, "report.description"); } /** * {@inheritDoc} */ @Override - public String getName( Locale locale ) - { - return i18n.getString( getOutputName(), locale, "report.title" ); + public String getName(Locale locale) { + return i18n.getString(getOutputName(), locale, "report.title"); } // ---------------------------------------------------------------------- @@ -457,8 +431,7 @@ public String getName( Locale locale ) * {@inheritDoc} */ @Override - public boolean isIncludeTransitiveDependencies() - { + public boolean isIncludeTransitiveDependencies() { return includeTransitiveDependencies; } @@ -466,20 +439,26 @@ public boolean isIncludeTransitiveDependencies() * {@inheritDoc} */ @Override - public boolean isExcludeTransitiveDependencies() - { + public boolean isExcludeTransitiveDependencies() { return excludeTransitiveDependencies; } /** {@inheritDoc} */ @Override - public ArtifactFilters getArtifactFilters() - { - if ( artifactFilters == null ) - { - artifactFilters = ArtifactFilters.of( includedGroups, excludedGroups, includedArtifacts, excludedArtifacts, - includedScopes, excludedScopes, includedTypes, excludedTypes, - includeOptional, artifactFiltersUrl , getEncoding() ); + public ArtifactFilters getArtifactFilters() { + if (artifactFilters == null) { + artifactFilters = ArtifactFilters.of( + includedGroups, + excludedGroups, + includedArtifacts, + excludedArtifacts, + includedScopes, + excludedScopes, + includedTypes, + excludedTypes, + includeOptional, + artifactFiltersUrl, + getEncoding()); } return artifactFilters; } @@ -488,8 +467,7 @@ public ArtifactFilters getArtifactFilters() * {@inheritDoc} */ @Override - public boolean isVerbose() - { + public boolean isVerbose() { return verbose; } @@ -497,97 +475,93 @@ public boolean isVerbose() // Protected Methods // ---------------------------------------------------------------------- - Collection createThirdPartyDetails( MavenProject project, boolean loadArtifacts ) - throws IOException, ThirdPartyToolException, ProjectBuildingException, MojoFailureException, - DependenciesToolException, MojoExecutionException - { + Collection createThirdPartyDetails(MavenProject project, boolean loadArtifacts) + throws IOException, ThirdPartyToolException, ProjectBuildingException, MojoFailureException, + DependenciesToolException, MojoExecutionException { ResolvedProjectDependencies loadedDependencies; - if ( loadArtifacts ) - { + if (loadArtifacts) { loadedDependencies = - new ResolvedProjectDependencies( project.getArtifacts(), project.getDependencyArtifacts() ); - } - else - { - loadedDependencies = new ResolvedProjectDependencies( getProject().getArtifacts(), - getProject().getDependencyArtifacts() ); + new ResolvedProjectDependencies(project.getArtifacts(), project.getDependencyArtifacts()); + } else { + loadedDependencies = new ResolvedProjectDependencies( + getProject().getArtifacts(), getProject().getDependencyArtifacts()); } - ThirdPartyHelper thirdPartyHelper = - new DefaultThirdPartyHelper( project, encoding, verbose, - dependenciesTool, thirdPartyTool, - project.getRemoteArtifactRepositories(), project.getRemoteProjectRepositories() ); + ThirdPartyHelper thirdPartyHelper = new DefaultThirdPartyHelper( + project, + encoding, + verbose, + dependenciesTool, + thirdPartyTool, + project.getRemoteArtifactRepositories(), + project.getRemoteProjectRepositories()); // load dependencies of the project - SortedMap projectDependencies = thirdPartyHelper.loadDependencies( this, - loadedDependencies ); + SortedMap projectDependencies = + thirdPartyHelper.loadDependencies(this, loadedDependencies); // create licenseMap from it - LicenseMap licenseMap = thirdPartyHelper.createLicenseMap( projectDependencies ); + LicenseMap licenseMap = thirdPartyHelper.createLicenseMap(projectDependencies); // Get unsafe dependencies (dependencies with no license in pom) - SortedSet dependenciesWithNoLicense = thirdPartyHelper.getProjectsWithNoLicense( licenseMap ); + SortedSet dependenciesWithNoLicense = thirdPartyHelper.getProjectsWithNoLicense(licenseMap); // compute safe dependencies (with pom licenses) - Set dependenciesWithPomLicense = - new TreeSet<>( MojoHelper.newMavenProjectComparator() ); - dependenciesWithPomLicense.addAll( projectDependencies.values() ); + Set dependenciesWithPomLicense = new TreeSet<>(MojoHelper.newMavenProjectComparator()); + dependenciesWithPomLicense.addAll(projectDependencies.values()); - if ( CollectionUtils.isNotEmpty( dependenciesWithNoLicense ) ) - { + if (CollectionUtils.isNotEmpty(dependenciesWithNoLicense)) { // there is some unsafe dependencies, remove them from safe dependencies - dependenciesWithPomLicense.removeAll( dependenciesWithNoLicense ); + dependenciesWithPomLicense.removeAll(dependenciesWithNoLicense); - if ( useMissingFile ) - { + if (useMissingFile) { // Resolve unsafe dependencies using missing files, this will update licenseMap and unsafeDependencies - thirdPartyHelper.createUnsafeMapping( licenseMap, missingFile, missingFileUrl, - useRepositoryMissingFiles, dependenciesWithNoLicense, - projectDependencies, loadedDependencies.getAllDependencies() ); + thirdPartyHelper.createUnsafeMapping( + licenseMap, + missingFile, + missingFileUrl, + useRepositoryMissingFiles, + dependenciesWithNoLicense, + projectDependencies, + loadedDependencies.getAllDependencies()); } } // LicenseMap is now complete, let's merge licenses if necessary - thirdPartyHelper.mergeLicenses( licenseMerges, licenseMap ); + thirdPartyHelper.mergeLicenses(licenseMerges, licenseMap); // Add override licenses - thirdPartyTool.overrideLicenses( licenseMap, projectDependencies, encoding, resolvedOverrideUrl ); + thirdPartyTool.overrideLicenses(licenseMap, projectDependencies, encoding, resolvedOverrideUrl); // let's build third party details for each dependencies Collection details = new ArrayList<>(); - for ( Map.Entry entry : licenseMap.toDependencyMap().entrySet() ) - { + for (Map.Entry entry : + licenseMap.toDependencyMap().entrySet()) { MavenProject dependency = entry.getKey(); String[] licenses = entry.getValue(); - ThirdPartyDetails detail = new DefaultThirdPartyDetails( dependency ); - details.add( detail ); - if ( dependenciesWithPomLicense.contains( dependency ) ) - { + ThirdPartyDetails detail = new DefaultThirdPartyDetails(dependency); + details.add(detail); + if (dependenciesWithPomLicense.contains(dependency)) { // this is a pom licenses - detail.setPomLicenses( licenses ); - } - else if ( !dependenciesWithNoLicense.contains( dependency ) ) - { + detail.setPomLicenses(licenses); + } else if (!dependenciesWithNoLicense.contains(dependency)) { // this is a third-party licenses - detail.setThirdPartyLicenses( licenses ); + detail.setThirdPartyLicenses(licenses); } } return details; } /** {@inheritDoc} */ - public String getArtifactFiltersUrl() - { + public String getArtifactFiltersUrl() { return artifactFiltersUrl; } /** {@inheritDoc} */ - public String getEncoding() - { + public String getEncoding() { return encoding; } - } diff --git a/src/main/java/org/codehaus/mojo/license/AddThirdPartyMojo.java b/src/main/java/org/codehaus/mojo/license/AddThirdPartyMojo.java index bb177f716..7a787ea4b 100644 --- a/src/main/java/org/codehaus/mojo/license/AddThirdPartyMojo.java +++ b/src/main/java/org/codehaus/mojo/license/AddThirdPartyMojo.java @@ -31,6 +31,7 @@ import java.util.Map; import java.util.SortedMap; import java.util.SortedSet; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.maven.plugin.MojoExecutionException; @@ -66,11 +67,13 @@ * @since 1.0 */ // CHECKSTYLE_ON: LineLength -@Mojo( name = "add-third-party", requiresDependencyResolution = ResolutionScope.TEST, - defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true ) -public class AddThirdPartyMojo extends AbstractAddThirdPartyMojo implements MavenProjectDependenciesConfigurator -{ - private static final Logger LOG = LoggerFactory.getLogger( AddThirdPartyMojo.class ); +@Mojo( + name = "add-third-party", + requiresDependencyResolution = ResolutionScope.TEST, + defaultPhase = LifecyclePhase.GENERATE_RESOURCES, + threadSafe = true) +public class AddThirdPartyMojo extends AbstractAddThirdPartyMojo implements MavenProjectDependenciesConfigurator { + private static final Logger LOG = LoggerFactory.getLogger(AddThirdPartyMojo.class); // ---------------------------------------------------------------------- // Mojo Parameters @@ -81,7 +84,7 @@ public class AddThirdPartyMojo extends AbstractAddThirdPartyMojo implements Mave * * @since 1.5 */ - @Parameter( property = "license.skipAddThirdParty", defaultValue = "false" ) + @Parameter(property = "license.skipAddThirdParty", defaultValue = "false") private boolean skipAddThirdParty; // ---------------------------------------------------------------------- @@ -129,8 +132,7 @@ public class AddThirdPartyMojo extends AbstractAddThirdPartyMojo implements Mave * {@inheritDoc} */ @Override - public boolean isSkip() - { + public boolean isSkip() { return skipAddThirdParty; } @@ -138,25 +140,22 @@ public boolean isSkip() * {@inheritDoc} */ @Override - protected boolean checkPackaging() - { - if ( acceptPomPackaging ) - { + protected boolean checkPackaging() { + if (acceptPomPackaging) { // rejects nothing return true; } // can reject pom packaging - return rejectPackaging( "pom" ); + return rejectPackaging("pom"); } /** * {@inheritDoc} */ @Override - protected boolean shouldSkip() - { + protected boolean shouldSkip() { return !doGenerate && !doGenerateBundle && !doGenerateMissing; } @@ -164,9 +163,7 @@ protected boolean shouldSkip() * {@inheritDoc} */ @Override - protected void doAction() - throws Exception - { + protected void doAction() throws Exception { consolidate(); @@ -174,37 +171,34 @@ protected void doAction() boolean safeLicense = checkForbiddenLicenses(); - checkBlacklist( safeLicense ); + checkBlacklist(safeLicense); writeThirdPartyFile(); - if ( doGenerateMissing ) - { + if (doGenerateMissing) { writeMissingFile(); } - boolean unsafe = CollectionUtils.isNotEmpty( unsafeDependencies ); + boolean unsafe = CollectionUtils.isNotEmpty(unsafeDependencies); - checkMissing( unsafe ); + checkMissing(unsafe); - if ( !unsafe && useMissingFile && MapUtils.isEmpty( unsafeMappings ) && missingFile.exists() ) - { + if (!unsafe && useMissingFile && MapUtils.isEmpty(unsafeMappings) && missingFile.exists()) { // there is no missing dependencies, but still a missing file, delete it - LOG.info( "There is no dependency to put in missing file, delete it at {}", missingFile ); - FileUtil.deleteFile( missingFile ); + LOG.info("There is no dependency to put in missing file, delete it at {}", missingFile); + FileUtil.deleteFile(missingFile); } - if ( !unsafe && deployMissingFile && MapUtils.isNotEmpty( unsafeMappings ) ) - { + if (!unsafe && deployMissingFile && MapUtils.isNotEmpty(unsafeMappings)) { // can deploy missing file - LOG.info( "Will attach third party file from {}", missingFile ); - getHelper().attachThirdPartyDescriptor( missingFile ); + LOG.info("Will attach third party file from {}", missingFile); + getHelper().attachThirdPartyDescriptor(missingFile); } - addResourceDir( outputDirectory, "**/*.txt" ); + addResourceDir(outputDirectory, "**/*.txt"); } // ---------------------------------------------------------------------- @@ -215,9 +209,8 @@ protected void doAction() * {@inheritDoc} */ @Override - protected SortedMap loadDependencies() throws DependenciesToolException - { - return getHelper().loadDependencies( this, resolveDependencyArtifacts() ); + protected SortedMap loadDependencies() throws DependenciesToolException { + return getHelper().loadDependencies(this, resolveDependencyArtifacts()); } /** @@ -226,21 +219,16 @@ protected SortedMap loadDependencies() throws Dependencies * @return The set of all dependencies, and the set of only direct dependency artifacts. * @throws org.codehaus.mojo.license.api.DependenciesToolException if the dependencies could not be resolved */ - protected ResolvedProjectDependencies resolveDependencyArtifacts() throws DependenciesToolException - { - if ( dependencyArtifacts != null ) - { + protected ResolvedProjectDependencies resolveDependencyArtifacts() throws DependenciesToolException { + if (dependencyArtifacts != null) { return dependencyArtifacts; } - if ( isAggregatorBuild ) - { + if (isAggregatorBuild) { dependencyArtifacts = - new ResolvedProjectDependencies( project.getArtifacts(), project.getDependencyArtifacts() ); - } - else - { - dependencyArtifacts = new ResolvedProjectDependencies( project.getArtifacts(), - project.getDependencyArtifacts() ); + new ResolvedProjectDependencies(project.getArtifacts(), project.getDependencyArtifacts()); + } else { + dependencyArtifacts = + new ResolvedProjectDependencies(project.getArtifacts(), project.getDependencyArtifacts()); } return dependencyArtifacts; } @@ -250,42 +238,39 @@ protected ResolvedProjectDependencies resolveDependencyArtifacts() throws Depend */ @Override protected SortedProperties createUnsafeMapping() - throws ProjectBuildingException, IOException, ThirdPartyToolException, - MojoExecutionException, DependenciesToolException - { - - SortedProperties unsafeMappings = - getHelper().createUnsafeMapping( licenseMap, missingFile, missingFileUrl, - useRepositoryMissingFiles, unsafeDependencies, - projectDependencies, - resolveDependencyArtifacts().getAllDependencies() ); - if ( isVerbose() ) - { - LOG.info( "found {} unsafe mappings", unsafeMappings.size() ); + throws ProjectBuildingException, IOException, ThirdPartyToolException, MojoExecutionException, + DependenciesToolException { + + SortedProperties unsafeMappings = getHelper() + .createUnsafeMapping( + licenseMap, + missingFile, + missingFileUrl, + useRepositoryMissingFiles, + unsafeDependencies, + projectDependencies, + resolveDependencyArtifacts().getAllDependencies()); + if (isVerbose()) { + LOG.info("found {} unsafe mappings", unsafeMappings.size()); } // compute if missing file should be (re)-generate - doGenerateMissing = computeDoGenerateMissingFile( unsafeMappings, unsafeDependencies ); + doGenerateMissing = computeDoGenerateMissingFile(unsafeMappings, unsafeDependencies); - if ( doGenerateMissing && isVerbose() ) - { + if (doGenerateMissing && isVerbose()) { StringBuilder sb = new StringBuilder(); - sb.append( "Will use " ); - sb.append( unsafeMappings.size() ); - sb.append( " dependencies from missingFile:" ); - for ( Map.Entry entry : unsafeMappings.entrySet() ) - { + sb.append("Will use "); + sb.append(unsafeMappings.size()); + sb.append(" dependencies from missingFile:"); + for (Map.Entry entry : unsafeMappings.entrySet()) { String id = (String) entry.getKey(); String license = (String) entry.getValue(); - sb.append( "\n - " ).append( id ).append( " - " ).append( license ); + sb.append("\n - ").append(id).append(" - ").append(license); } - LOG.info( "{}", sb ); - } - else - { - if ( useMissingFile && !unsafeMappings.isEmpty() ) - { - LOG.info( "Missing file {} is up-to-date.", missingFile ); + LOG.info("{}", sb); + } else { + if (useMissingFile && !unsafeMappings.isEmpty()) { + LOG.info("Missing file {} is up-to-date.", missingFile); } } return unsafeMappings; @@ -298,27 +283,32 @@ protected SortedProperties createUnsafeMapping() /** * {@inheritDoc} */ - public boolean isIncludeTransitiveDependencies() - { + public boolean isIncludeTransitiveDependencies() { return includeTransitiveDependencies; } /** * {@inheritDoc} */ - public boolean isExcludeTransitiveDependencies() - { + public boolean isExcludeTransitiveDependencies() { return excludeTransitiveDependencies; } /** {@inheritDoc} */ - public ArtifactFilters getArtifactFilters() - { - if ( artifactFilters == null ) - { - artifactFilters = ArtifactFilters.of( includedGroups, excludedGroups, includedArtifacts, excludedArtifacts, - includedScopes, excludedScopes, includedTypes, excludedTypes, - includeOptional, artifactFiltersUrl , getEncoding() ); + public ArtifactFilters getArtifactFilters() { + if (artifactFilters == null) { + artifactFilters = ArtifactFilters.of( + includedGroups, + excludedGroups, + includedArtifacts, + excludedArtifacts, + includedScopes, + excludedScopes, + includedTypes, + excludedTypes, + includeOptional, + artifactFiltersUrl, + getEncoding()); } return artifactFilters; } @@ -334,34 +324,29 @@ public ArtifactFilters getArtifactFilters() * @throws IOException if any IO problem * @since 1.0 */ - private boolean computeDoGenerateMissingFile( SortedProperties unsafeMappings, - SortedSet unsafeDependencies ) throws IOException - { + private boolean computeDoGenerateMissingFile( + SortedProperties unsafeMappings, SortedSet unsafeDependencies) throws IOException { - if ( !useMissingFile ) - { + if (!useMissingFile) { // never use the missing file return false; } - if ( force ) - { + if (force) { // the mapping for missing file is not empty, regenerate it - return !CollectionUtils.isEmpty( unsafeMappings.keySet() ); + return !CollectionUtils.isEmpty(unsafeMappings.keySet()); } - if ( !CollectionUtils.isEmpty( unsafeDependencies ) ) - { + if (!CollectionUtils.isEmpty(unsafeDependencies)) { // there is some unsafe dependencies from the project, must // regenerate missing file return true; } - if ( !missingFile.exists() ) - { + if (!missingFile.exists()) { // the missing file does not exists, this happens when // using remote missing file from dependencies @@ -369,9 +354,9 @@ private boolean computeDoGenerateMissingFile( SortedProperties unsafeMappings, } // check if the missing file has changed - SortedProperties oldUnsafeMappings = new SortedProperties( getEncoding() ); - oldUnsafeMappings.load( missingFile ); - return !unsafeMappings.equals( oldUnsafeMappings ); + SortedProperties oldUnsafeMappings = new SortedProperties(getEncoding()); + oldUnsafeMappings.load(missingFile); + return !unsafeMappings.equals(oldUnsafeMappings); } /** @@ -379,41 +364,33 @@ private boolean computeDoGenerateMissingFile( SortedProperties unsafeMappings, * * @throws IOException if error while writing missing file */ - private void writeMissingFile() - throws IOException - { - - FileUtil.createDirectoryIfNecessary( missingFile.getParentFile() ); - LOG.info( "Regenerate missing license file {}", missingFile ); - - FileOutputStream writer = new FileOutputStream( missingFile ); - try - { - StringBuilder sb = new StringBuilder( " Generated by " + getClass().getName() ); - List licenses = new ArrayList<>( licenseMap.keySet() ); - licenses.remove( LicenseMap.UNKNOWN_LICENSE_MESSAGE ); - if ( !licenses.isEmpty() ) - { - sb.append( "\n-------------------------------------------------------------------------------" ); - sb.append( "\n Already used licenses in project :" ); - for ( String license : licenses ) - { - sb.append( "\n - " ).append( license ); + private void writeMissingFile() throws IOException { + + FileUtil.createDirectoryIfNecessary(missingFile.getParentFile()); + LOG.info("Regenerate missing license file {}", missingFile); + + FileOutputStream writer = new FileOutputStream(missingFile); + try { + StringBuilder sb = new StringBuilder(" Generated by " + getClass().getName()); + List licenses = new ArrayList<>(licenseMap.keySet()); + licenses.remove(LicenseMap.UNKNOWN_LICENSE_MESSAGE); + if (!licenses.isEmpty()) { + sb.append("\n-------------------------------------------------------------------------------"); + sb.append("\n Already used licenses in project :"); + for (String license : licenses) { + sb.append("\n - ").append(license); } } - sb.append( "\n-------------------------------------------------------------------------------" ); - sb.append( "\n Please fill the missing licenses for dependencies :\n\n" ); - unsafeMappings.store( writer, sb.toString() ); - } - finally - { + sb.append("\n-------------------------------------------------------------------------------"); + sb.append("\n Please fill the missing licenses for dependencies :\n\n"); + unsafeMappings.store(writer, sb.toString()); + } finally { writer.close(); } } - void initFromMojo( AggregatorAddThirdPartyMojo mojo, MavenProject mavenProject, - List reactorProjects ) throws Exception - { + void initFromMojo(AggregatorAddThirdPartyMojo mojo, MavenProject mavenProject, List reactorProjects) + throws Exception { project = mavenProject; deployMissingFile = mojo.deployMissingFile; useRepositoryMissingFiles = mojo.useRepositoryMissingFiles; @@ -431,11 +408,11 @@ void initFromMojo( AggregatorAddThirdPartyMojo mojo, MavenProject mavenProject, useMissingFile = mojo.useMissingFile; String absolutePath = mojo.getProject().getBasedir().getAbsolutePath(); - missingFile = new File( project.getBasedir(), - mojo.missingFile.getAbsolutePath().substring( absolutePath.length() ) ); - resolvedOverrideUrl = mojo.resolvedOverrideUrl; + missingFile = new File( + project.getBasedir(), mojo.missingFile.getAbsolutePath().substring(absolutePath.length())); + resolvedOverrideUrl = mojo.resolvedOverrideUrl; missingLicensesFileArtifact = mojo.missingLicensesFileArtifact; - dependencies = new HashSet<>( mavenProject.getDependencyArtifacts() ); + dependencies = new HashSet<>(mavenProject.getDependencyArtifacts()); licenseMerges = mojo.licenseMerges; licenseMergesFile = mojo.licenseMergesFile; includedLicenses = mojo.includedLicenses; @@ -452,7 +429,7 @@ void initFromMojo( AggregatorAddThirdPartyMojo mojo, MavenProject mavenProject, verbose = mojo.verbose; encoding = mojo.encoding; - setLog( mojo.getLog() ); + setLog(mojo.getLog()); isAggregatorBuild = true; reactorProjectDependencies = reactorProjects; diff --git a/src/main/java/org/codehaus/mojo/license/AggregateDownloadLicensesMojo.java b/src/main/java/org/codehaus/mojo/license/AggregateDownloadLicensesMojo.java index fd44d576f..efe8da9aa 100644 --- a/src/main/java/org/codehaus/mojo/license/AggregateDownloadLicensesMojo.java +++ b/src/main/java/org/codehaus/mojo/license/AggregateDownloadLicensesMojo.java @@ -22,6 +22,10 @@ * #L% */ +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -30,10 +34,6 @@ import org.codehaus.mojo.license.api.ResolvedProjectDependencies; import org.codehaus.mojo.license.download.LicensedArtifact; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - /** * Download the license files of all aggregated dependencies of the current project, and generate a summary file * containing a list of all dependencies and their licenses. @@ -56,11 +56,12 @@ * @author Tony Chemit - dev@tchemit.fr * @since 1.10 */ -@Mojo( name = "aggregate-download-licenses", requiresDependencyResolution = ResolutionScope.TEST, - defaultPhase = LifecyclePhase.PACKAGE, aggregator = true ) -public class AggregateDownloadLicensesMojo - extends AbstractDownloadLicensesMojo -{ +@Mojo( + name = "aggregate-download-licenses", + requiresDependencyResolution = ResolutionScope.TEST, + defaultPhase = LifecyclePhase.PACKAGE, + aggregator = true) +public class AggregateDownloadLicensesMojo extends AbstractDownloadLicensesMojo { // ---------------------------------------------------------------------- // Mojo Parameters @@ -71,7 +72,7 @@ public class AggregateDownloadLicensesMojo * * @since 1.10 */ - @Parameter( property = "license.skipAggregateDownloadLicenses", defaultValue = "false" ) + @Parameter(property = "license.skipAggregateDownloadLicenses", defaultValue = "false") private boolean skipAggregateDownloadLicenses; /** @@ -81,8 +82,10 @@ public class AggregateDownloadLicensesMojo * * @since 1.10 */ - @Parameter( property = "license.executeOnlyOnRootModule", - alias = "aggregateDownloadLicenses.executeOnlyOnRootModule", defaultValue = "true" ) + @Parameter( + property = "license.executeOnlyOnRootModule", + alias = "aggregateDownloadLicenses.executeOnlyOnRootModule", + defaultValue = "true") private boolean executeOnlyOnRootModule; /** @@ -90,7 +93,7 @@ public class AggregateDownloadLicensesMojo * * @since 1.10 */ - @Parameter( property = "reactorProjects", readonly = true, required = true ) + @Parameter(property = "reactorProjects", readonly = true, required = true) private List reactorProjects; // ---------------------------------------------------------------------- @@ -100,23 +103,23 @@ public class AggregateDownloadLicensesMojo /** * {@inheritDoc} */ - protected boolean isSkip() - { - return skipAggregateDownloadLicenses || ( executeOnlyOnRootModule && !getProject().isExecutionRoot() ); + protected boolean isSkip() { + return skipAggregateDownloadLicenses + || (executeOnlyOnRootModule && !getProject().isExecutionRoot()); } /** * {@inheritDoc} */ - protected Map getDependencies() - { + protected Map getDependencies() { final Map result = new TreeMap<>(); - for ( MavenProject p : reactorProjects ) - { - licensedArtifactResolver.loadProjectDependencies( new ResolvedProjectDependencies( p.getArtifacts(), - p.getDependencyArtifacts() ), - this, remoteRepositories, result ); + for (MavenProject p : reactorProjects) { + licensedArtifactResolver.loadProjectDependencies( + new ResolvedProjectDependencies(p.getArtifacts(), p.getDependencyArtifacts()), + this, + remoteRepositories, + result); } return result; } diff --git a/src/main/java/org/codehaus/mojo/license/AggregatorAddThirdPartyMojo.java b/src/main/java/org/codehaus/mojo/license/AggregatorAddThirdPartyMojo.java index 7579ad065..d24e5c020 100644 --- a/src/main/java/org/codehaus/mojo/license/AggregatorAddThirdPartyMojo.java +++ b/src/main/java/org/codehaus/mojo/license/AggregatorAddThirdPartyMojo.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.SortedMap; import java.util.SortedSet; + import org.apache.commons.collections.CollectionUtils; import org.apache.maven.artifact.Artifact; import org.apache.maven.model.Plugin; @@ -58,11 +59,14 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -@Mojo( name = "aggregate-add-third-party", aggregator = true, defaultPhase = LifecyclePhase.GENERATE_RESOURCES, - requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true ) -public class AggregatorAddThirdPartyMojo extends AbstractAddThirdPartyMojo -{ - private static final Logger LOG = LoggerFactory.getLogger( AggregatorAddThirdPartyMojo.class ); +@Mojo( + name = "aggregate-add-third-party", + aggregator = true, + defaultPhase = LifecyclePhase.GENERATE_RESOURCES, + requiresDependencyResolution = ResolutionScope.TEST, + threadSafe = true) +public class AggregatorAddThirdPartyMojo extends AbstractAddThirdPartyMojo { + private static final Logger LOG = LoggerFactory.getLogger(AggregatorAddThirdPartyMojo.class); // ---------------------------------------------------------------------- // Mojo Parameters @@ -73,7 +77,7 @@ public class AggregatorAddThirdPartyMojo extends AbstractAddThirdPartyMojo * * @since 1.0 */ - @Parameter( property = "reactorProjects", readonly = true, required = true ) + @Parameter(property = "reactorProjects", readonly = true, required = true) private List reactorProjects; /** @@ -81,7 +85,7 @@ public class AggregatorAddThirdPartyMojo extends AbstractAddThirdPartyMojo * * @since 1.5 */ - @Parameter( property = "license.skipAggregateAddThirdParty", defaultValue = "false" ) + @Parameter(property = "license.skipAggregateAddThirdParty", defaultValue = "false") private boolean skipAggregateAddThirdParty; /** @@ -91,7 +95,7 @@ public class AggregatorAddThirdPartyMojo extends AbstractAddThirdPartyMojo * @deprecated since 1.14, please use now {@link #missingLicensesFileArtifact} */ @Deprecated - @Parameter( property = "license.aggregateMissingLicensesFileArtifact" ) + @Parameter(property = "license.aggregateMissingLicensesFileArtifact") private String aggregateMissingLicensesFileArtifact; /** @@ -101,7 +105,7 @@ public class AggregatorAddThirdPartyMojo extends AbstractAddThirdPartyMojo * @deprecated since 1.14, please use now {@link #missingFile}. */ @Deprecated - @Parameter( property = "license.aggregateMissingLicensesFile" ) + @Parameter(property = "license.aggregateMissingLicensesFile") private File aggregateMissingLicensesFile; // ---------------------------------------------------------------------- @@ -112,8 +116,7 @@ public class AggregatorAddThirdPartyMojo extends AbstractAddThirdPartyMojo * {@inheritDoc} */ @Override - public boolean isSkip() - { + public boolean isSkip() { return skipAggregateAddThirdParty; } @@ -121,38 +124,34 @@ public boolean isSkip() * {@inheritDoc} */ @Override - protected boolean checkPackaging() - { - return acceptPackaging( "pom" ); + protected boolean checkPackaging() { + return acceptPackaging("pom"); } /** * {@inheritDoc} */ @Override - protected boolean shouldSkip() - { + protected boolean shouldSkip() { return !doGenerate && !doGenerateBundle; } @Override - protected void init() throws Exception - { + protected void init() throws Exception { // CHECKSTYLE_OFF: LineLength - if ( aggregateMissingLicensesFile != null && !aggregateMissingLicensesFile.equals( missingFile ) ) - { - LOG.warn( "" ); - LOG.warn( "You should use *missingFile* parameter instead of deprecated *aggregateMissingLicensesFile*." ); - LOG.warn( "" ); + if (aggregateMissingLicensesFile != null && !aggregateMissingLicensesFile.equals(missingFile)) { + LOG.warn(""); + LOG.warn("You should use *missingFile* parameter instead of deprecated *aggregateMissingLicensesFile*."); + LOG.warn(""); missingFile = aggregateMissingLicensesFile; } - if ( aggregateMissingLicensesFileArtifact != null - && !aggregateMissingLicensesFileArtifact.equals( missingLicensesFileArtifact ) ) - { - LOG.warn( "" ); - LOG.warn( "You should use *missingLicensesFileArtifact* parameter instead of deprecated *aggregateMissingLicensesFileArtifact*." ); - LOG.warn( "" ); + if (aggregateMissingLicensesFileArtifact != null + && !aggregateMissingLicensesFileArtifact.equals(missingLicensesFileArtifact)) { + LOG.warn(""); + LOG.warn( + "You should use *missingLicensesFileArtifact* parameter instead of deprecated *aggregateMissingLicensesFileArtifact*."); + LOG.warn(""); missingLicensesFileArtifact = aggregateMissingLicensesFileArtifact; } // CHECKSTYLE_ON: LineLength @@ -163,94 +162,82 @@ protected void init() throws Exception * {@inheritDoc} */ @Override - protected void doAction() - throws Exception - { - if ( isVerbose() ) - { - LOG.info( "After executing on {} project(s)", reactorProjects.size() ); + protected void doAction() throws Exception { + if (isVerbose()) { + LOG.info("After executing on {} project(s)", reactorProjects.size()); } licenseMap = new LicenseMap(); - Artifact pluginArtifact = (Artifact) project.getPluginArtifactMap() - .get( "org.codehaus.mojo:license-maven-plugin" ); + Artifact pluginArtifact = + (Artifact) project.getPluginArtifactMap().get("org.codehaus.mojo:license-maven-plugin"); String groupId = null; String artifactId = null; String version = null; - if ( pluginArtifact == null ) - { - Plugin plugin = (Plugin) project.getPluginManagement().getPluginsAsMap() - .get( "org.codehaus.mojo:license-maven-plugin" ); - if ( plugin != null ) - { + if (pluginArtifact == null) { + Plugin plugin = (Plugin) + project.getPluginManagement().getPluginsAsMap().get("org.codehaus.mojo:license-maven-plugin"); + if (plugin != null) { groupId = plugin.getGroupId(); artifactId = plugin.getArtifactId(); version = plugin.getVersion(); } - } - else - { + } else { groupId = pluginArtifact.getGroupId(); artifactId = pluginArtifact.getArtifactId(); version = pluginArtifact.getVersion(); } - if ( groupId == null ) - { - try - { - final PluginDescriptor pd = ( PluginDescriptor ) getPluginContext().get( "pluginDescriptor" ); + if (groupId == null) { + try { + final PluginDescriptor pd = + (PluginDescriptor) getPluginContext().get("pluginDescriptor"); groupId = pd.getGroupId(); artifactId = pd.getArtifactId(); version = pd.getVersion(); - } - catch ( ClassCastException e ) - { - LOG.warn( "Failed to access PluginDescriptor", e ); + } catch (ClassCastException e) { + LOG.warn("Failed to access PluginDescriptor", e); } - if ( groupId == null ) - { - throw new IllegalStateException( "Failed to determine the license-maven-plugin artifact." - + - "Please add it to your parent POM." ); + if (groupId == null) { + throw new IllegalStateException( + "Failed to determine the license-maven-plugin artifact." + "Please add it to your parent POM."); } } String addThirdPartyRoleHint = groupId + ":" + artifactId + ":" + version + ":" + "add-third-party"; - LOG.info( "The default plugin hint is: " + addThirdPartyRoleHint ); + LOG.info("The default plugin hint is: " + addThirdPartyRoleHint); - for ( MavenProject reactorProject : reactorProjects ) - { - if ( getProject().equals( reactorProject ) && !acceptPomPackaging ) - { + for (MavenProject reactorProject : reactorProjects) { + if (getProject().equals(reactorProject) && !acceptPomPackaging) { // does not process this pom unless specified continue; } - AddThirdPartyMojo mojo = (AddThirdPartyMojo) getSession() - .lookup( AddThirdPartyMojo.ROLE, addThirdPartyRoleHint ); + AddThirdPartyMojo mojo = + (AddThirdPartyMojo) getSession().lookup(AddThirdPartyMojo.ROLE, addThirdPartyRoleHint); - mojo.initFromMojo( this, reactorProject, new ArrayList<>( this.reactorProjects ) ); + mojo.initFromMojo(this, reactorProject, new ArrayList<>(this.reactorProjects)); LicenseMap childLicenseMap = mojo.licenseMap; - if ( isVerbose() ) - { - LOG.info( "Found {} license(s) in module {}:{}", - childLicenseMap.size(), mojo.project.getGroupId(), mojo.project.getArtifactId() ); + if (isVerbose()) { + LOG.info( + "Found {} license(s) in module {}:{}", + childLicenseMap.size(), + mojo.project.getGroupId(), + mojo.project.getArtifactId()); } - licenseMap.putAll( childLicenseMap ); - + licenseMap.putAll(childLicenseMap); } - LOG.info( "Detected {} license(s).", licenseMap.size() ); - if ( isVerbose() ) - { - for ( Map.Entry> entry: licenseMap.entrySet() ) - { - LOG.info( " - {} for {} artifact(s).", entry.getKey(), entry.getValue().size() ); + LOG.info("Detected {} license(s).", licenseMap.size()); + if (isVerbose()) { + for (Map.Entry> entry : licenseMap.entrySet()) { + LOG.info( + " - {} for {} artifact(s).", + entry.getKey(), + entry.getValue().size()); } } @@ -260,11 +247,11 @@ protected void doAction() boolean safeLicense = checkForbiddenLicenses(); - checkBlacklist( safeLicense ); + checkBlacklist(safeLicense); writeThirdPartyFile(); - checkMissing( CollectionUtils.isNotEmpty( unsafeDependencies ) ); + checkMissing(CollectionUtils.isNotEmpty(unsafeDependencies)); } // ---------------------------------------------------------------------- @@ -275,8 +262,7 @@ protected void doAction() * {@inheritDoc} */ @Override - protected SortedMap loadDependencies() - { + protected SortedMap loadDependencies() { // use the cache filled by modules in reactor return getHelper().getArtifactCache(); } @@ -286,35 +272,31 @@ protected SortedMap loadDependencies() */ @Override protected SortedProperties createUnsafeMapping() - throws ProjectBuildingException, IOException, MojoExecutionException - { + throws ProjectBuildingException, IOException, MojoExecutionException { - String path = - missingFile.getAbsolutePath().substring( getProject().getBasedir().getAbsolutePath().length() + 1 ); + String path = missingFile + .getAbsolutePath() + .substring(getProject().getBasedir().getAbsolutePath().length() + 1); - if ( isVerbose() ) - { - LOG.info( "Use missing file path: {}", path ); + if (isVerbose()) { + LOG.info("Use missing file path: {}", path); } - SortedProperties unsafeMappings = new SortedProperties( getEncoding() ); + SortedProperties unsafeMappings = new SortedProperties(getEncoding()); - for ( Object o : reactorProjects ) - { + for (Object o : reactorProjects) { MavenProject p = (MavenProject) o; - File file = new File( p.getBasedir(), path ); + File file = new File(p.getBasedir(), path); - if ( file.exists() ) - { + if (file.exists()) { - SortedProperties tmp = getHelper().loadUnsafeMapping( licenseMap, file, null, projectDependencies ); - unsafeMappings.putAll( tmp ); + SortedProperties tmp = getHelper().loadUnsafeMapping(licenseMap, file, null, projectDependencies); + unsafeMappings.putAll(tmp); } - SortedSet unsafe = getHelper().getProjectsWithNoLicense( licenseMap ); - if ( CollectionUtils.isEmpty( unsafe ) ) - { + SortedSet unsafe = getHelper().getProjectsWithNoLicense(licenseMap); + if (CollectionUtils.isEmpty(unsafe)) { // no more unsafe dependencies, can break break; @@ -322,5 +304,4 @@ protected SortedProperties createUnsafeMapping() } return unsafeMappings; } - } diff --git a/src/main/java/org/codehaus/mojo/license/AggregatorThirdPartyReportMojo.java b/src/main/java/org/codehaus/mojo/license/AggregatorThirdPartyReportMojo.java index dbbfa1223..4b08a5a17 100644 --- a/src/main/java/org/codehaus/mojo/license/AggregatorThirdPartyReportMojo.java +++ b/src/main/java/org/codehaus/mojo/license/AggregatorThirdPartyReportMojo.java @@ -22,6 +22,11 @@ * #L% */ +import java.io.IOException; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.List; + import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.plugin.MojoExecutionException; @@ -36,11 +41,6 @@ import org.codehaus.mojo.license.api.ThirdPartyDetails; import org.codehaus.mojo.license.api.ThirdPartyToolException; -import java.io.IOException; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; - /** * Generates a report of all third-parties detected in the module. * @@ -49,10 +49,8 @@ * @author Tony Chemit - dev@tchemit.fr * @since 1.10 */ -@Mojo( name = "aggregate-third-party-report", aggregator = true, requiresDependencyResolution = ResolutionScope.TEST ) -public class AggregatorThirdPartyReportMojo - extends AbstractThirdPartyReportMojo -{ +@Mojo(name = "aggregate-third-party-report", aggregator = true, requiresDependencyResolution = ResolutionScope.TEST) +public class AggregatorThirdPartyReportMojo extends AbstractThirdPartyReportMojo { // ---------------------------------------------------------------------- // Mojo Parameters @@ -63,7 +61,7 @@ public class AggregatorThirdPartyReportMojo * * @since 1.10 */ - @Parameter( property = "license.skipAggregateThirdPartyReport", defaultValue = "false" ) + @Parameter(property = "license.skipAggregateThirdPartyReport", defaultValue = "false") private boolean skipAggregateThirdPartyReport; /** @@ -73,8 +71,10 @@ public class AggregatorThirdPartyReportMojo * * @since 1.10 */ - @Parameter( property = "license.executeOnlyOnRootModule", - alias = "aggregateThirdPartyReport.executeOnlyOnRootModule", defaultValue = "true" ) + @Parameter( + property = "license.executeOnlyOnRootModule", + alias = "aggregateThirdPartyReport.executeOnlyOnRootModule", + defaultValue = "true") private boolean executeOnlyOnRootModule; /** @@ -82,7 +82,7 @@ public class AggregatorThirdPartyReportMojo * * @since 1.10 */ - @Parameter( property = "reactorProjects", readonly = true, required = true ) + @Parameter(property = "reactorProjects", readonly = true, required = true) private List reactorProjects; // ---------------------------------------------------------------------- @@ -92,8 +92,7 @@ public class AggregatorThirdPartyReportMojo /** * {@inheritDoc} */ - public String getOutputName() - { + public String getOutputName() { return "aggregate-third-party-report"; } @@ -101,9 +100,9 @@ public String getOutputName() * {@inheritDoc} */ @Override - public boolean canGenerateReport() - { - return !skipAggregateThirdPartyReport && ( !executeOnlyOnRootModule || getProject().isExecutionRoot() ); + public boolean canGenerateReport() { + return !skipAggregateThirdPartyReport + && (!executeOnlyOnRootModule || getProject().isExecutionRoot()); } // ---------------------------------------------------------------------- @@ -114,22 +113,18 @@ public boolean canGenerateReport() * {@inheritDoc} */ protected Collection createThirdPartyDetails() - throws IOException, ThirdPartyToolException, ProjectBuildingException, MojoFailureException, - InvalidDependencyVersionException, ArtifactNotFoundException, ArtifactResolutionException, - DependenciesToolException, MojoExecutionException - { + throws IOException, ThirdPartyToolException, ProjectBuildingException, MojoFailureException, + InvalidDependencyVersionException, ArtifactNotFoundException, ArtifactResolutionException, + DependenciesToolException, MojoExecutionException { Collection details = new LinkedHashSet<>(); - for ( MavenProject reactorProject : reactorProjects ) - { - - Collection thirdPartyDetails = createThirdPartyDetails( reactorProject, true ); - details.addAll( thirdPartyDetails ); + for (MavenProject reactorProject : reactorProjects) { + Collection thirdPartyDetails = createThirdPartyDetails(reactorProject, true); + details.addAll(thirdPartyDetails); } return details; } - -} \ No newline at end of file +} diff --git a/src/main/java/org/codehaus/mojo/license/CheckFileHeaderMojo.java b/src/main/java/org/codehaus/mojo/license/CheckFileHeaderMojo.java index f582ca848..de6e05fc2 100644 --- a/src/main/java/org/codehaus/mojo/license/CheckFileHeaderMojo.java +++ b/src/main/java/org/codehaus/mojo/license/CheckFileHeaderMojo.java @@ -31,9 +31,8 @@ * @author tchemit dev@tchemit.fr * @since 1.2 */ -@Mojo( name = "check-file-header", threadSafe = true ) -public class CheckFileHeaderMojo extends AbstractFileHeaderMojo -{ +@Mojo(name = "check-file-header", threadSafe = true) +public class CheckFileHeaderMojo extends AbstractFileHeaderMojo { // ---------------------------------------------------------------------- // Mojo Parameters @@ -44,7 +43,7 @@ public class CheckFileHeaderMojo extends AbstractFileHeaderMojo * * @since 1.2 */ - @Parameter( property = "license.failOnMissingHeader", defaultValue = "false" ) + @Parameter(property = "license.failOnMissingHeader", defaultValue = "false") private boolean failOnMissingHeader; /** @@ -52,7 +51,7 @@ public class CheckFileHeaderMojo extends AbstractFileHeaderMojo * * @since 1.2 */ - @Parameter( property = "license.failOnNotUptodateHeader", defaultValue = "false" ) + @Parameter(property = "license.failOnNotUptodateHeader", defaultValue = "false") private boolean failOnNotUptodateHeader; /** @@ -60,7 +59,7 @@ public class CheckFileHeaderMojo extends AbstractFileHeaderMojo * * @since 1.2 */ - @Parameter( property = "license.skipCheckLicense", defaultValue = "false" ) + @Parameter(property = "license.skipCheckLicense", defaultValue = "false") private boolean skipCheckLicense; // ---------------------------------------------------------------------- @@ -68,8 +67,7 @@ public class CheckFileHeaderMojo extends AbstractFileHeaderMojo // ---------------------------------------------------------------------- @Override - public boolean isSkip() - { + public boolean isSkip() { return skipCheckLicense; } @@ -78,21 +76,18 @@ public boolean isSkip() // ---------------------------------------------------------------------- @Override - protected boolean isDryRun() - { + protected boolean isDryRun() { // this mojo should never update any files. return true; } @Override - protected boolean isFailOnMissingHeader() - { + protected boolean isFailOnMissingHeader() { return failOnMissingHeader; } @Override - protected boolean isFailOnNotUptodateHeader() - { + protected boolean isFailOnNotUptodateHeader() { return failOnNotUptodateHeader; } } diff --git a/src/main/java/org/codehaus/mojo/license/CommentStyleListMojo.java b/src/main/java/org/codehaus/mojo/license/CommentStyleListMojo.java index 1d9414104..dc10229c8 100644 --- a/src/main/java/org/codehaus/mojo/license/CommentStyleListMojo.java +++ b/src/main/java/org/codehaus/mojo/license/CommentStyleListMojo.java @@ -22,6 +22,12 @@ * #L% */ +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; + import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Component; @@ -31,23 +37,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; - /** * Displays all the available comment style to box file headers. * * @author tchemit dev@tchemit.fr * @since 1.0 */ -@Mojo( name = "comment-style-list", requiresProject = false, requiresDirectInvocation = true ) -public class CommentStyleListMojo - extends AbstractLicenseMojo -{ - private static final Logger LOG = LoggerFactory.getLogger( CommentStyleListMojo.class ); +@Mojo(name = "comment-style-list", requiresProject = false, requiresDirectInvocation = true) +public class CommentStyleListMojo extends AbstractLicenseMojo { + private static final Logger LOG = LoggerFactory.getLogger(CommentStyleListMojo.class); // ---------------------------------------------------------------------- // Mojo Parameters @@ -58,7 +56,7 @@ public class CommentStyleListMojo * * @since 1.0 */ - @Parameter( property = "detail" ) + @Parameter(property = "detail") private boolean detail; // ---------------------------------------------------------------------- @@ -70,7 +68,7 @@ public class CommentStyleListMojo * * @since 1.0 */ - @Component( role = FileHeaderTransformer.class ) + @Component(role = FileHeaderTransformer.class) private Map transformers; // ---------------------------------------------------------------------- @@ -81,8 +79,7 @@ public class CommentStyleListMojo * {@inheritDoc} */ @Override - public boolean isSkip() - { + public boolean isSkip() { // can't skip this goal since direct invocation is required return false; } @@ -91,61 +88,54 @@ public boolean isSkip() * {@inheritDoc} */ @Override - protected void init() - throws Exception - { - //nothing to do + protected void init() throws Exception { + // nothing to do } /** * {@inheritDoc} */ @Override - public void doAction() - throws MojoExecutionException, MojoFailureException - { + public void doAction() throws MojoExecutionException, MojoFailureException { StringBuilder buffer = new StringBuilder(); - if ( isVerbose() ) - { - buffer.append( "\n\n-------------------------------------------------------------------------------\n" ); - buffer.append( " license-maven-plugin\n" ); - buffer.append( "-------------------------------------------------------------------------------\n\n" ); + if (isVerbose()) { + buffer.append("\n\n-------------------------------------------------------------------------------\n"); + buffer.append(" license-maven-plugin\n"); + buffer.append("-------------------------------------------------------------------------------\n\n"); } - List names = new ArrayList<>( transformers.keySet() ); - Collections.sort( names ); + List names = new ArrayList<>(transformers.keySet()); + Collections.sort(names); int maxLength = 0; int maxDLength = 0; - for ( String name : names ) - { - if ( name.length() > maxLength ) - { + for (String name : names) { + if (name.length() > maxLength) { maxLength = name.length(); } - FileHeaderTransformer transformer = transformers.get( name ); - if ( transformer.getDescription().length() > maxDLength ) - { + FileHeaderTransformer transformer = transformers.get(name); + if (transformer.getDescription().length() > maxDLength) { maxDLength = transformer.getDescription().length(); } } String pattern = " * %1$-" + maxLength + "s : %2$-" + maxDLength + "s, extensions : %3$s\n"; - buffer.append( "Available comment styles:\n\n" ); - for ( String transformerName : names ) - { - FileHeaderTransformer transformer = transformers.get( transformerName ); - buffer.append( String.format( pattern, transformerName, transformer.getDescription(), - Arrays.toString( transformer.getDefaultAcceptedExtensions() ) ) ); - if ( detail ) - { - buffer.append( "\n example : \n" ); - buffer.append( transformer.boxComment( "header", true ) ); - buffer.append( '\n' ); + buffer.append("Available comment styles:\n\n"); + for (String transformerName : names) { + FileHeaderTransformer transformer = transformers.get(transformerName); + buffer.append(String.format( + pattern, + transformerName, + transformer.getDescription(), + Arrays.toString(transformer.getDefaultAcceptedExtensions()))); + if (detail) { + buffer.append("\n example : \n"); + buffer.append(transformer.boxComment("header", true)); + buffer.append('\n'); } } - LOG.info( "{}", buffer ); + LOG.info("{}", buffer); } } diff --git a/src/main/java/org/codehaus/mojo/license/DownloadLicensesMojo.java b/src/main/java/org/codehaus/mojo/license/DownloadLicensesMojo.java index b0a6bebed..a7461bfc0 100644 --- a/src/main/java/org/codehaus/mojo/license/DownloadLicensesMojo.java +++ b/src/main/java/org/codehaus/mojo/license/DownloadLicensesMojo.java @@ -52,11 +52,11 @@ * @author Paul Gier * @since 1.0 */ -@Mojo( name = "download-licenses", requiresDependencyResolution = ResolutionScope.TEST, - defaultPhase = LifecyclePhase.PACKAGE ) -public class DownloadLicensesMojo - extends AbstractDownloadLicensesMojo -{ +@Mojo( + name = "download-licenses", + requiresDependencyResolution = ResolutionScope.TEST, + defaultPhase = LifecyclePhase.PACKAGE) +public class DownloadLicensesMojo extends AbstractDownloadLicensesMojo { // ---------------------------------------------------------------------- // Mojo Parameters @@ -67,7 +67,7 @@ public class DownloadLicensesMojo * * @since 1.5 */ - @Parameter( property = "license.skipDownloadLicenses", defaultValue = "false" ) + @Parameter(property = "license.skipDownloadLicenses", defaultValue = "false") protected boolean skipDownloadLicenses; // ---------------------------------------------------------------------- @@ -77,18 +77,17 @@ public class DownloadLicensesMojo /** * {@inheritDoc} */ - protected boolean isSkip() - { + protected boolean isSkip() { return skipDownloadLicenses; } - protected Map getDependencies() - { + protected Map getDependencies() { final Map result = new TreeMap<>(); licensedArtifactResolver.loadProjectDependencies( - new ResolvedProjectDependencies( project.getArtifacts(), project.getDependencyArtifacts() ), - this, remoteRepositories, result ); + new ResolvedProjectDependencies(project.getArtifacts(), project.getDependencyArtifacts()), + this, + remoteRepositories, + result); return result; } - } diff --git a/src/main/java/org/codehaus/mojo/license/Eol.java b/src/main/java/org/codehaus/mojo/license/Eol.java index e537e38f3..42b1e395d 100644 --- a/src/main/java/org/codehaus/mojo/license/Eol.java +++ b/src/main/java/org/codehaus/mojo/license/Eol.java @@ -32,21 +32,18 @@ * * @since 1.17 */ -public enum Eol -{ +public enum Eol { /** Unix {@code \n} */ - LF( "\n" ), + LF("\n"), /** Windows {@code \r\n} */ - CRLF ( "\r\n" ), + CRLF("\r\n"), /** Autodetect the end of line value based on some existing file using {@link #autodetect(Path, Charset)} */ - AUTODETECT ( null ) - { - public String getEolString() - { - throw new IllegalStateException( "You need to autodetect the end of line value using " - + Eol.class.getName() + ".autodetect(Path, Charset)" ); + AUTODETECT(null) { + public String getEolString() { + throw new IllegalStateException("You need to autodetect the end of line value using " + Eol.class.getName() + + ".autodetect(Path, Charset)"); } }, @@ -57,29 +54,24 @@ public String getEolString() * makes your build irreproducible on other platforms. */ @Deprecated - PLATFORM ( null ) - { - public String getEolString() - { - return System.getProperty( "line.separator" ); + PLATFORM(null) { + public String getEolString() { + return System.getProperty("line.separator"); } }; - public static Eol autodetect( Path file, Charset charset ) throws IOException - { - final String content = new String( Files.readAllBytes( file ), charset ); - return content.indexOf( '\r' ) >= 0 ? Eol.CRLF : Eol.LF; + public static Eol autodetect(Path file, Charset charset) throws IOException { + final String content = new String(Files.readAllBytes(file), charset); + return content.indexOf('\r') >= 0 ? Eol.CRLF : Eol.LF; } private final String eolString; - Eol( String eolString ) - { + Eol(String eolString) { this.eolString = eolString; } - public String getEolString() - { + public String getEolString() { return eolString; } } diff --git a/src/main/java/org/codehaus/mojo/license/FileState.java b/src/main/java/org/codehaus/mojo/license/FileState.java index 23c0cef04..e8478b26e 100644 --- a/src/main/java/org/codehaus/mojo/license/FileState.java +++ b/src/main/java/org/codehaus/mojo/license/FileState.java @@ -33,8 +33,7 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public enum FileState -{ +public enum FileState { /** * file was updated @@ -71,14 +70,12 @@ public enum FileState * @param file file to add * @param results dictionary to update */ - public void addFile( File file, EnumMap> results ) - { - Set fileSet = results.get( this ); - if ( fileSet == null ) - { + public void addFile(File file, EnumMap> results) { + Set fileSet = results.get(this); + if (fileSet == null) { fileSet = new HashSet<>(); - results.put( this, fileSet ); + results.put(this, fileSet); } - fileSet.add( file ); + fileSet.add(file); } } diff --git a/src/main/java/org/codehaus/mojo/license/LicenseContentSanitizer.java b/src/main/java/org/codehaus/mojo/license/LicenseContentSanitizer.java index 597411deb..8637f71ec 100644 --- a/src/main/java/org/codehaus/mojo/license/LicenseContentSanitizer.java +++ b/src/main/java/org/codehaus/mojo/license/LicenseContentSanitizer.java @@ -26,8 +26,7 @@ * @author Peter Palaga * @since 1.20 */ -public class LicenseContentSanitizer -{ +public class LicenseContentSanitizer { private String id; private String urlRegexp; @@ -36,23 +35,19 @@ public class LicenseContentSanitizer private String contentReplacement; - public String getId() - { + public String getId() { return id; } - public String getUrlRegexp() - { + public String getUrlRegexp() { return urlRegexp; } - public String getContentRegexp() - { + public String getContentRegexp() { return contentRegexp; } - public String getContentReplacement() - { + public String getContentReplacement() { return contentReplacement; } } diff --git a/src/main/java/org/codehaus/mojo/license/LicenseListMojo.java b/src/main/java/org/codehaus/mojo/license/LicenseListMojo.java index f5e2d6ab6..cf8ce025a 100644 --- a/src/main/java/org/codehaus/mojo/license/LicenseListMojo.java +++ b/src/main/java/org/codehaus/mojo/license/LicenseListMojo.java @@ -22,6 +22,11 @@ * #L% */ +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; @@ -31,22 +36,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - /** * Display all available licenses. * * @author tchemit dev@tchemit.fr * @since 1.0 */ -@Mojo( name = "license-list", requiresProject = false, requiresDirectInvocation = true ) -public class LicenseListMojo - extends AbstractLicenseMojo -{ - private static final Logger LOG = LoggerFactory.getLogger( LicenseListMojo.class ); +@Mojo(name = "license-list", requiresProject = false, requiresDirectInvocation = true) +public class LicenseListMojo extends AbstractLicenseMojo { + private static final Logger LOG = LoggerFactory.getLogger(LicenseListMojo.class); // ---------------------------------------------------------------------- // Mojo Parameters @@ -60,7 +58,7 @@ public class LicenseListMojo *

* @since 1.0 */ - @Parameter( property = "extraResolver" ) + @Parameter(property = "extraResolver") private String extraResolver; /** @@ -68,7 +66,7 @@ public class LicenseListMojo * * @since 1.0 */ - @Parameter( property = "detail" ) + @Parameter(property = "detail") private boolean detail; // ---------------------------------------------------------------------- @@ -88,8 +86,7 @@ public class LicenseListMojo * {@inheritDoc} */ @Override - public boolean isSkip() - { + public boolean isSkip() { // can't skip this goal since direct invocation is required return false; } @@ -98,64 +95,52 @@ public boolean isSkip() * {@inheritDoc} */ @Override - protected void init() - throws Exception - { + protected void init() throws Exception { // obtain licenses store - licenseStore = LicenseStore.createLicenseStore( extraResolver ); + licenseStore = LicenseStore.createLicenseStore(extraResolver); } /** * {@inheritDoc} */ @Override - public void doAction() - throws MojoExecutionException, MojoFailureException - { + public void doAction() throws MojoExecutionException, MojoFailureException { StringBuilder buffer = new StringBuilder(); - if ( isVerbose() ) - { - buffer.append( "\n\n-------------------------------------------------------------------------------\n" ); - buffer.append( " maven-license-plugin\n" ); - buffer.append( "-------------------------------------------------------------------------------\n\n" ); + if (isVerbose()) { + buffer.append("\n\n-------------------------------------------------------------------------------\n"); + buffer.append(" maven-license-plugin\n"); + buffer.append("-------------------------------------------------------------------------------\n\n"); } - buffer.append( "Available licenses :\n\n" ); + buffer.append("Available licenses :\n\n"); - List names = Arrays.asList( licenseStore.getLicenseNames() ); + List names = Arrays.asList(licenseStore.getLicenseNames()); int maxLength = 0; - for ( String name : names ) - { - if ( name.length() > maxLength ) - { + for (String name : names) { + if (name.length() > maxLength) { maxLength = name.length(); } } - Collections.sort( names ); + Collections.sort(names); String pattern = " * %1$-" + maxLength + "s : %2$s\n"; - for ( String licenseName : names ) - { - License license = licenseStore.getLicense( licenseName ); - buffer.append( String.format( pattern, licenseName, license.getDescription() ) ); - if ( detail ) - { - try - { - buffer.append( "\n" ); - buffer.append( license.getHeaderContent( getEncoding() ) ); - buffer.append( "\n\n" ); - } - catch ( IOException ex ) - { + for (String licenseName : names) { + License license = licenseStore.getLicense(licenseName); + buffer.append(String.format(pattern, licenseName, license.getDescription())); + if (detail) { + try { + buffer.append("\n"); + buffer.append(license.getHeaderContent(getEncoding())); + buffer.append("\n\n"); + } catch (IOException ex) { throw new MojoExecutionException( - "could not instanciate license with name " + licenseName + " for reason " + ex.getMessage(), - ex ); + "could not instanciate license with name " + licenseName + " for reason " + ex.getMessage(), + ex); } } } - LOG.info( "{}", buffer ); + LOG.info("{}", buffer); } } diff --git a/src/main/java/org/codehaus/mojo/license/LicenseMojoUtils.java b/src/main/java/org/codehaus/mojo/license/LicenseMojoUtils.java index 4145c0e92..da637d12a 100644 --- a/src/main/java/org/codehaus/mojo/license/LicenseMojoUtils.java +++ b/src/main/java/org/codehaus/mojo/license/LicenseMojoUtils.java @@ -35,9 +35,8 @@ * * @since 1.17 */ -public final class LicenseMojoUtils -{ - private static final LoggerFacade LOG = new Slf4jLoggerFacade( LoggerFactory.getLogger( LicenseMojoUtils.class ) ); +public final class LicenseMojoUtils { + private static final LoggerFacade LOG = new Slf4jLoggerFacade(LoggerFactory.getLogger(LicenseMojoUtils.class)); /** A special singleton to pass the information that the URL was not set. */ static final String NO_URL = "file:///inexistent"; @@ -47,17 +46,14 @@ public final class LicenseMojoUtils /** * Hidden */ - private LicenseMojoUtils() - { - } + private LicenseMojoUtils() {} /** * @param url the {@link URL} to check * @return {@code url != null && url != NO_URL} */ - public static boolean isValid( String url ) - { - return url != null && !NO_URL.equals( url ); + public static boolean isValid(String url) { + return url != null && !NO_URL.equals(url); } /** @@ -70,10 +66,9 @@ public static boolean isValid( String url ) * @param basedir {@code basedir} to resolve {@value #DEFAULT_OVERRIDE_THIRD_PARTY} against * @return a valid URL or {@link #NO_URL}, never {@code null} */ - public static String prepareThirdPartyOverrideUrl( final String resolvedUrl, final File deprecatedFile, - final String url, File basedir ) - { - return prepareThirdPartyOverrideUrl( resolvedUrl, deprecatedFile, url, basedir, LOG ); + public static String prepareThirdPartyOverrideUrl( + final String resolvedUrl, final File deprecatedFile, final String url, File basedir) { + return prepareThirdPartyOverrideUrl(resolvedUrl, deprecatedFile, url, basedir, LOG); } /** @@ -86,128 +81,111 @@ public static String prepareThirdPartyOverrideUrl( final String resolvedUrl, fin * @param log the log to write to * @return a valid URL or {@link #NO_URL}, never {@code null} */ - static String prepareThirdPartyOverrideUrl( final String resolvedUrl, final File deprecatedFile, final String url, - File basedir, LoggerFacade log ) - { - if ( deprecatedFile != null ) - { - log.warn( "'overrideFile' mojo parameter is deprecated. Use 'overrideUrl' instead." ); + static String prepareThirdPartyOverrideUrl( + final String resolvedUrl, final File deprecatedFile, final String url, File basedir, LoggerFacade log) { + if (deprecatedFile != null) { + log.warn("'overrideFile' mojo parameter is deprecated. Use 'overrideUrl' instead."); } - return prepareUrl( resolvedUrl, deprecatedFile, url, basedir, DEFAULT_OVERRIDE_THIRD_PARTY, log ); + return prepareUrl(resolvedUrl, deprecatedFile, url, basedir, DEFAULT_OVERRIDE_THIRD_PARTY, log); } - private static String prepareUrl( final String resolvedUrl, final File deprecatedFile, final String url, - File basedir, String defaultFilePath, LoggerFacade log ) - { - if ( resolvedUrl != null && !NO_URL.equals( resolvedUrl ) ) - { + private static String prepareUrl( + final String resolvedUrl, + final File deprecatedFile, + final String url, + File basedir, + String defaultFilePath, + LoggerFacade log) { + if (resolvedUrl != null && !NO_URL.equals(resolvedUrl)) { return resolvedUrl; } - if ( deprecatedFile != null && url != null && !url.isEmpty() ) - { - throw new IllegalArgumentException( "You can't use both overrideFile and overrideUrl" ); + if (deprecatedFile != null && url != null && !url.isEmpty()) { + throw new IllegalArgumentException("You can't use both overrideFile and overrideUrl"); } - if ( deprecatedFile != null ) - { - if ( deprecatedFile.exists() ) - { + if (deprecatedFile != null) { + if (deprecatedFile.exists()) { String result = deprecatedFile.toURI().toString(); - log.debug( "Loading overrides from file {}", result ); + log.debug("Loading overrides from file {}", result); return result; - } - else - { - log.warn( "overrideFile [{}] was configured but doesn't exist", deprecatedFile.getAbsolutePath() ); + } else { + log.warn("overrideFile [{}] was configured but doesn't exist", deprecatedFile.getAbsolutePath()); } } - if ( url != null ) - { - if ( UrlRequester.isStringUrl( url ) ) - { - log.debug( "Loading overrides from URL {}", url ); + if (url != null) { + if (UrlRequester.isStringUrl(url)) { + log.debug("Loading overrides from URL {}", url); return url; - } - else - { - log.warn( "Unsupported or invalid URL [{}] found in overrideUrl; " - + "supported are 'classpath:' URLs and anything your JVM supports " - + "(file:, http: and https: should always work)", url ); + } else { + log.warn( + "Unsupported or invalid URL [{}] found in overrideUrl; " + + "supported are 'classpath:' URLs and anything your JVM supports " + + "(file:, http: and https: should always work)", + url); } } final Path basedirPath = basedir.toPath(); - final Path defaultPath = basedirPath.resolve( defaultFilePath ); + final Path defaultPath = basedirPath.resolve(defaultFilePath); - if ( Files.exists( defaultPath ) ) - { + if (Files.exists(defaultPath)) { String result = defaultPath.toUri().toString(); - log.debug( "Loading overrides from file {}", result ); + log.debug("Loading overrides from file {}", result); return result; } - log.debug( "No (valid) URL and no file [{}] found; not loading any overrides", defaultPath.toAbsolutePath() ); + log.debug("No (valid) URL and no file [{}] found; not loading any overrides", defaultPath.toAbsolutePath()); return NO_URL; } /** * A {@link LoggerFacade} implementation backed by a SLF4J {@link Logger}. */ - static class Slf4jLoggerFacade - implements LoggerFacade - { + static class Slf4jLoggerFacade implements LoggerFacade { private final Logger delegate; - Slf4jLoggerFacade( Logger delegate ) - { + Slf4jLoggerFacade(Logger delegate) { super(); this.delegate = delegate; } @Override - public void warn( String message ) - { - delegate.warn( message ); + public void warn(String message) { + delegate.warn(message); } @Override - public void warn( String template, Object param ) - { - delegate.warn( template, param ); + public void warn(String template, Object param) { + delegate.warn(template, param); } @Override - public void debug( String template, Object param ) - { - delegate.debug( template, param ); + public void debug(String template, Object param) { + delegate.debug(template, param); } - } /** * A simplified facade of {@link Logger} to be able to implement a test logger easily. */ - interface LoggerFacade - { + interface LoggerFacade { /** * @see Logger#warn(String) */ - void warn( String message ); + void warn(String message); /** * @see Logger#warn(String, Object) */ - void warn( String template, Object param ); + void warn(String template, Object param); /** * @see Logger#debug(String, Object) */ - void debug( String template, Object param ); - + void debug(String template, Object param); } - } diff --git a/src/main/java/org/codehaus/mojo/license/LicenseUrlReplacement.java b/src/main/java/org/codehaus/mojo/license/LicenseUrlReplacement.java index b597aebd8..084ed6cfe 100644 --- a/src/main/java/org/codehaus/mojo/license/LicenseUrlReplacement.java +++ b/src/main/java/org/codehaus/mojo/license/LicenseUrlReplacement.java @@ -29,8 +29,7 @@ * * @since 1.17 */ -public class LicenseUrlReplacement -{ +public class LicenseUrlReplacement { /** * Regular expression used to identify license urls that are to be replaced. * @@ -64,26 +63,21 @@ public class LicenseUrlReplacement */ private String id; - public String getRegexp() - { + public String getRegexp() { return regexp; } - public String getReplacement() - { + public String getReplacement() { return replacement; } - public String getId() - { + public String getId() { return id; } - public Pattern getPattern() - { - if ( pattern == null && regexp != null ) - { - pattern = Pattern.compile( regexp ); + public Pattern getPattern() { + if (pattern == null && regexp != null) { + pattern = Pattern.compile(regexp); } return pattern; } diff --git a/src/main/java/org/codehaus/mojo/license/LicensesXmlInsertVersionsMojo.java b/src/main/java/org/codehaus/mojo/license/LicensesXmlInsertVersionsMojo.java index fddcb50e9..c96c0f718 100644 --- a/src/main/java/org/codehaus/mojo/license/LicensesXmlInsertVersionsMojo.java +++ b/src/main/java/org/codehaus/mojo/license/LicensesXmlInsertVersionsMojo.java @@ -51,12 +51,12 @@ * * @since 1.19 */ -@Mojo( name = "licenses-xml-insert-versions", requiresDependencyResolution = ResolutionScope.TEST, - defaultPhase = LifecyclePhase.PACKAGE ) -public class LicensesXmlInsertVersionsMojo - extends AbstractLicensesXmlMojo -{ - private static final Logger LOG = LoggerFactory.getLogger( LicensesXmlInsertVersionsMojo.class ); +@Mojo( + name = "licenses-xml-insert-versions", + requiresDependencyResolution = ResolutionScope.TEST, + defaultPhase = LifecyclePhase.PACKAGE) +public class LicensesXmlInsertVersionsMojo extends AbstractLicensesXmlMojo { + private static final Logger LOG = LoggerFactory.getLogger(LicensesXmlInsertVersionsMojo.class); /** * The file whose XML content will be used as a base for adding versions. Defaults to @@ -64,7 +64,7 @@ public class LicensesXmlInsertVersionsMojo * * @since 1.19 */ - @Parameter( property = "license.licensesInputFile" ) + @Parameter(property = "license.licensesInputFile") protected File licensesInputFile; /** @@ -72,110 +72,92 @@ public class LicensesXmlInsertVersionsMojo * * @since 1.19 */ - @Parameter( property = "license.skipDownloadLicenses", defaultValue = "false" ) + @Parameter(property = "license.skipDownloadLicenses", defaultValue = "false") private boolean skipDownloadLicenses; - public void execute() - throws MojoExecutionException, MojoFailureException - { + public void execute() throws MojoExecutionException, MojoFailureException { - if ( skipDownloadLicenses ) - { - LOG.info( "Skipping due to skipDownloadLicenses = true" ); + if (skipDownloadLicenses) { + LOG.info("Skipping due to skipDownloadLicenses = true"); return; } - if ( licensesInputFile == null ) - { + if (licensesInputFile == null) { licensesInputFile = licensesOutputFile; } - try - { - FileUtil.createDirectoryIfNecessary( licensesOutputFile.getParentFile() ); + try { + FileUtil.createDirectoryIfNecessary(licensesOutputFile.getParentFile()); final List projectLicenseInfos = - LicenseSummaryReader.parseLicenseSummary( licensesInputFile ); + LicenseSummaryReader.parseLicenseSummary(licensesInputFile); - if ( projectLicenseInfos.isEmpty() && licensesInputFile.equals( licensesOutputFile ) ) - { - LOG.info( "Nothing to do. The licensesInputFile \"{}\" is either empty or does not exist.", - licensesInputFile ); + if (projectLicenseInfos.isEmpty() && licensesInputFile.equals(licensesOutputFile)) { + LOG.info( + "Nothing to do. The licensesInputFile \"{}\" is either empty or does not exist.", + licensesInputFile); return; } final ArtifactFilters.Builder artifactFiltersBuilder = ArtifactFilters.buidler(); - for ( ProjectLicenseInfo dep : projectLicenseInfos ) - { - artifactFiltersBuilder.includeGa( "\\Q" + dep.getGroupId() + ":" + dep.getArtifactId() + "\\E" ); + for (ProjectLicenseInfo dep : projectLicenseInfos) { + artifactFiltersBuilder.includeGa("\\Q" + dep.getGroupId() + ":" + dep.getArtifactId() + "\\E"); } final ArtifactFilters artifactFilters = artifactFiltersBuilder.build(); - final MavenProjectDependenciesConfigurator config = new MavenProjectDependenciesConfigurator() - { + final MavenProjectDependenciesConfigurator config = new MavenProjectDependenciesConfigurator() { @Override - public boolean isVerbose() - { + public boolean isVerbose() { return getLog().isDebugEnabled(); } @Override - public boolean isIncludeTransitiveDependencies() - { + public boolean isIncludeTransitiveDependencies() { return true; } @Override - public boolean isExcludeTransitiveDependencies() - { + public boolean isExcludeTransitiveDependencies() { return false; } @Override - public ArtifactFilters getArtifactFilters() - { + public ArtifactFilters getArtifactFilters() { return artifactFilters; } }; final Map resolvedDeps = new TreeMap(); licensedArtifactResolver.loadProjectDependencies( - new ResolvedProjectDependencies( project.getArtifacts(), project.getDependencyArtifacts() ), - config, remoteRepositories, resolvedDeps ); - final Map resolvedDepsMap = new HashMap<>( resolvedDeps.size() ); - for ( LicensedArtifact dep : resolvedDeps.values() ) - { - resolvedDepsMap.put( dep.getGroupId() + ":" + dep.getArtifactId(), dep ); + new ResolvedProjectDependencies(project.getArtifacts(), project.getDependencyArtifacts()), + config, + remoteRepositories, + resolvedDeps); + final Map resolvedDepsMap = new HashMap<>(resolvedDeps.size()); + for (LicensedArtifact dep : resolvedDeps.values()) { + resolvedDepsMap.put(dep.getGroupId() + ":" + dep.getArtifactId(), dep); } - for ( ProjectLicenseInfo dependencyLicenseInfo : projectLicenseInfos ) - { - LOG.debug( "Checking licenses for project {}", dependencyLicenseInfo ); + for (ProjectLicenseInfo dependencyLicenseInfo : projectLicenseInfos) { + LOG.debug("Checking licenses for project {}", dependencyLicenseInfo); final String id = dependencyLicenseInfo.getId(); - final LicensedArtifact dependency = resolvedDepsMap.get( id ); - if ( dependency == null ) - { - throw new MojoFailureException( "Could not resolve version of " + id + " in file " - + licensesOutputFile ); + final LicensedArtifact dependency = resolvedDepsMap.get(id); + if (dependency == null) { + throw new MojoFailureException( + "Could not resolve version of " + id + " in file " + licensesOutputFile); } - dependencyLicenseInfo.setVersion( dependency.getVersion() ); + dependencyLicenseInfo.setVersion(dependency.getVersion()); } - writeLicenseSummary( projectLicenseInfos, licensesOutputFile, true ); - } - catch ( MojoFailureException e ) - { + writeLicenseSummary(projectLicenseInfos, licensesOutputFile, true); + } catch (MojoFailureException e) { throw e; - } - catch ( Exception e ) - { - throw new MojoExecutionException( "Unable to write license summary file: " + licensesOutputFile, e ); + } catch (Exception e) { + throw new MojoExecutionException("Unable to write license summary file: " + licensesOutputFile, e); } } - protected Path[] getAutodetectEolFiles() - { - return new Path[] { licensesInputFile.toPath(), licensesOutputFile.toPath() }; + protected Path[] getAutodetectEolFiles() { + return new Path[] {licensesInputFile.toPath(), licensesOutputFile.toPath()}; } - } diff --git a/src/main/java/org/codehaus/mojo/license/RemoveFileHeaderMojo.java b/src/main/java/org/codehaus/mojo/license/RemoveFileHeaderMojo.java index 4e0874986..60453e498 100644 --- a/src/main/java/org/codehaus/mojo/license/RemoveFileHeaderMojo.java +++ b/src/main/java/org/codehaus/mojo/license/RemoveFileHeaderMojo.java @@ -22,6 +22,16 @@ * #L% */ +import java.io.File; +import java.io.IOException; +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + import freemarker.template.Template; import org.apache.commons.lang3.StringUtils; import org.apache.maven.plugins.annotations.Component; @@ -35,26 +45,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; -import java.io.IOException; -import java.util.Collections; -import java.util.EnumMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - /** * The goal to remove the header on project source files. * * @author tchemit dev@tchemit.fr * @since 1.11 */ -@Mojo( name = "remove-file-header", threadSafe = true ) -public class RemoveFileHeaderMojo extends AbstractLicenseNameMojo -{ - private static final Logger LOG = LoggerFactory.getLogger( RemoveFileHeaderMojo.class ); +@Mojo(name = "remove-file-header", threadSafe = true) +public class RemoveFileHeaderMojo extends AbstractLicenseNameMojo { + private static final Logger LOG = LoggerFactory.getLogger(RemoveFileHeaderMojo.class); // ---------------------------------------------------------------------- // Mojo Parameters @@ -65,7 +64,7 @@ public class RemoveFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.11 */ - @Parameter( property = "license.skipRemoveLicense", defaultValue = "false" ) + @Parameter(property = "license.skipRemoveLicense", defaultValue = "false") private boolean skipRemoveLicense; /** @@ -73,7 +72,7 @@ public class RemoveFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.11 */ - @Parameter( property = "dryRun", defaultValue = "false" ) + @Parameter(property = "dryRun", defaultValue = "false") private boolean dryRun; /** @@ -85,7 +84,7 @@ public class RemoveFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.11 */ - @Parameter( property = "license.ignoreNoFileToScan", defaultValue = "false" ) + @Parameter(property = "license.ignoreNoFileToScan", defaultValue = "false") private boolean ignoreNoFileToScan; /** @@ -100,7 +99,7 @@ public class RemoveFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.11 */ - @Parameter( property = "license.roots" ) + @Parameter(property = "license.roots") private String[] roots; /** @@ -108,7 +107,7 @@ public class RemoveFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.11 */ - @Parameter( property = "license.includes" ) + @Parameter(property = "license.includes") private String[] includes; /** @@ -121,7 +120,7 @@ public class RemoveFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.11 */ - @Parameter( property = "license.excludes" ) + @Parameter(property = "license.excludes") private String[] excludes; /** @@ -173,7 +172,7 @@ public class RemoveFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.0 */ - @Parameter( property = "license.ignoreTag" ) + @Parameter(property = "license.ignoreTag") private String ignoreTag; // ---------------------------------------------------------------------- @@ -185,7 +184,7 @@ public class RemoveFileHeaderMojo extends AbstractLicenseNameMojo * * @since 1.0 */ - @Component( role = FileHeaderTransformer.class ) + @Component(role = FileHeaderTransformer.class) private Map transformers; // ---------------------------------------------------------------------- @@ -224,8 +223,7 @@ public class RemoveFileHeaderMojo extends AbstractLicenseNameMojo // ---------------------------------------------------------------------- @Override - public boolean isSkip() - { + public boolean isSkip() { return skipRemoveLicense; } @@ -234,30 +232,26 @@ public boolean isSkip() // ---------------------------------------------------------------------- @Override - public void init() throws Exception - { + public void init() throws Exception { - if ( StringUtils.isEmpty( ignoreTag ) ) - { + if (StringUtils.isEmpty(ignoreTag)) { // use default value this.ignoreTag = "%" + "%Ignore-License"; } - if ( isVerbose() ) - { + if (isVerbose()) { // print available comment styles (transformers) StringBuilder buffer = new StringBuilder(); - buffer.append( "config - available comment styles :" ); + buffer.append("config - available comment styles :"); String commentFormat = "\n * %1$s (%2$s)"; - for ( String transformerName : transformers.keySet() ) - { - FileHeaderTransformer aTransformer = getTransformer( transformers, transformerName ); - String str = String.format( commentFormat, aTransformer.getName(), aTransformer.getDescription() ); - buffer.append( str ); + for (String transformerName : transformers.keySet()) { + FileHeaderTransformer aTransformer = getTransformer(transformers, transformerName); + String str = String.format(commentFormat, aTransformer.getName(), aTransformer.getDescription()); + buffer.append(str); } - LOG.info( "{}", buffer ); + LOG.info("{}", buffer); } // set timestamp used for temporary files @@ -265,146 +259,120 @@ public void init() throws Exception super.init(); - if ( roots == null || roots.length == 0 ) - { + if (roots == null || roots.length == 0) { roots = DEFAULT_ROOTS; - if ( isVerbose() ) - { - LOG.info( "Will use default roots {}", ( Object ) roots ); + if (isVerbose()) { + LOG.info("Will use default roots {}", (Object) roots); } } - if ( includes == null || includes.length == 0 ) - { + if (includes == null || includes.length == 0) { includes = DEFAULT_INCLUDES; - if ( isVerbose() ) - { - LOG.info( "Will use default includes {}", ( Object ) includes ); + if (isVerbose()) { + LOG.info("Will use default includes {}", (Object) includes); } } - if ( excludes == null || excludes.length == 0 ) - { + if (excludes == null || excludes.length == 0) { excludes = DEFAULT_EXCLUDES; - if ( isVerbose() ) - { - LOG.info( "Will use default excludes {}", ( Object ) excludes ); + if (isVerbose()) { + LOG.info("Will use default excludes {}", (Object) excludes); } } Map extensionToCommentStyle = new TreeMap<>(); // add default extensions from header transformers - for ( Map.Entry entry : transformers.entrySet() ) - { + for (Map.Entry entry : transformers.entrySet()) { String commentStyle = entry.getKey(); FileHeaderTransformer aTransformer = entry.getValue(); String[] extensions = aTransformer.getDefaultAcceptedExtensions(); - for ( String extension : extensions ) - { - if ( isVerbose() ) - { - LOG.info( "Associate extension '{}' to comment style '{}'", extension, commentStyle ); + for (String extension : extensions) { + if (isVerbose()) { + LOG.info("Associate extension '{}' to comment style '{}'", extension, commentStyle); } - extensionToCommentStyle.put( extension, commentStyle ); + extensionToCommentStyle.put(extension, commentStyle); } } - if ( extraExtensions != null ) - { + if (extraExtensions != null) { // fill extra extensions for each transformer - for ( Map.Entry entry : extraExtensions.entrySet() ) - { + for (Map.Entry entry : extraExtensions.entrySet()) { String extension = entry.getKey(); - if ( extensionToCommentStyle.containsKey( extension ) ) - { + if (extensionToCommentStyle.containsKey(extension)) { // override existing extension mapping - LOG.warn( "The extension '{}' is already accepted for comment style '{}'", - extension, extensionToCommentStyle.get( extension ) ); + LOG.warn( + "The extension '{}' is already accepted for comment style '{}'", + extension, + extensionToCommentStyle.get(extension)); } String commentStyle = entry.getValue(); // check transformer exists - getTransformer( transformers, commentStyle ); + getTransformer(transformers, commentStyle); - if ( isVerbose() ) - { - LOG.info( "Associate extension '{}' to comment style '{}'", extension, commentStyle ); + if (isVerbose()) { + LOG.info("Associate extension '{}' to comment style '{}'", extension, commentStyle); } - extensionToCommentStyle.put( extension, commentStyle ); + extensionToCommentStyle.put(extension, commentStyle); } } - if ( extraFiles == null ) - { + if (extraFiles == null) { extraFiles = Collections.emptyMap(); } // get all files to treat indexed by their comment style - filesToTreatByCommentStyle = obtainFilesToProcessByCommentStyle( extraFiles, roots, includes, excludes, - extensionToCommentStyle, transformers ); + filesToTreatByCommentStyle = obtainFilesToProcessByCommentStyle( + extraFiles, roots, includes, excludes, extensionToCommentStyle, transformers); } @Override - public void doAction() throws Exception - { + public void doAction() throws Exception { long t0 = System.nanoTime(); processedFiles = new HashSet<>(); - result = new EnumMap<>( FileState.class ); + result = new EnumMap<>(FileState.class); - try - { + try { - for ( Map.Entry> commentStyleFiles : filesToTreatByCommentStyle.entrySet() ) - { + for (Map.Entry> commentStyleFiles : filesToTreatByCommentStyle.entrySet()) { String commentStyle = commentStyleFiles.getKey(); List files = commentStyleFiles.getValue(); - processCommentStyle( commentStyle, files ); + processCommentStyle(commentStyle, files); } - } - finally - { + } finally { int nbFiles = processedFiles.size(); - if ( nbFiles == 0 && !ignoreNoFileToScan ) - { - LOG.warn( "No file to scan." ); - } - else - { - String delay = MojoHelper.convertTime( System.nanoTime() - t0 ); - LOG.info( "Scanned {} file headers in {}.", nbFiles, delay ); + if (nbFiles == 0 && !ignoreNoFileToScan) { + LOG.warn("No file to scan."); + } else { + String delay = MojoHelper.convertTime(System.nanoTime() - t0); + LOG.info("Scanned {} file headers in {}.", nbFiles, delay); } Set states = result.keySet(); - if ( states.size() == 1 && states.contains( FileState.uptodate ) ) - { + if (states.size() == 1 && states.contains(FileState.uptodate)) { // all files where up to date - LOG.info( "All files are up-to-date." ); - } - else - { + LOG.info("All files are up-to-date."); + } else { StringBuilder buffer = new StringBuilder(); - for ( FileState state : FileState.values() ) - { + for (FileState state : FileState.values()) { - reportType( result, state, buffer ); + reportType(result, state, buffer); } - LOG.info( "{}", buffer ); + LOG.info("{}", buffer); } - } } - private boolean isDryRun() - { + private boolean isDryRun() { return dryRun; } @@ -415,89 +383,75 @@ private boolean isDryRun() * @param filesToTreat files using this comment style to treat * @throws IOException if any IO error while processing files */ - private void processCommentStyle( String commentStyle, List filesToTreat ) throws IOException - { + private void processCommentStyle(String commentStyle, List filesToTreat) throws IOException { // obtain license from definition - License license = getLicense( getLicenseName(), true ); + License license = getLicense(getLicenseName(), true); - if ( isVerbose() ) - { - LOG.info( "Process header '{}'", commentStyle ); - LOG.info( " - using {}", license.getDescription() ); + if (isVerbose()) { + LOG.info("Process header '{}'", commentStyle); + LOG.info(" - using {}", license.getDescription()); } // use header transformer according to comment style given in header - FileHeaderTransformer transformer = getTransformer( transformers, commentStyle ); + FileHeaderTransformer transformer = getTransformer(transformers, commentStyle); - - for ( File file : filesToTreat ) - { - processFile( transformer, file ); + for (File file : filesToTreat) { + processFile(transformer, file); } filesToTreat.clear(); } - private boolean processFile( FileHeaderTransformer transformer, File file, File processFile ) throws IOException - { + private boolean processFile(FileHeaderTransformer transformer, File file, File processFile) throws IOException { String content; - try - { - content = FileUtil.readAsString( file, getEncoding() ); - } - catch ( IOException e ) - { - throw new IOException( "Could not obtain content of file " + file ); + try { + content = FileUtil.readAsString(file, getEncoding()); + } catch (IOException e) { + throw new IOException("Could not obtain content of file " + file); } - //check that file is not marked to be ignored - if ( content.contains( ignoreTag ) ) - { - LOG.info( " - ignore file (detected {}) {}", ignoreTag, file ); + // check that file is not marked to be ignored + if (content.contains(ignoreTag)) { + LOG.info(" - ignore file (detected {}) {}", ignoreTag, file); - FileState.ignore.addFile( file, result ); + FileState.ignore.addFile(file, result); return false; } String commentStartTag = transformer.getCommentStartTag(); - int firstIndex = content.indexOf( commentStartTag ); - if ( firstIndex == -1 ) - { + int firstIndex = content.indexOf(commentStartTag); + if (firstIndex == -1) { - FileState.uptodate.addFile( file, result ); + FileState.uptodate.addFile(file, result); return false; } char lastchar = ' '; - while ( lastchar != '\n' && firstIndex > 0 ) - { - lastchar = content.charAt( ( --firstIndex ) ); + while (lastchar != '\n' && firstIndex > 0) { + lastchar = content.charAt((--firstIndex)); } String commentEndTag = transformer.getCommentEndTag(); - int lastIndex = content.indexOf( commentEndTag ); - if ( lastIndex == -1 ) - { - FileState.uptodate.addFile( file, result ); + int lastIndex = content.indexOf(commentEndTag); + if (lastIndex == -1) { + FileState.uptodate.addFile(file, result); return false; } lastchar = ' '; - while ( lastchar != '\n' ) - { - lastchar = content.charAt( ( ++lastIndex ) ); + while (lastchar != '\n') { + lastchar = content.charAt((++lastIndex)); } - if ( isVerbose() ) - { - LOG.info( " - header was removed for {}", file ); + if (isVerbose()) { + LOG.info(" - header was removed for {}", file); } - String contentWithoutHeader = content.substring( 0, firstIndex ) + content.substring( lastIndex + 1 ); + String contentWithoutHeader = content.substring(0, firstIndex) + content.substring(lastIndex + 1); - FileUtils.fileWrite( processFile, contentWithoutHeader ); - FileState.remove.addFile( file, result ); + FileUtils.fileWrite(processFile, contentWithoutHeader); + FileState.remove.addFile(file, result); return true; } @@ -508,44 +462,35 @@ private boolean processFile( FileHeaderTransformer transformer, File file, File * @param file original file to process * @throws IOException if any IO error while processing this file */ - private void processFile( FileHeaderTransformer transformer, File file ) throws IOException - { + private void processFile(FileHeaderTransformer transformer, File file) throws IOException { - if ( processedFiles.contains( file ) ) - { - LOG.info( " - skip already processed file {}", file ); + if (processedFiles.contains(file)) { + LOG.info(" - skip already processed file {}", file); return; } // output file - File processFile = new File( file.getAbsolutePath() + "_" + timestamp ); + File processFile = new File(file.getAbsolutePath() + "_" + timestamp); boolean doFinalize = false; - try - { - doFinalize = processFile( transformer, file, processFile ); - } - catch ( Exception e ) - { - LOG.warn( "skip failed file: {}{}", - e.getMessage(), - e.getCause() == null ? "" : " Cause : " + e.getCause().getMessage(), - e ); - FileState.fail.addFile( file, result ); + try { + doFinalize = processFile(transformer, file, processFile); + } catch (Exception e) { + LOG.warn( + "skip failed file: {}{}", + e.getMessage(), + e.getCause() == null ? "" : " Cause : " + e.getCause().getMessage(), + e); + FileState.fail.addFile(file, result); doFinalize = false; - } - finally - { + } finally { // whatever was the result, this file is treated. - processedFiles.add( file ); + processedFiles.add(file); - if ( doFinalize ) - { - finalizeFile( file, processFile ); - } - else - { - FileUtil.deleteFile( processFile ); + if (doFinalize) { + finalizeFile(file, processFile); + } else { + FileUtil.deleteFile(processFile); } } } @@ -559,43 +504,33 @@ private void processFile( FileHeaderTransformer transformer, File file ) throws * @param processFile the processed file * @throws IOException if any IO error while finalizing file */ - private void finalizeFile( File file, File processFile ) throws IOException - { + private void finalizeFile(File file, File processFile) throws IOException { - if ( isKeepBackup() && !isDryRun() ) - { - File backupFile = FileUtil.getBackupFile( file ); + if (isKeepBackup() && !isDryRun()) { + File backupFile = FileUtil.getBackupFile(file); - if ( backupFile.exists() ) - { + if (backupFile.exists()) { // always delete backup file, before the renaming - FileUtil.deleteFile( backupFile ); + FileUtil.deleteFile(backupFile); } - LOG.debug( " - backup original file {}", file ); - FileUtil.renameFile( file, backupFile ); + LOG.debug(" - backup original file {}", file); + FileUtil.renameFile(file, backupFile); } - if ( isDryRun() ) - { + if (isDryRun()) { // dry run, delete temporary file - FileUtil.deleteFile( processFile ); - } - else - { - try - { + FileUtil.deleteFile(processFile); + } else { + try { // replace file with the updated one - FileUtil.renameFile( processFile, file ); - } - catch ( IOException e ) - { - LOG.warn( e.getMessage(), e ); + FileUtil.renameFile(processFile, file); + } catch (IOException e) { + LOG.warn(e.getMessage(), e); } } } - } diff --git a/src/main/java/org/codehaus/mojo/license/ThirdPartyReportMojo.java b/src/main/java/org/codehaus/mojo/license/ThirdPartyReportMojo.java index 81f2cd4da..870cd48ae 100644 --- a/src/main/java/org/codehaus/mojo/license/ThirdPartyReportMojo.java +++ b/src/main/java/org/codehaus/mojo/license/ThirdPartyReportMojo.java @@ -22,6 +22,9 @@ * #L% */ +import java.io.IOException; +import java.util.Collection; + import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; @@ -32,18 +35,14 @@ import org.codehaus.mojo.license.api.ThirdPartyDetails; import org.codehaus.mojo.license.api.ThirdPartyToolException; -import java.io.IOException; -import java.util.Collection; - /** * Generates a report of all third-parties detected in the module. * * @author tchemit dev@tchemit.fr * @since 1.1 */ -@Mojo( name = "third-party-report", requiresDependencyResolution = ResolutionScope.TEST ) -public class ThirdPartyReportMojo extends AbstractThirdPartyReportMojo -{ +@Mojo(name = "third-party-report", requiresDependencyResolution = ResolutionScope.TEST) +public class ThirdPartyReportMojo extends AbstractThirdPartyReportMojo { // ---------------------------------------------------------------------- // Mojo Parameters @@ -54,7 +53,7 @@ public class ThirdPartyReportMojo extends AbstractThirdPartyReportMojo * * @since 1.1 */ - @Parameter( property = "license.skipThirdPartyReport", defaultValue = "false" ) + @Parameter(property = "license.skipThirdPartyReport", defaultValue = "false") private boolean skipThirdPartyReport; // ---------------------------------------------------------------------- @@ -64,14 +63,12 @@ public class ThirdPartyReportMojo extends AbstractThirdPartyReportMojo /** * {@inheritDoc} */ - public String getOutputName() - { + public String getOutputName() { return "third-party-report"; } @Override - public boolean canGenerateReport() - { + public boolean canGenerateReport() { return !skipThirdPartyReport; } @@ -84,9 +81,8 @@ public boolean canGenerateReport() */ @Override protected Collection createThirdPartyDetails() - throws IOException, ThirdPartyToolException, ProjectBuildingException, MojoFailureException, - DependenciesToolException, MojoExecutionException - { - return createThirdPartyDetails( getProject(), false ); + throws IOException, ThirdPartyToolException, ProjectBuildingException, MojoFailureException, + DependenciesToolException, MojoExecutionException { + return createThirdPartyDetails(getProject(), false); } } diff --git a/src/main/java/org/codehaus/mojo/license/ThirdPartyReportRenderer.java b/src/main/java/org/codehaus/mojo/license/ThirdPartyReportRenderer.java index a7927b1f0..cb51b25eb 100644 --- a/src/main/java/org/codehaus/mojo/license/ThirdPartyReportRenderer.java +++ b/src/main/java/org/codehaus/mojo/license/ThirdPartyReportRenderer.java @@ -22,67 +22,55 @@ * #L% */ +import java.util.ArrayList; +import java.util.Collection; +import java.util.Locale; + import org.apache.commons.collections.CollectionUtils; import org.apache.maven.doxia.sink.Sink; import org.codehaus.mojo.license.api.ThirdPartyDetails; import org.codehaus.plexus.i18n.I18N; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Locale; - /** * Generates a report of third parties of the project. * * @author tchemit dev@tchemit.fr * @since 1.1 */ -public class ThirdPartyReportRenderer - extends AbstractLicenseReportRenderer -{ +public class ThirdPartyReportRenderer extends AbstractLicenseReportRenderer { private final Collection details; - public ThirdPartyReportRenderer( Sink sink, I18N i18n, String outputName, Locale locale, - Collection details ) - { - super( sink, outputName, i18n, locale ); + public ThirdPartyReportRenderer( + Sink sink, I18N i18n, String outputName, Locale locale, Collection details) { + super(sink, outputName, i18n, locale); this.details = details; } - protected Collection getThirdPartiesPomLicense() - { + protected Collection getThirdPartiesPomLicense() { Collection result = new ArrayList<>(); - for ( ThirdPartyDetails detail : details ) - { - if ( detail.hasPomLicenses() ) - { - result.add( detail ); + for (ThirdPartyDetails detail : details) { + if (detail.hasPomLicenses()) { + result.add(detail); } } return result; } - protected Collection getThirdPartiesThirdPartyLicense() - { + protected Collection getThirdPartiesThirdPartyLicense() { Collection result = new ArrayList<>(); - for ( ThirdPartyDetails detail : details ) - { - if ( detail.hasThirdPartyLicenses() ) - { - result.add( detail ); + for (ThirdPartyDetails detail : details) { + if (detail.hasThirdPartyLicenses()) { + result.add(detail); } } return result; } - protected Collection getThirdPartiesNoLicense() - { + protected Collection getThirdPartiesNoLicense() { Collection result = new ArrayList<>(); - for ( ThirdPartyDetails detail : details ) - { - if ( !detail.hasLicenses() ) - { - result.add( detail ); + for (ThirdPartyDetails detail : details) { + if (!detail.hasLicenses()) { + result.add(detail); } } return result; @@ -91,20 +79,19 @@ protected Collection getThirdPartiesNoLicense() /** * {@inheritDoc} */ - protected void renderBody() - { + protected void renderBody() { sink.section1(); sink.sectionTitle1(); - sink.text( getText( "report.overview.title" ) ); + sink.text(getText("report.overview.title")); sink.sectionTitle1_(); sink.paragraph(); - sink.text( getText( "report.overview.text" ) ); + sink.text(getText("report.overview.text")); sink.paragraph_(); - renderSummaryTotalsTable( details ); + renderSummaryTotalsTable(details); - renderSummaryTable( "report.overview.thirdParty", details, "report.overview.nothirdParty" ); + renderSummaryTable("report.overview.thirdParty", details, "report.overview.nothirdParty"); sink.section1_(); @@ -115,20 +102,18 @@ protected void renderBody() dependencies = getThirdPartiesNoLicense(); sink.section1(); sink.sectionTitle1(); - sink.text( getText( "report.detail.title.noLicense" ) ); + sink.text(getText("report.detail.title.noLicense")); sink.sectionTitle1_(); sink.paragraph(); - sink.text( getText( "report.detail.text.noLicense" ) ); - if ( CollectionUtils.isEmpty( dependencies ) ) - { + sink.text(getText("report.detail.text.noLicense")); + if (CollectionUtils.isEmpty(dependencies)) { sink.lineBreak(); - sink.text( getText( "report.detail.text.emptyList" ) ); + sink.text(getText("report.detail.text.emptyList")); } sink.paragraph_(); - for ( final ThirdPartyDetails detail : dependencies ) - { - renderThirdPartyDetail( detail ); + for (final ThirdPartyDetails detail : dependencies) { + renderThirdPartyDetail(detail); } sink.section1_(); @@ -137,20 +122,18 @@ protected void renderBody() dependencies = getThirdPartiesThirdPartyLicense(); sink.section1(); sink.sectionTitle1(); - sink.text( getText( "report.detail.title.thirdPartyLicense" ) ); + sink.text(getText("report.detail.title.thirdPartyLicense")); sink.sectionTitle1_(); sink.paragraph(); - sink.text( getText( "report.detail.text.thirdPartyLicense" ) ); - if ( CollectionUtils.isEmpty( dependencies ) ) - { + sink.text(getText("report.detail.text.thirdPartyLicense")); + if (CollectionUtils.isEmpty(dependencies)) { sink.lineBreak(); - sink.text( getText( "report.detail.text.emptyList" ) ); + sink.text(getText("report.detail.text.emptyList")); } sink.paragraph_(); - for ( final ThirdPartyDetails detail : dependencies ) - { - renderThirdPartyDetail( detail ); + for (final ThirdPartyDetails detail : dependencies) { + renderThirdPartyDetail(detail); } sink.section1_(); @@ -159,41 +142,32 @@ protected void renderBody() dependencies = getThirdPartiesPomLicense(); sink.section1(); sink.sectionTitle1(); - sink.text( getText( "report.detail.title.pomLicense" ) ); + sink.text(getText("report.detail.title.pomLicense")); sink.sectionTitle1_(); sink.paragraph(); - sink.text( getText( "report.detail.text.pomLicense" ) ); - if ( CollectionUtils.isEmpty( dependencies ) ) - { + sink.text(getText("report.detail.text.pomLicense")); + if (CollectionUtils.isEmpty(dependencies)) { sink.lineBreak(); - sink.text( getText( "report.detail.text.emptyList" ) ); + sink.text(getText("report.detail.text.emptyList")); } sink.paragraph_(); - for ( final ThirdPartyDetails detail : dependencies ) - { - renderThirdPartyDetail( detail ); + for (final ThirdPartyDetails detail : dependencies) { + renderThirdPartyDetail(detail); } sink.section1_(); } - private void renderSummaryTotalsTable( Collection allThirdParties ) - { + private void renderSummaryTotalsTable(Collection allThirdParties) { int numWithPomLicense = 0; int numWithThirdPartyLicense = 0; int numWithNoLicense = 0; - for ( ThirdPartyDetails detail : allThirdParties ) - { - if ( detail.hasPomLicenses() ) - { + for (ThirdPartyDetails detail : allThirdParties) { + if (detail.hasPomLicenses()) { numWithPomLicense++; - } - else if ( detail.hasThirdPartyLicenses() ) - { + } else if (detail.hasThirdPartyLicenses()) { numWithThirdPartyLicense++; - } - else - { + } else { numWithNoLicense++; } } @@ -203,70 +177,63 @@ else if ( detail.hasThirdPartyLicenses() ) sink.tableCell(); renderInfoIcon(); sink.tableCell_(); - sinkCellText( getText( "report.overview.numThirdParties" ) ); - sinkCellText( Integer.toString( allThirdParties.size() ) ); + sinkCellText(getText("report.overview.numThirdParties")); + sinkCellText(Integer.toString(allThirdParties.size())); sink.tableRow_(); sink.tableRow(); sink.tableCell(); renderSuccessIcon(); sink.tableCell_(); - sinkCellText( getText( "report.overview.numWithPomLicenses" ) ); - sinkCellText( Integer.toString( numWithPomLicense ) ); + sinkCellText(getText("report.overview.numWithPomLicenses")); + sinkCellText(Integer.toString(numWithPomLicense)); sink.tableRow_(); sink.tableRow(); sink.tableCell(); renderWarningIcon(); sink.tableCell_(); - sinkCellText( getText( "report.overview.numWithThirdPartyLicenses" ) ); - sinkCellText( Integer.toString( numWithThirdPartyLicense ) ); + sinkCellText(getText("report.overview.numWithThirdPartyLicenses")); + sinkCellText(Integer.toString(numWithThirdPartyLicense)); sink.tableRow_(); sink.tableRow(); sink.tableCell(); renderErrorIcon(); sink.tableCell_(); - sinkCellText( getText( "report.overview.numWithNoLicense" ) ); - sinkCellText( Integer.toString( numWithNoLicense ) ); + sinkCellText(getText("report.overview.numWithNoLicense")); + sinkCellText(Integer.toString(numWithNoLicense)); sink.tableRow_(); sink.table_(); } - private void renderSummaryTable( String titleKey, Collection contents, String emptyKey ) - { + private void renderSummaryTable(String titleKey, Collection contents, String emptyKey) { sink.section2(); sink.sectionTitle2(); - sink.text( getText( titleKey ) ); + sink.text(getText(titleKey)); sink.sectionTitle2_(); - if ( contents.isEmpty() ) - { + if (contents.isEmpty()) { sink.paragraph(); - sink.text( getText( emptyKey ) ); + sink.text(getText(emptyKey)); sink.paragraph_(); - } - else - { - renderThirdPartySummaryTable( contents ); + } else { + renderThirdPartySummaryTable(contents); } sink.section2_(); } - private void renderThirdPartyDetail( ThirdPartyDetails detail ) - { + private void renderThirdPartyDetail(ThirdPartyDetails detail) { sink.section2(); sink.sectionTitle2(); - sink.text( getGAV( detail ) ); + sink.text(getGAV(detail)); sink.sectionTitle2_(); - renderThirdPartyDetailTable( detail ); + renderThirdPartyDetailTable(detail); - sink.link( "#" + getText( "report.overview.title" ) ); - sink.text( getText( "report.back.to.top.page" ) ); + sink.link("#" + getText("report.overview.title")); + sink.text(getText("report.back.to.top.page")); sink.link_(); sink.lineBreak(); sink.section2_(); } - - } diff --git a/src/main/java/org/codehaus/mojo/license/UpdateFileHeaderMojo.java b/src/main/java/org/codehaus/mojo/license/UpdateFileHeaderMojo.java index 0a3848817..0dacd5a6a 100644 --- a/src/main/java/org/codehaus/mojo/license/UpdateFileHeaderMojo.java +++ b/src/main/java/org/codehaus/mojo/license/UpdateFileHeaderMojo.java @@ -37,9 +37,8 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -@Mojo( name = "update-file-header", threadSafe = true ) -public class UpdateFileHeaderMojo extends AbstractFileHeaderMojo -{ +@Mojo(name = "update-file-header", threadSafe = true) +public class UpdateFileHeaderMojo extends AbstractFileHeaderMojo { // ---------------------------------------------------------------------- // Mojo Parameters @@ -53,7 +52,7 @@ public class UpdateFileHeaderMojo extends AbstractFileHeaderMojo * * @since 1.2 */ - @Parameter( property = "license.failOnMissingHeader", defaultValue = "false" ) + @Parameter(property = "license.failOnMissingHeader", defaultValue = "false") private boolean failOnMissingHeader; /** @@ -64,7 +63,7 @@ public class UpdateFileHeaderMojo extends AbstractFileHeaderMojo * * @since 1.2 */ - @Parameter( property = "license.failOnNotUptodateHeader", defaultValue = "false" ) + @Parameter(property = "license.failOnNotUptodateHeader", defaultValue = "false") private boolean failOnNotUptodateHeader; /** @@ -72,7 +71,7 @@ public class UpdateFileHeaderMojo extends AbstractFileHeaderMojo * * @since 1.0 */ - @Parameter( property = "license.skipUpdateLicense", defaultValue = "false" ) + @Parameter(property = "license.skipUpdateLicense", defaultValue = "false") private boolean skipUpdateLicense; /** @@ -80,7 +79,7 @@ public class UpdateFileHeaderMojo extends AbstractFileHeaderMojo * * @since 1.0 */ - @Parameter( property = "dryRun", defaultValue = "false" ) + @Parameter(property = "dryRun", defaultValue = "false") private boolean dryRun; // ---------------------------------------------------------------------- @@ -88,8 +87,7 @@ public class UpdateFileHeaderMojo extends AbstractFileHeaderMojo // ---------------------------------------------------------------------- @Override - public boolean isSkip() - { + public boolean isSkip() { return skipUpdateLicense; } @@ -98,21 +96,17 @@ public boolean isSkip() // ---------------------------------------------------------------------- @Override - protected boolean isDryRun() - { + protected boolean isDryRun() { return dryRun; } @Override - protected boolean isFailOnMissingHeader() - { + protected boolean isFailOnMissingHeader() { return failOnMissingHeader; } @Override - protected boolean isFailOnNotUptodateHeader() - { + protected boolean isFailOnNotUptodateHeader() { return failOnNotUptodateHeader; } - } diff --git a/src/main/java/org/codehaus/mojo/license/UpdateProjectLicenseMojo.java b/src/main/java/org/codehaus/mojo/license/UpdateProjectLicenseMojo.java index 0390e20e2..c09674794 100644 --- a/src/main/java/org/codehaus/mojo/license/UpdateProjectLicenseMojo.java +++ b/src/main/java/org/codehaus/mojo/license/UpdateProjectLicenseMojo.java @@ -22,6 +22,8 @@ * #L% */ +import java.io.File; + import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -30,8 +32,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; - /** * Updates (or creates) the main project license file according to the given * license defines as {@link #licenseName}. @@ -43,11 +43,9 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -@Mojo( name = "update-project-license", defaultPhase = LifecyclePhase.GENERATE_RESOURCES ) -public class UpdateProjectLicenseMojo - extends AbstractLicenseNameMojo -{ - private static final Logger LOG = LoggerFactory.getLogger( UpdateProjectLicenseMojo.class ); +@Mojo(name = "update-project-license", defaultPhase = LifecyclePhase.GENERATE_RESOURCES) +public class UpdateProjectLicenseMojo extends AbstractLicenseNameMojo { + private static final Logger LOG = LoggerFactory.getLogger(UpdateProjectLicenseMojo.class); // ---------------------------------------------------------------------- // Mojo Parameters @@ -60,7 +58,7 @@ public class UpdateProjectLicenseMojo * @required * @since 1.0 */ - @Parameter( property = "license.licenceFile", defaultValue = "${basedir}/LICENSE.txt" ) + @Parameter(property = "license.licenceFile", defaultValue = "${basedir}/LICENSE.txt") protected File licenseFile; /** @@ -70,7 +68,7 @@ public class UpdateProjectLicenseMojo * * @since 1.0 */ - @Parameter( property = "license.outputDirectory", defaultValue = "target/generated-sources/license" ) + @Parameter(property = "license.outputDirectory", defaultValue = "target/generated-sources/license") protected File outputDirectory; /** @@ -86,7 +84,7 @@ public class UpdateProjectLicenseMojo * * @since 1.0 */ - @Parameter( property = "license.generateBundle", defaultValue = "false" ) + @Parameter(property = "license.generateBundle", defaultValue = "false") protected boolean generateBundle; /** @@ -97,7 +95,7 @@ public class UpdateProjectLicenseMojo * * @since 1.0 */ - @Parameter( property = "license.bundleLicensePath", defaultValue = "META-INF/${project.artifactId}-LICENSE.txt" ) + @Parameter(property = "license.bundleLicensePath", defaultValue = "META-INF/${project.artifactId}-LICENSE.txt") protected String bundleLicensePath; /** @@ -105,7 +103,7 @@ public class UpdateProjectLicenseMojo * * @since 1.0.0 */ - @Parameter( property = "license.force", defaultValue = "false" ) + @Parameter(property = "license.force", defaultValue = "false") protected boolean force; /** @@ -113,7 +111,7 @@ public class UpdateProjectLicenseMojo * * @since 1.0 */ - @Parameter( property = "license.skipUpdateProjectLicense", defaultValue = "false" ) + @Parameter(property = "license.skipUpdateProjectLicense", defaultValue = "false") protected boolean skipUpdateProjectLicense; // ---------------------------------------------------------------------- @@ -133,8 +131,7 @@ public class UpdateProjectLicenseMojo * {@inheritDoc} */ @Override - public boolean isSkip() - { + public boolean isSkip() { return skipUpdateProjectLicense; } @@ -142,14 +139,11 @@ public boolean isSkip() * {@inheritDoc} */ @Override - protected void init() - throws Exception - { + protected void init() throws Exception { super.init(); // must generate if file does not exist or pom never thant license file - if ( licenseFile != null ) - { + if (licenseFile != null) { File pomFile = getProject().getFile(); this.doGenerate = force || !licenseFile.exists() || licenseFile.lastModified() <= pomFile.lastModified(); @@ -160,67 +154,56 @@ protected void init() * {@inheritDoc} */ @Override - protected void doAction() - throws Exception - { + protected void doAction() throws Exception { License license = getLicense(); - if ( doGenerate ) - { + if (doGenerate) { - LOG.info( "Will create or update license file [{}] to {}", license.getName(), licenseFile ); - if ( isVerbose() ) - { - LOG.info( "detail of license :\n{}", license ); + LOG.info("Will create or update license file [{}] to {}", license.getName(), licenseFile); + if (isVerbose()) { + LOG.info("detail of license :\n{}", license); } - if ( licenseFile.exists() && isKeepBackup() ) - { - if ( isVerbose() ) - { - LOG.info( "backup {}", licenseFile ); + if (licenseFile.exists() && isKeepBackup()) { + if (isVerbose()) { + LOG.info("backup {}", licenseFile); } // copy it to backup file - FileUtil.backupFile( licenseFile ); + FileUtil.backupFile(licenseFile); } } // obtain license content - String licenseContent = license.getLicenseContent( getEncoding() ); + String licenseContent = license.getLicenseContent(getEncoding()); - if ( license.isLicenseContentTemplateAware() ) - { + if (license.isLicenseContentTemplateAware()) { - licenseContent = processLicenseContext( licenseContent ); + licenseContent = processLicenseContext(licenseContent); } - if ( doGenerate ) - { + if (doGenerate) { // writes it root main license file - FileUtil.printString( licenseFile, licenseContent, getEncoding() ); + FileUtil.printString(licenseFile, licenseContent, getEncoding()); } - if ( hasClassPath() ) - { + if (hasClassPath()) { // copy the license file to the resources directory - File resourceTarget = new File( outputDirectory, licenseFile.getName() ); - FileUtil.copyFile( this.licenseFile, resourceTarget ); + File resourceTarget = new File(outputDirectory, licenseFile.getName()); + FileUtil.copyFile(this.licenseFile, resourceTarget); - addResourceDir( outputDirectory, "**/" + resourceTarget.getName() ); + addResourceDir(outputDirectory, "**/" + resourceTarget.getName()); - if ( generateBundle ) - { + if (generateBundle) { // creates the bundled license file - File bundleTarget = FileUtil.getFile( outputDirectory, bundleLicensePath ); - FileUtil.copyFile( licenseFile, bundleTarget ); + File bundleTarget = FileUtil.getFile(outputDirectory, bundleLicensePath); + FileUtil.copyFile(licenseFile, bundleTarget); - if ( !resourceTarget.getName().equals( bundleTarget.getName() ) ) - { + if (!resourceTarget.getName().equals(bundleTarget.getName())) { - addResourceDir( outputDirectory, "**/" + bundleTarget.getName() ); + addResourceDir(outputDirectory, "**/" + bundleTarget.getName()); } } } diff --git a/src/main/java/org/codehaus/mojo/license/api/ArtifactFilters.java b/src/main/java/org/codehaus/mojo/license/api/ArtifactFilters.java index fab8e2155..47e746580 100644 --- a/src/main/java/org/codehaus/mojo/license/api/ArtifactFilters.java +++ b/src/main/java/org/codehaus/mojo/license/api/ArtifactFilters.java @@ -44,71 +44,65 @@ * @author Peter Palaga * @since 1.18 */ -public class ArtifactFilters -{ +public class ArtifactFilters { - public static Builder buidler() - { + public static Builder buidler() { return new Builder(); } // CHECKSTYLE_OFF: ParameterNumber - public static ArtifactFilters of( String includedGroups, String excludedGroups, String includedArtifacts, - String excludedArtifacts, String includedScopes, String excludedScopes, - String includedTypes, String excludedTypes, boolean includeOptional, - String artifactFiltersUrl, String encoding ) - // CHECKSTYLE_ON: ParameterNumber - { + public static ArtifactFilters of( + String includedGroups, + String excludedGroups, + String includedArtifacts, + String excludedArtifacts, + String includedScopes, + String excludedScopes, + String includedTypes, + String excludedTypes, + boolean includeOptional, + String artifactFiltersUrl, + String encoding) + // CHECKSTYLE_ON: ParameterNumber + { Builder builder = new Builder(); - builder.includeGa( toGaPattern( includedGroups, true ) ); - builder.excludeGa( toGaPattern( excludedGroups, true ) ); + builder.includeGa(toGaPattern(includedGroups, true)); + builder.excludeGa(toGaPattern(excludedGroups, true)); - builder.includeGa( toGaPattern( includedArtifacts, false ) ); - builder.excludeGa( toGaPattern( excludedArtifacts, false ) ); + builder.includeGa(toGaPattern(includedArtifacts, false)); + builder.excludeGa(toGaPattern(excludedArtifacts, false)); - builder.includeScopes( MojoHelper.getParams( includedScopes ) ); - builder.excludeScopes( MojoHelper.getParams( excludedScopes ) ); - builder.includeTypes( MojoHelper.getParams( includedTypes ) ); - builder.excludeTypes( MojoHelper.getParams( excludedTypes ) ); - builder.includeOptional( includeOptional ); + builder.includeScopes(MojoHelper.getParams(includedScopes)); + builder.excludeScopes(MojoHelper.getParams(excludedScopes)); + builder.includeTypes(MojoHelper.getParams(includedTypes)); + builder.excludeTypes(MojoHelper.getParams(excludedTypes)); + builder.includeOptional(includeOptional); - if ( artifactFiltersUrl != null ) - { - try - { - final String content = UrlRequester.getFromUrl( artifactFiltersUrl, encoding ); - if ( content != null ) - { - builder.script( artifactFiltersUrl, content ); + if (artifactFiltersUrl != null) { + try { + final String content = UrlRequester.getFromUrl(artifactFiltersUrl, encoding); + if (content != null) { + builder.script(artifactFiltersUrl, content); } - } - catch ( IOException e ) - { - throw new RuntimeException( e ); + } catch (IOException e) { + throw new RuntimeException(e); } } return builder.build(); } - private static String toGaPattern( String rawPattern, boolean isGroup ) - { - if ( rawPattern == null ) - { + private static String toGaPattern(String rawPattern, boolean isGroup) { + if (rawPattern == null) { return null; - } - else - { + } else { rawPattern = "[^:]*(" + rawPattern + ")[^:]*"; - if ( isGroup ) - { + if (isGroup) { return rawPattern + ":[^:]+"; - } - else - { + } else { return "[^:]+:" + rawPattern; } } @@ -122,9 +116,11 @@ private static String toGaPattern( String rawPattern, boolean isGroup ) private final boolean includeOptional; - public ArtifactFilters( IncludesExcludes scopeFilters, IncludesExcludes typeFilters, IncludesExcludes gaFilters, - boolean includeOptional ) - { + public ArtifactFilters( + IncludesExcludes scopeFilters, + IncludesExcludes typeFilters, + IncludesExcludes gaFilters, + boolean includeOptional) { super(); this.scopeFilters = scopeFilters; this.typeFilters = typeFilters; @@ -132,22 +128,21 @@ public ArtifactFilters( IncludesExcludes scopeFilters, IncludesExcludes typeFilt this.includeOptional = includeOptional; } - public boolean isIncluded( Artifact artifact ) - { - return scopeFilters.isIncluded( artifact ) && typeFilters.isIncluded( artifact ) - && gaFilters.isIncluded( artifact ) && ( includeOptional || !artifact.isOptional() ); + public boolean isIncluded(Artifact artifact) { + return scopeFilters.isIncluded(artifact) + && typeFilters.isIncluded(artifact) + && gaFilters.isIncluded(artifact) + && (includeOptional || !artifact.isOptional()); } - interface ArtifactFilter - { - boolean matches( Artifact artifact ); + interface ArtifactFilter { + boolean matches(Artifact artifact); } /** * An {@link ArtifactFilters} builder. */ - public static class Builder - { + public static class Builder { private final IncludesExcludes.Builder gaFilters = new IncludesExcludes.Builder(); private final IncludesExcludes.Builder scopeFilters = new IncludesExcludes.Builder(); @@ -156,293 +151,220 @@ public static class Builder private boolean includeOptional = true; - public ArtifactFilters build() - { - return new ArtifactFilters( scopeFilters.build(), typeFilters.build(), gaFilters.build(), includeOptional ); + public ArtifactFilters build() { + return new ArtifactFilters(scopeFilters.build(), typeFilters.build(), gaFilters.build(), includeOptional); } - public void script( String url, String content ) - { - final StringTokenizer st = new StringTokenizer( content, "\r\n" ); + public void script(String url, String content) { + final StringTokenizer st = new StringTokenizer(content, "\r\n"); int i = 1; - while ( st.hasMoreTokens() ) - { + while (st.hasMoreTokens()) { final String line = st.nextToken().trim(); - if ( !line.startsWith( "#" ) && !line.isEmpty() ) - { - final String[] items = line.split( "\\s+" ); - if ( items.length != 3 ) - { - throw new IllegalStateException( "Expected 3 space separated tokens on line " + i + " in " + url - + " found: " + line ); - } - if ( "include".equals( items[0] ) ) - { - if ( "gaPattern".equals( items[1] ) ) - { - includeGa( items[2] ); - } - else if ( "scope".equals( items[1] ) ) - { - includeScope( items[2] ); - } - else if ( "type".equals( items[1] ) ) - { - includeType( items[2] ); - } - else if ( "optional".equals( items[1] ) ) - { - includeOptional( Boolean.parseBoolean( items[2] ) ); - } - else - { - throw new IllegalStateException( "Expected \"gaPattern\", \"scope\", \"type\" or" - + " \"optional\" after \"" + items[0] + "\" on line " + i + " in " + url + " found: " - + line ); - } + if (!line.startsWith("#") && !line.isEmpty()) { + final String[] items = line.split("\\s+"); + if (items.length != 3) { + throw new IllegalStateException( + "Expected 3 space separated tokens on line " + i + " in " + url + " found: " + line); } - else if ( "exclude".equals( items[0] ) ) - { - if ( "gaPattern".equals( items[1] ) ) - { - excludeGa( items[2] ); - } - else if ( "scope".equals( items[1] ) ) - { - excludeScope( items[2] ); - } - else if ( "type".equals( items[1] ) ) - { - excludeType( items[2] ); + if ("include".equals(items[0])) { + if ("gaPattern".equals(items[1])) { + includeGa(items[2]); + } else if ("scope".equals(items[1])) { + includeScope(items[2]); + } else if ("type".equals(items[1])) { + includeType(items[2]); + } else if ("optional".equals(items[1])) { + includeOptional(Boolean.parseBoolean(items[2])); + } else { + throw new IllegalStateException("Expected \"gaPattern\", \"scope\", \"type\" or" + + " \"optional\" after \"" + items[0] + "\" on line " + i + " in " + url + + " found: " + + line); } - else - { - throw new IllegalStateException( "Expected \"gaPattern\", \"scope\" or \"type\" after \"" - + items[0] + "\" on line " + i + " in " + url + " found: " + line ); + } else if ("exclude".equals(items[0])) { + if ("gaPattern".equals(items[1])) { + excludeGa(items[2]); + } else if ("scope".equals(items[1])) { + excludeScope(items[2]); + } else if ("type".equals(items[1])) { + excludeType(items[2]); + } else { + throw new IllegalStateException("Expected \"gaPattern\", \"scope\" or \"type\" after \"" + + items[0] + "\" on line " + i + " in " + url + " found: " + line); } - } - else - { + } else { throw new IllegalStateException( - "Expected a line starting with \"include\" or \"exclude\" on line " - + i + " in " + url + " found: " + line ); + "Expected a line starting with \"include\" or \"exclude\" on line " + i + " in " + url + + " found: " + line); } } i++; } } - public Builder excludeGa( String pattern ) - { - if ( pattern != null ) - { - gaFilters.exclude( new GaFilter( Pattern.compile( pattern ) ) ); + public Builder excludeGa(String pattern) { + if (pattern != null) { + gaFilters.exclude(new GaFilter(Pattern.compile(pattern))); } return this; } - public Builder excludeGas( String... patterns ) - { - if ( patterns != null ) - { - for ( String pattern : patterns ) - { - gaFilters.exclude( new GaFilter( Pattern.compile( pattern ) ) ); + public Builder excludeGas(String... patterns) { + if (patterns != null) { + for (String pattern : patterns) { + gaFilters.exclude(new GaFilter(Pattern.compile(pattern))); } } return this; } - public Builder includeOptional( boolean includeOptional ) - { + public Builder includeOptional(boolean includeOptional) { this.includeOptional = includeOptional; return this; } - public Builder excludeScope( String scope ) - { - scopeFilters.exclude( new ScopeFilter( scope ) ); + public Builder excludeScope(String scope) { + scopeFilters.exclude(new ScopeFilter(scope)); return this; } - public Builder excludeScopes( String... scopes ) - { - if ( scopes != null ) - { - for ( String scope : scopes ) - { - scopeFilters.exclude( new ScopeFilter( scope ) ); + public Builder excludeScopes(String... scopes) { + if (scopes != null) { + for (String scope : scopes) { + scopeFilters.exclude(new ScopeFilter(scope)); } } return this; } - public Builder excludeScopes( Collection scopes ) - { - if ( scopes != null ) - { - for ( String scope : scopes ) - { - scopeFilters.exclude( new ScopeFilter( scope ) ); + public Builder excludeScopes(Collection scopes) { + if (scopes != null) { + for (String scope : scopes) { + scopeFilters.exclude(new ScopeFilter(scope)); } } return this; } - public Builder excludeType( String type ) - { - typeFilters.exclude( new TypeFilter( type ) ); + public Builder excludeType(String type) { + typeFilters.exclude(new TypeFilter(type)); return this; } - public Builder excludeTypes( String... types ) - { - if ( types != null ) - { - for ( String type : types ) - { - typeFilters.exclude( new TypeFilter( type ) ); + public Builder excludeTypes(String... types) { + if (types != null) { + for (String type : types) { + typeFilters.exclude(new TypeFilter(type)); } } return this; } - public Builder excludeTypes( Collection types ) - { - if ( types != null ) - { - for ( String type : types ) - { - typeFilters.exclude( new TypeFilter( type ) ); + public Builder excludeTypes(Collection types) { + if (types != null) { + for (String type : types) { + typeFilters.exclude(new TypeFilter(type)); } } return this; } - public Builder includeGa( String pattern ) - { - if ( pattern != null ) - { - gaFilters.include( new GaFilter( Pattern.compile( pattern ) ) ); + public Builder includeGa(String pattern) { + if (pattern != null) { + gaFilters.include(new GaFilter(Pattern.compile(pattern))); } return this; } - public Builder includeGas( String... patterns ) - { - if ( patterns != null ) - { - for ( String pattern : patterns ) - { - gaFilters.include( new GaFilter( Pattern.compile( pattern ) ) ); + public Builder includeGas(String... patterns) { + if (patterns != null) { + for (String pattern : patterns) { + gaFilters.include(new GaFilter(Pattern.compile(pattern))); } } return this; } - public Builder includeScope( String scope ) - { - scopeFilters.include( new ScopeFilter( scope ) ); + public Builder includeScope(String scope) { + scopeFilters.include(new ScopeFilter(scope)); return this; } - public Builder includeScopes( String... scopes ) - { - if ( scopes != null ) - { - for ( String scope : scopes ) - { - scopeFilters.include( new ScopeFilter( scope ) ); + public Builder includeScopes(String... scopes) { + if (scopes != null) { + for (String scope : scopes) { + scopeFilters.include(new ScopeFilter(scope)); } } return this; } - public Builder includeScopes( Collection scopes ) - { - if ( scopes != null ) - { - for ( String scope : scopes ) - { - scopeFilters.include( new ScopeFilter( scope ) ); + public Builder includeScopes(Collection scopes) { + if (scopes != null) { + for (String scope : scopes) { + scopeFilters.include(new ScopeFilter(scope)); } } return this; } - public Builder includeType( String type ) - { - typeFilters.include( new TypeFilter( type ) ); + public Builder includeType(String type) { + typeFilters.include(new TypeFilter(type)); return this; } - public Builder includeTypes( String... types ) - { - if ( types != null ) - { - for ( String type : types ) - { - typeFilters.include( new TypeFilter( type ) ); + public Builder includeTypes(String... types) { + if (types != null) { + for (String type : types) { + typeFilters.include(new TypeFilter(type)); } } return this; } - public Builder includeTypes( Collection types ) - { - if ( types != null ) - { - for ( String type : types ) - { - typeFilters.include( new TypeFilter( type ) ); + public Builder includeTypes(Collection types) { + if (types != null) { + for (String type : types) { + typeFilters.include(new TypeFilter(type)); } } return this; } - } - static class GaFilter - implements ArtifactFilter - { + static class GaFilter implements ArtifactFilter { private final Pattern pattern; - GaFilter( Pattern pattern ) - { + GaFilter(Pattern pattern) { super(); this.pattern = pattern; } - public boolean matches( Artifact artifact ) - { - return pattern.matcher( artifact.getGroupId() + ":" + artifact.getArtifactId() ).matches(); + public boolean matches(Artifact artifact) { + return pattern.matcher(artifact.getGroupId() + ":" + artifact.getArtifactId()) + .matches(); } } - static class IncludesExcludes - { - static class Builder - { + static class IncludesExcludes { + static class Builder { private int includesCount = 0; private List includesExcludes = new ArrayList<>(); - public IncludesExcludes build() - { + public IncludesExcludes build() { List ie = includesExcludes; this.includesExcludes = null; - return new IncludesExcludes( ie, includesCount ); + return new IncludesExcludes(ie, includesCount); } - public Builder exclude( ArtifactFilter filter ) - { - this.includesExcludes.add( filter ); + public Builder exclude(ArtifactFilter filter) { + this.includesExcludes.add(filter); return this; } - public Builder include( ArtifactFilter filter ) - { - this.includesExcludes.add( includesCount, filter ); + public Builder include(ArtifactFilter filter) { + this.includesExcludes.add(includesCount, filter); this.includesCount++; return this; } @@ -452,27 +374,21 @@ public Builder include( ArtifactFilter filter ) private final List includesExcludes; - IncludesExcludes( List includesExcludes, int includesCount ) - { + IncludesExcludes(List includesExcludes, int includesCount) { super(); this.includesExcludes = includesExcludes; this.includesCount = includesCount; } - public boolean isIncluded( Artifact artifact ) - { - return ( includesCount == 0 || matchesAny( artifact, 0, includesCount ) ) - && !matchesAny( artifact, includesCount, includesExcludes.size() ); + public boolean isIncluded(Artifact artifact) { + return (includesCount == 0 || matchesAny(artifact, 0, includesCount)) + && !matchesAny(artifact, includesCount, includesExcludes.size()); } - boolean matchesAny( Artifact artifact, int start, int end ) - { - if ( start < includesExcludes.size() ) - { - for ( int i = start; i < end; i++ ) - { - if ( includesExcludes.get( i ).matches( artifact ) ) - { + boolean matchesAny(Artifact artifact, int start, int end) { + if (start < includesExcludes.size()) { + for (int i = start; i < end; i++) { + if (includesExcludes.get(i).matches(artifact)) { return true; } } @@ -481,37 +397,29 @@ boolean matchesAny( Artifact artifact, int start, int end ) } } - static class ScopeFilter - implements ArtifactFilter - { + static class ScopeFilter implements ArtifactFilter { private final String scope; - ScopeFilter( String scope ) - { + ScopeFilter(String scope) { super(); this.scope = scope; } - public boolean matches( Artifact artifact ) - { - return this.scope.equals( artifact.getScope() ); + public boolean matches(Artifact artifact) { + return this.scope.equals(artifact.getScope()); } } - static class TypeFilter - implements ArtifactFilter - { + static class TypeFilter implements ArtifactFilter { private final String type; - TypeFilter( String type ) - { + TypeFilter(String type) { super(); this.type = type; } - public boolean matches( Artifact artifact ) - { - return this.type.equals( artifact.getType() ); + public boolean matches(Artifact artifact) { + return this.type.equals(artifact.getType()); } } } diff --git a/src/main/java/org/codehaus/mojo/license/api/DefaultThirdPartyDetails.java b/src/main/java/org/codehaus/mojo/license/api/DefaultThirdPartyDetails.java index ab50af555..ace3fd643 100644 --- a/src/main/java/org/codehaus/mojo/license/api/DefaultThirdPartyDetails.java +++ b/src/main/java/org/codehaus/mojo/license/api/DefaultThirdPartyDetails.java @@ -32,9 +32,7 @@ * @author tchemit dev@tchemit.fr * @since 1.1 */ -public class DefaultThirdPartyDetails - implements ThirdPartyDetails -{ +public class DefaultThirdPartyDetails implements ThirdPartyDetails { private String[] pomLicenses; @@ -42,79 +40,67 @@ public class DefaultThirdPartyDetails private final MavenProject project; - public DefaultThirdPartyDetails( MavenProject project ) - { + public DefaultThirdPartyDetails(MavenProject project) { this.project = project; } /** * {@inheritDoc} */ - public String getGroupId() - { + public String getGroupId() { return project.getArtifact().getGroupId(); } /** * {@inheritDoc} */ - public String getArtifactId() - { + public String getArtifactId() { return project.getArtifact().getArtifactId(); } /** * {@inheritDoc} */ - public String getVersion() - { + public String getVersion() { return project.getArtifact().getVersion(); } /** * {@inheritDoc} */ - public String getType() - { + public String getType() { return project.getArtifact().getType(); } /** * {@inheritDoc} */ - public String getClassifier() - { + public String getClassifier() { return project.getArtifact().getClassifier(); } /** * {@inheritDoc} */ - public String getScope() - { + public String getScope() { return project.getArtifact().getScope(); } /** * {@inheritDoc} */ - public boolean hasPomLicenses() - { + public boolean hasPomLicenses() { return pomLicenses != null && pomLicenses.length > 0; } /** * {@inheritDoc} */ - public String[] getLicenses() - { + public String[] getLicenses() { String[] result = null; - if ( hasPomLicenses() ) - { + if (hasPomLicenses()) { result = getPomLicenses(); - } - else if ( hasThirdPartyLicenses() ) - { + } else if (hasThirdPartyLicenses()) { result = getThirdPartyLicenses(); } return result; @@ -123,48 +109,42 @@ else if ( hasThirdPartyLicenses() ) /** * {@inheritDoc} */ - public boolean hasLicenses() - { + public boolean hasLicenses() { return hasPomLicenses() || hasThirdPartyLicenses(); } /** * {@inheritDoc} */ - public String[] getPomLicenses() - { + public String[] getPomLicenses() { return pomLicenses; } /** * {@inheritDoc} */ - public void setPomLicenses( String[] pomLicenses ) - { + public void setPomLicenses(String[] pomLicenses) { this.pomLicenses = pomLicenses; } /** * {@inheritDoc} */ - public String[] getThirdPartyLicenses() - { + public String[] getThirdPartyLicenses() { return thirdPartyLicenses; } /** * {@inheritDoc} */ - public boolean hasThirdPartyLicenses() - { + public boolean hasThirdPartyLicenses() { return thirdPartyLicenses != null && thirdPartyLicenses.length > 0; } /** * {@inheritDoc} */ - public void setThirdPartyLicenses( String[] thirdPartyLicenses ) - { + public void setThirdPartyLicenses(String[] thirdPartyLicenses) { this.thirdPartyLicenses = thirdPartyLicenses; } @@ -172,24 +152,22 @@ public void setThirdPartyLicenses( String[] thirdPartyLicenses ) * {@inheritDoc} */ @Override - public boolean equals( Object o ) - { - if ( this == o ) - { + public boolean equals(Object o) { + if (this == o) { return true; } - if ( o == null || getClass() != o.getClass() ) - { + if (o == null || getClass() != o.getClass()) { return false; } DefaultThirdPartyDetails that = (DefaultThirdPartyDetails) o; - return new EqualsBuilder().append( getGroupId(), that.getGroupId() ) - .append( getArtifactId(), that.getArtifactId() ) - .append( getVersion(), that.getVersion() ) - .append( getClassifier(), that.getClassifier() ) + return new EqualsBuilder() + .append(getGroupId(), that.getGroupId()) + .append(getArtifactId(), that.getArtifactId()) + .append(getVersion(), that.getVersion()) + .append(getClassifier(), that.getClassifier()) .isEquals(); } @@ -197,9 +175,12 @@ public boolean equals( Object o ) * {@inheritDoc} */ @Override - public int hashCode() - { - return new HashCodeBuilder( 17, 37 ).append( getGroupId() ).append( getArtifactId() ).append( - getVersion() ).append( getClassifier() ).toHashCode(); + public int hashCode() { + return new HashCodeBuilder(17, 37) + .append(getGroupId()) + .append(getArtifactId()) + .append(getVersion()) + .append(getClassifier()) + .toHashCode(); } } diff --git a/src/main/java/org/codehaus/mojo/license/api/DefaultThirdPartyHelper.java b/src/main/java/org/codehaus/mojo/license/api/DefaultThirdPartyHelper.java index 6c8ecbf77..4915b2608 100644 --- a/src/main/java/org/codehaus/mojo/license/api/DefaultThirdPartyHelper.java +++ b/src/main/java/org/codehaus/mojo/license/api/DefaultThirdPartyHelper.java @@ -22,16 +22,6 @@ * #L% */ -import org.apache.commons.collections.CollectionUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.ProjectBuildingException; -import org.codehaus.mojo.license.model.LicenseMap; -import org.codehaus.mojo.license.utils.SortedProperties; - import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -45,6 +35,16 @@ import java.util.SortedMap; import java.util.SortedSet; import java.util.TreeMap; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.ProjectBuildingException; +import org.codehaus.mojo.license.model.LicenseMap; +import org.codehaus.mojo.license.utils.SortedProperties; import org.eclipse.aether.repository.RemoteRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,10 +55,8 @@ * @author tchemit dev@tchemit.fr * @since 1.1 */ -public class DefaultThirdPartyHelper - implements ThirdPartyHelper -{ - private static final Logger LOG = LoggerFactory.getLogger( DefaultThirdPartyHelper.class ); +public class DefaultThirdPartyHelper implements ThirdPartyHelper { + private static final Logger LOG = LoggerFactory.getLogger(DefaultThirdPartyHelper.class); /** * DependenciesTool to load dependencies. @@ -119,11 +117,14 @@ public class DefaultThirdPartyHelper * @param remoteRepositories maven remote repositories */ // CHECKSTYLE_OFF: ParameterNumber - public DefaultThirdPartyHelper( MavenProject project, String encoding, boolean verbose, - DependenciesTool dependenciesTool, ThirdPartyTool thirdPartyTool, - List remoteRepositoriesCoreApi, - List remoteRepositories ) - { + public DefaultThirdPartyHelper( + MavenProject project, + String encoding, + boolean verbose, + DependenciesTool dependenciesTool, + ThirdPartyTool thirdPartyTool, + List remoteRepositoriesCoreApi, + List remoteRepositories) { // CHECKSTYLE_ON: ParameterNumber this.project = project; this.encoding = encoding; @@ -132,21 +133,17 @@ public DefaultThirdPartyHelper( MavenProject project, String encoding, boolean v this.thirdPartyTool = thirdPartyTool; this.remoteRepositoriesCoreApi = remoteRepositoriesCoreApi; this.remoteRepositories = remoteRepositories; - this.thirdPartyTool.setVerbose( verbose ); + this.thirdPartyTool.setVerbose(verbose); } /** * {@inheritDoc} */ - public SortedMap getArtifactCache() - { - if ( artifactCache == null ) - { - synchronized ( ARTIFACT_CACHE_MUTEX ) - { - if ( artifactCache == null ) - { - artifactCache = Collections.synchronizedSortedMap( new TreeMap() ); + public SortedMap getArtifactCache() { + if (artifactCache == null) { + synchronized (ARTIFACT_CACHE_MUTEX) { + if (artifactCache == null) { + artifactCache = Collections.synchronizedSortedMap(new TreeMap()); } } } @@ -156,50 +153,47 @@ public SortedMap getArtifactCache() /** * {@inheritDoc} */ - public SortedMap loadDependencies( MavenProjectDependenciesConfigurator configuration, - ResolvedProjectDependencies dependencyArtifacts ) - { - return dependenciesTool.loadProjectDependencies( dependencyArtifacts, configuration, - remoteRepositoriesCoreApi, getArtifactCache() ); + public SortedMap loadDependencies( + MavenProjectDependenciesConfigurator configuration, ResolvedProjectDependencies dependencyArtifacts) { + return dependenciesTool.loadProjectDependencies( + dependencyArtifacts, configuration, remoteRepositoriesCoreApi, getArtifactCache()); } /** * {@inheritDoc} */ - public SortedProperties loadThirdPartyDescriptorForUnsafeMapping( Set topLevelDependencies, - SortedSet unsafeDependencies, - Collection projects, - LicenseMap licenseMap ) - throws ThirdPartyToolException, IOException - { - return thirdPartyTool.loadThirdPartyDescriptorsForUnsafeMapping( topLevelDependencies, encoding, projects, - unsafeDependencies, licenseMap, remoteRepositories ); + public SortedProperties loadThirdPartyDescriptorForUnsafeMapping( + Set topLevelDependencies, + SortedSet unsafeDependencies, + Collection projects, + LicenseMap licenseMap) + throws ThirdPartyToolException, IOException { + return thirdPartyTool.loadThirdPartyDescriptorsForUnsafeMapping( + topLevelDependencies, encoding, projects, unsafeDependencies, licenseMap, remoteRepositories); } /** * {@inheritDoc} */ - public SortedProperties loadUnsafeMapping( LicenseMap licenseMap, File missingFile, String missingFileUrl, - SortedMap projectDependencies ) - throws IOException, MojoExecutionException - { - return thirdPartyTool.loadUnsafeMapping( licenseMap, projectDependencies, encoding, missingFile, - missingFileUrl ); + public SortedProperties loadUnsafeMapping( + LicenseMap licenseMap, + File missingFile, + String missingFileUrl, + SortedMap projectDependencies) + throws IOException, MojoExecutionException { + return thirdPartyTool.loadUnsafeMapping(licenseMap, projectDependencies, encoding, missingFile, missingFileUrl); } /** * {@inheritDoc} */ - public LicenseMap createLicenseMap( SortedMap dependencies ) - { + public LicenseMap createLicenseMap(SortedMap dependencies) { LicenseMap licenseMap = new LicenseMap(); - synchronized ( dependencies ) - { - for ( MavenProject project : dependencies.values() ) - { - thirdPartyTool.addLicense( licenseMap, project, project.getLicenses() ); + synchronized (dependencies) { + for (MavenProject project : dependencies.values()) { + thirdPartyTool.addLicense(licenseMap, project, project.getLicenses()); } } return licenseMap; @@ -208,64 +202,57 @@ public LicenseMap createLicenseMap( SortedMap dependencies /** * {@inheritDoc} */ - public void attachThirdPartyDescriptor( File file ) - { + public void attachThirdPartyDescriptor(File file) { - thirdPartyTool.attachThirdPartyDescriptor( project, file ); + thirdPartyTool.attachThirdPartyDescriptor(project, file); } - /** * {@inheritDoc} */ - public SortedSet getProjectsWithNoLicense( LicenseMap licenseMap ) - { - return thirdPartyTool.getProjectsWithNoLicense( licenseMap ); + public SortedSet getProjectsWithNoLicense(LicenseMap licenseMap) { + return thirdPartyTool.getProjectsWithNoLicense(licenseMap); } /** * {@inheritDoc} */ - public SortedProperties createUnsafeMapping( LicenseMap licenseMap, File missingFile, String missingFileUrl, - boolean useRepositoryMissingFiles, - SortedSet unsafeDependencies, - SortedMap projectDependencies, - Set dependencyArtifacts ) - throws ProjectBuildingException, IOException, ThirdPartyToolException, MojoExecutionException - { + public SortedProperties createUnsafeMapping( + LicenseMap licenseMap, + File missingFile, + String missingFileUrl, + boolean useRepositoryMissingFiles, + SortedSet unsafeDependencies, + SortedMap projectDependencies, + Set dependencyArtifacts) + throws ProjectBuildingException, IOException, ThirdPartyToolException, MojoExecutionException { - SortedProperties unsafeMappings = loadUnsafeMapping( licenseMap, missingFile, missingFileUrl, - projectDependencies ); + SortedProperties unsafeMappings = + loadUnsafeMapping(licenseMap, missingFile, missingFileUrl, projectDependencies); - if ( CollectionUtils.isNotEmpty( unsafeDependencies ) ) - { + if (CollectionUtils.isNotEmpty(unsafeDependencies)) { // there is some unresolved license - if ( useRepositoryMissingFiles ) - { + if (useRepositoryMissingFiles) { // try to load missing third party files from dependencies Collection projects; - synchronized ( projectDependencies ) - { - projects = new ArrayList<>( projectDependencies.values() ); + synchronized (projectDependencies) { + projects = new ArrayList<>(projectDependencies.values()); } - projects.remove( project ); - projects.removeAll( unsafeDependencies ); + projects.remove(project); + projects.removeAll(unsafeDependencies); - SortedProperties resolvedUnsafeMapping = - loadThirdPartyDescriptorForUnsafeMapping( dependencyArtifacts, unsafeDependencies, projects, - licenseMap ); + SortedProperties resolvedUnsafeMapping = loadThirdPartyDescriptorForUnsafeMapping( + dependencyArtifacts, unsafeDependencies, projects, licenseMap); // push back resolved unsafe mappings (only for project dependencies) - for ( Object coord : resolvedUnsafeMapping.keySet() ) - { + for (Object coord : resolvedUnsafeMapping.keySet()) { String s = (String) coord; - if ( projectDependencies.containsKey( s ) ) - { - unsafeMappings.put( s, resolvedUnsafeMapping.get( s ) ); + if (projectDependencies.containsKey(s)) { + unsafeMappings.put(s, resolvedUnsafeMapping.get(s)); } } } @@ -277,83 +264,70 @@ public SortedProperties createUnsafeMapping( LicenseMap licenseMap, File missing /** * {@inheritDoc} */ - public void mergeLicenses( List licenseMerges, LicenseMap licenseMap ) - throws MojoFailureException - { + public void mergeLicenses(List licenseMerges, LicenseMap licenseMap) throws MojoFailureException { Set licenseFound = new HashSet<>(); - if ( !CollectionUtils.isEmpty( licenseMerges ) ) - { + if (!CollectionUtils.isEmpty(licenseMerges)) { // check where is not multi licenses merged main licenses (see MLICENSE-23) Map> mergedLicenses = new HashMap<>(); - for ( String merge : licenseMerges ) - { + for (String merge : licenseMerges) { merge = merge.trim(); - String[] split = merge.split( "\\s*\\|\\s*" ); + String[] split = merge.split("\\s*\\|\\s*"); String mainLicense = split[0]; Set mergeList; - if ( mergedLicenses.containsKey( mainLicense ) ) - { + if (mergedLicenses.containsKey(mainLicense)) { - mergeList = mergedLicenses.get( mainLicense ); - } - else - { + mergeList = mergedLicenses.get(mainLicense); + } else { mergeList = new HashSet<>(); } - for ( int i = 0; i < split.length; i++ ) - { + for (int i = 0; i < split.length; i++) { String licenseToAdd = split[i]; - if ( i == 0 ) - { + if (i == 0) { // mainLicense will not be merged (to itself) continue; } // check license not already described to be merged - if ( mergeList.contains( licenseToAdd ) || licenseFound.contains( licenseToAdd ) - || mainLicense.equals( licenseToAdd ) ) - { + if (mergeList.contains(licenseToAdd) + || licenseFound.contains(licenseToAdd) + || mainLicense.equals(licenseToAdd)) { // this license to merge was already described, fail the build... - throw new MojoFailureException( - "The license " + licenseToAdd + " was already registered in the " - + "configuration, please use only one such entry as described in the example " - + "http://mojohaus.org/license-maven-plugin/examples/" - + "example-thirdparty.html#Merge_licenses" ); + throw new MojoFailureException("The license " + licenseToAdd + " was already registered in the " + + "configuration, please use only one such entry as described in the example " + + "http://mojohaus.org/license-maven-plugin/examples/" + + "example-thirdparty.html#Merge_licenses"); } // can add this license for merge - mergeList.add( licenseToAdd ); - licenseFound.add( licenseToAdd ); + mergeList.add(licenseToAdd); + licenseFound.add(licenseToAdd); } // push back licenses to merge for this main license - mergedLicenses.put( mainLicense, mergeList ); + mergedLicenses.put(mainLicense, mergeList); } // merge licenses in license map - for ( Map.Entry> entry : mergedLicenses.entrySet() ) - { + for (Map.Entry> entry : mergedLicenses.entrySet()) { String mainLicense = entry.getKey(); Set mergedLicense = entry.getValue(); - if ( verbose ) - { - LOG.info( "Will merge to '{}', licenses: {}", mainLicense, mergedLicense ); + if (verbose) { + LOG.info("Will merge to '{}', licenses: {}", mainLicense, mergedLicense); } - thirdPartyTool.mergeLicenses( licenseMap, mainLicense, mergedLicense ); + thirdPartyTool.mergeLicenses(licenseMap, mainLicense, mergedLicense); } } } - } diff --git a/src/main/java/org/codehaus/mojo/license/api/DefaultThirdPartyTool.java b/src/main/java/org/codehaus/mojo/license/api/DefaultThirdPartyTool.java index 6031a9776..bae3e7b9e 100644 --- a/src/main/java/org/codehaus/mojo/license/api/DefaultThirdPartyTool.java +++ b/src/main/java/org/codehaus/mojo/license/api/DefaultThirdPartyTool.java @@ -47,6 +47,7 @@ import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; @@ -81,10 +82,8 @@ */ @Named @Singleton -public class DefaultThirdPartyTool - implements ThirdPartyTool -{ - private static final Logger LOG = LoggerFactory.getLogger( DefaultThirdPartyTool.class ); +public class DefaultThirdPartyTool implements ThirdPartyTool { + private static final Logger LOG = LoggerFactory.getLogger(DefaultThirdPartyTool.class); /** * Classifier of the third-parties descriptor attached to a maven module. @@ -99,13 +98,12 @@ public class DefaultThirdPartyTool /** * Pattern of a GAV plus a type. */ - private static final Pattern GAV_PLUS_TYPE_PATTERN = Pattern.compile( "(.+)--(.+)--(.+)--(.+)" ); + private static final Pattern GAV_PLUS_TYPE_PATTERN = Pattern.compile("(.+)--(.+)--(.+)--(.+)"); /** * Pattern of a GAV plus a type plus a classifier. */ - private static final Pattern GAV_PLUS_TYPE_AND_CLASSIFIER_PATTERN = - Pattern.compile( "(.+)--(.+)--(.+)--(.+)--(.+)" ); + private static final Pattern GAV_PLUS_TYPE_AND_CLASSIFIER_PATTERN = Pattern.compile("(.+)--(.+)--(.+)--(.+)--(.+)"); public static final String LICENSE_DB_TYPE = "license.properties"; @@ -143,55 +141,45 @@ public class DefaultThirdPartyTool /** * {@inheritDoc} */ - public boolean isVerbose() - { + public boolean isVerbose() { return verbose; } /** * {@inheritDoc} */ - public void setVerbose( boolean verbose ) - { + public void setVerbose(boolean verbose) { this.verbose = verbose; } /** * {@inheritDoc} */ - public void attachThirdPartyDescriptor( MavenProject project, File file ) - { - projectHelper.attachArtifact( project, DESCRIPTOR_TYPE, DESCRIPTOR_CLASSIFIER, file ); + public void attachThirdPartyDescriptor(MavenProject project, File file) { + projectHelper.attachArtifact(project, DESCRIPTOR_TYPE, DESCRIPTOR_CLASSIFIER, file); } /** * {@inheritDoc} */ - public SortedSet getProjectsWithNoLicense( LicenseMap licenseMap ) - { + public SortedSet getProjectsWithNoLicense(LicenseMap licenseMap) { // get unsafe dependencies (says with no license) - SortedSet unsafeDependencies = licenseMap.get( LicenseMap.UNKNOWN_LICENSE_MESSAGE ); + SortedSet unsafeDependencies = licenseMap.get(LicenseMap.UNKNOWN_LICENSE_MESSAGE); - if ( CollectionUtils.isEmpty( unsafeDependencies ) ) - { - LOG.debug( "There is no dependency with no license from poms." ); - } - else - { - if ( LOG.isDebugEnabled() ) - { + if (CollectionUtils.isEmpty(unsafeDependencies)) { + LOG.debug("There is no dependency with no license from poms."); + } else { + if (LOG.isDebugEnabled()) { boolean plural = unsafeDependencies.size() > 1; - String message = String.format( "There %s %d %s with no license from poms :", - plural ? "are" : "is", - unsafeDependencies.size(), - plural ? "dependencies" : "dependency" ); - LOG.debug( message ); - for ( MavenProject dep : unsafeDependencies ) - { + String message = String.format( + "There %s %d %s with no license from poms :", + plural ? "are" : "is", unsafeDependencies.size(), plural ? "dependencies" : "dependency"); + LOG.debug(message); + for (MavenProject dep : unsafeDependencies) { // no license found for the dependency - LOG.debug( " - {}", MojoHelper.getArtifactId( dep.getArtifact() ) ); + LOG.debug(" - {}", MojoHelper.getArtifactId(dep.getArtifact())); } } } @@ -202,94 +190,84 @@ public SortedSet getProjectsWithNoLicense( LicenseMap licenseMap ) /** * {@inheritDoc} */ - public SortedProperties loadThirdPartyDescriptorsForUnsafeMapping( Set topLevelDependencies, - String encoding, - Collection projects, - SortedSet unsafeDependencies, - LicenseMap licenseMap, - List remoteRepositories ) - throws ThirdPartyToolException, IOException - { - - SortedProperties result = new SortedProperties( encoding ); + public SortedProperties loadThirdPartyDescriptorsForUnsafeMapping( + Set topLevelDependencies, + String encoding, + Collection projects, + SortedSet unsafeDependencies, + LicenseMap licenseMap, + List remoteRepositories) + throws ThirdPartyToolException, IOException { + + SortedProperties result = new SortedProperties(encoding); Map unsafeProjects = new HashMap<>(); - for ( MavenProject unsafeDependency : unsafeDependencies ) - { - String id = MojoHelper.getArtifactId( unsafeDependency.getArtifact() ); - unsafeProjects.put( id, unsafeDependency ); + for (MavenProject unsafeDependency : unsafeDependencies) { + String id = MojoHelper.getArtifactId(unsafeDependency.getArtifact()); + unsafeProjects.put(id, unsafeDependency); } - for ( MavenProject mavenProject : projects ) - { + for (MavenProject mavenProject : projects) { - if ( CollectionUtils.isEmpty( unsafeDependencies ) ) - { + if (CollectionUtils.isEmpty(unsafeDependencies)) { // no more unsafe dependencies to find break; } - File thirdPartyDescriptor = resolvThirdPartyDescriptor( mavenProject, remoteRepositories ); + File thirdPartyDescriptor = resolvThirdPartyDescriptor(mavenProject, remoteRepositories); - if ( thirdPartyDescriptor != null && thirdPartyDescriptor.exists() && thirdPartyDescriptor.length() > 0 ) - { + if (thirdPartyDescriptor != null && thirdPartyDescriptor.exists() && thirdPartyDescriptor.length() > 0) { - LOG.info( "Detects third party descriptor {}", thirdPartyDescriptor ); + LOG.info("Detects third party descriptor {}", thirdPartyDescriptor); // there is a third party file detected form the given dependency - SortedProperties unsafeMappings = new SortedProperties( encoding ); + SortedProperties unsafeMappings = new SortedProperties(encoding); - if ( thirdPartyDescriptor.exists() ) - { + if (thirdPartyDescriptor.exists()) { - LOG.info( "Load missing file {}", thirdPartyDescriptor ); + LOG.info("Load missing file {}", thirdPartyDescriptor); // load the missing file - unsafeMappings.load( thirdPartyDescriptor ); + unsafeMappings.load(thirdPartyDescriptor); } - resolveUnsafe( unsafeDependencies, licenseMap, unsafeProjects, unsafeMappings, result ); + resolveUnsafe(unsafeDependencies, licenseMap, unsafeProjects, unsafeMappings, result); } - } - try - { - loadGlobalLicenses( topLevelDependencies, remoteRepositories, unsafeDependencies, - licenseMap, unsafeProjects, result ); - } - catch ( ArtifactNotFoundException | ArtifactResolutionException e ) - { - throw new ThirdPartyToolException( "Failed to load global licenses", e ); + try { + loadGlobalLicenses( + topLevelDependencies, remoteRepositories, unsafeDependencies, licenseMap, unsafeProjects, result); + } catch (ArtifactNotFoundException | ArtifactResolutionException e) { + throw new ThirdPartyToolException("Failed to load global licenses", e); } return result; } - private void resolveUnsafe( SortedSet unsafeDependencies, LicenseMap licenseMap, - Map unsafeProjects, SortedProperties unsafeMappings, - SortedProperties result ) - { - for ( String id : unsafeProjects.keySet() ) - { + private void resolveUnsafe( + SortedSet unsafeDependencies, + LicenseMap licenseMap, + Map unsafeProjects, + SortedProperties unsafeMappings, + SortedProperties result) { + for (String id : unsafeProjects.keySet()) { - if ( unsafeMappings.containsKey( id ) ) - { + if (unsafeMappings.containsKey(id)) { - String license = (String) unsafeMappings.get( id ); - if ( StringUtils.isEmpty( license ) ) - { + String license = (String) unsafeMappings.get(id); + if (StringUtils.isEmpty(license)) { // empty license means not fill, skip it continue; } // found a resolved unsafe dependency in the missing third party file - MavenProject resolvedProject = unsafeProjects.get( id ); - unsafeDependencies.remove( resolvedProject ); + MavenProject resolvedProject = unsafeProjects.get(id); + unsafeDependencies.remove(resolvedProject); // push back to - result.put( id, license.trim() ); + result.put(id, license.trim()); - addLicense( licenseMap, resolvedProject, license ); + addLicense(licenseMap, resolvedProject, license); } } } @@ -297,80 +275,66 @@ private void resolveUnsafe( SortedSet unsafeDependencies, LicenseM /** * {@inheritDoc} */ - public File resolvThirdPartyDescriptor( MavenProject project, List remoteRepositories ) - throws ThirdPartyToolException - { - if ( project == null ) - { - throw new IllegalArgumentException( "The parameter 'project' can not be null" ); + public File resolvThirdPartyDescriptor(MavenProject project, List remoteRepositories) + throws ThirdPartyToolException { + if (project == null) { + throw new IllegalArgumentException("The parameter 'project' can not be null"); } - if ( remoteRepositories == null ) - { - throw new IllegalArgumentException( "The parameter 'remoteRepositories' can not be null" ); + if (remoteRepositories == null) { + throw new IllegalArgumentException("The parameter 'remoteRepositories' can not be null"); } - try - { - return resolveThirdPartyDescriptor( project, remoteRepositories ); - } - catch ( ArtifactResolutionException e ) - { + try { + return resolveThirdPartyDescriptor(project, remoteRepositories); + } catch (ArtifactResolutionException e) { throw new ThirdPartyToolException( - "ArtifactResolutionException: Unable to locate third party descriptor: " + e.getMessage(), e ); + "ArtifactResolutionException: Unable to locate third party descriptor: " + e.getMessage(), e); } } /** * {@inheritDoc} */ - public void addLicense( LicenseMap licenseMap, MavenProject project, String... licenseNames ) - { + public void addLicense(LicenseMap licenseMap, MavenProject project, String... licenseNames) { List licenses = new ArrayList<>(); - for ( String licenseName : licenseNames ) - { + for (String licenseName : licenseNames) { License license = new License(); - license.setName( licenseName.trim() ); - license.setUrl( licenseName.trim() ); - licenses.add( license ); + license.setName(licenseName.trim()); + license.setUrl(licenseName.trim()); + licenses.add(license); } - addLicense( licenseMap, project, licenses ); + addLicense(licenseMap, project, licenses); } /** * {@inheritDoc} */ - public void addLicense( LicenseMap licenseMap, MavenProject project, License license ) - { - addLicense( licenseMap, project, Collections.singletonList( license ) ); + public void addLicense(LicenseMap licenseMap, MavenProject project, License license) { + addLicense(licenseMap, project, Collections.singletonList(license)); } /** * {@inheritDoc} */ - public void addLicense( LicenseMap licenseMap, MavenProject project, List licenses ) - { + public void addLicense(LicenseMap licenseMap, MavenProject project, List licenses) { - if ( Artifact.SCOPE_SYSTEM.equals( project.getArtifact().getScope() ) ) - { + if (Artifact.SCOPE_SYSTEM.equals(project.getArtifact().getScope())) { // do NOT treat system dependency return; } - if ( CollectionUtils.isEmpty( licenses ) ) - { + if (CollectionUtils.isEmpty(licenses)) { // no license found for the dependency - licenseMap.put( LicenseMap.UNKNOWN_LICENSE_MESSAGE, project ); + licenseMap.put(LicenseMap.UNKNOWN_LICENSE_MESSAGE, project); return; } - for ( Object o : licenses ) - { - String id = MojoHelper.getArtifactId( project.getArtifact() ); - if ( o == null ) - { - LOG.warn( "could not acquire the license for {}", id ); + for (Object o : licenses) { + String id = MojoHelper.getArtifactId(project.getArtifact()); + if (o == null) { + LOG.warn("could not acquire the license for {}", id); continue; } License license = (License) o; @@ -378,117 +342,101 @@ public void addLicense( LicenseMap licenseMap, MavenProject project, List lic // tchemit 2010-08-29 Ano #816 Check if the License object is well formed - if ( StringUtils.isEmpty( license.getName() ) ) - { - LOG.warn( "The license for {} has no name (but exist)", id ); + if (StringUtils.isEmpty(license.getName())) { + LOG.warn("The license for {} has no name (but exist)", id); licenseKey = license.getUrl(); } - if ( StringUtils.isEmpty( licenseKey ) ) - { - LOG.warn( "No license url defined for {}", id ); + if (StringUtils.isEmpty(licenseKey)) { + LOG.warn("No license url defined for {}", id); licenseKey = LicenseMap.UNKNOWN_LICENSE_MESSAGE; } - licenseMap.put( licenseKey, project ); + licenseMap.put(licenseKey, project); } } /** * {@inheritDoc} */ - public void mergeLicenses( LicenseMap licenseMap, String mainLicense, Set licenses ) - { + public void mergeLicenses(LicenseMap licenseMap, String mainLicense, Set licenses) { - if ( licenses.isEmpty() ) - { + if (licenses.isEmpty()) { // nothing to merge, is this can really happen ? return; } - SortedSet mainSet = licenseMap.get( mainLicense ); - if ( mainSet == null ) - { - if ( isVerbose() ) - { - LOG.warn( "No license [{}] found, will create it.", mainLicense ); + SortedSet mainSet = licenseMap.get(mainLicense); + if (mainSet == null) { + if (isVerbose()) { + LOG.warn("No license [{}] found, will create it.", mainLicense); } - mainSet = new TreeSet<>( projectComparator ); - licenseMap.put( mainLicense, mainSet ); - } - for ( String license : licenses ) - { - SortedSet set = licenseMap.get( license ); - if ( set == null ) - { - if ( isVerbose() ) - { - LOG.warn( "No license [{}] found, skip the merge to [{}]", license, mainLicense ); + mainSet = new TreeSet<>(projectComparator); + licenseMap.put(mainLicense, mainSet); + } + for (String license : licenses) { + SortedSet set = licenseMap.get(license); + if (set == null) { + if (isVerbose()) { + LOG.warn("No license [{}] found, skip the merge to [{}]", license, mainLicense); } continue; } - if ( isVerbose() ) - { - LOG.info( - "Merge license [{}] to [{}] ({} dependencies).", license, mainLicense, set.size() ); + if (isVerbose()) { + LOG.info("Merge license [{}] to [{}] ({} dependencies).", license, mainLicense, set.size()); } - mainSet.addAll( set ); + mainSet.addAll(set); set.clear(); - licenseMap.remove( license ); + licenseMap.remove(license); } } /** * {@inheritDoc} */ - public SortedProperties loadUnsafeMapping( LicenseMap licenseMap, - SortedMap artifactCache, - String encoding, - File missingFile, - String missingFileUrl ) throws IOException { + public SortedProperties loadUnsafeMapping( + LicenseMap licenseMap, + SortedMap artifactCache, + String encoding, + File missingFile, + String missingFileUrl) + throws IOException { Map snapshots = new HashMap<>(); - synchronized ( artifactCache ) - { - //find snapshot dependencies - for ( Map.Entry entry : artifactCache.entrySet() ) - { + synchronized (artifactCache) { + // find snapshot dependencies + for (Map.Entry entry : artifactCache.entrySet()) { MavenProject mavenProject = entry.getValue(); - if ( mavenProject.getVersion().endsWith( Artifact.SNAPSHOT_VERSION ) ) - { - snapshots.put( entry.getKey(), mavenProject ); + if (mavenProject.getVersion().endsWith(Artifact.SNAPSHOT_VERSION)) { + snapshots.put(entry.getKey(), mavenProject); } } } - for ( Map.Entry snapshot : snapshots.entrySet() ) - { + for (Map.Entry snapshot : snapshots.entrySet()) { // remove invalid entries, which contain timestamps in key - artifactCache.remove( snapshot.getKey() ); + artifactCache.remove(snapshot.getKey()); // put corrected keys/entries into artifact cache MavenProject mavenProject = snapshot.getValue(); - String id = MojoHelper.getArtifactId( mavenProject.getArtifact() ); - artifactCache.put( id, mavenProject ); - + String id = MojoHelper.getArtifactId(mavenProject.getArtifact()); + artifactCache.put(id, mavenProject); } - SortedSet unsafeDependencies = getProjectsWithNoLicense( licenseMap ); + SortedSet unsafeDependencies = getProjectsWithNoLicense(licenseMap); - SortedProperties unsafeMappings = new SortedProperties( encoding ); + SortedProperties unsafeMappings = new SortedProperties(encoding); - if ( missingFile.exists() ) - { + if (missingFile.exists()) { // there is some unsafe dependencies - LOG.info( "Load missingFile {}", missingFile ); + LOG.info("Load missingFile {}", missingFile); // load the missing file - unsafeMappings.load( missingFile ); + unsafeMappings.load(missingFile); } - if ( UrlRequester.isStringUrl( missingFileUrl ) ) - { - String httpRequestResult = UrlRequester.getFromUrl( missingFileUrl ); - unsafeMappings.load( new ByteArrayInputStream( httpRequestResult.getBytes() ) ); + if (UrlRequester.isStringUrl(missingFileUrl)) { + String httpRequestResult = UrlRequester.getFromUrl(missingFileUrl); + unsafeMappings.load(new ByteArrayInputStream(httpRequestResult.getBytes())); } // get from the missing file, all unknown dependencies @@ -496,92 +444,77 @@ public SortedProperties loadUnsafeMapping( LicenseMap licenseMap, // coming from maven-license-plugin, we used the full g/a/v/c/t. Now we remove classifier and type // since GAV is good enough to qualify a license of any artifact of it... - Map migrateKeys = migrateMissingFileKeys( unsafeMappings.keySet() ); + Map migrateKeys = migrateMissingFileKeys(unsafeMappings.keySet()); - for ( Object o : migrateKeys.keySet() ) - { + for (Object o : migrateKeys.keySet()) { String id = (String) o; - String migratedId = migrateKeys.get( id ); + String migratedId = migrateKeys.get(id); - MavenProject project = artifactCache.get( migratedId ); - if ( project == null ) - { + MavenProject project = artifactCache.get(migratedId); + if (project == null) { // now we are sure this is a unknown dependency - unknownDependenciesId.add( id ); - } - else - { - if ( !id.equals( migratedId ) ) - { + unknownDependenciesId.add(id); + } else { + if (!id.equals(migratedId)) { // migrates id to migratedId - LOG.info( "Migrates [{}] to [{}] in the missing file.", id, migratedId ); - Object value = unsafeMappings.get( id ); - unsafeMappings.remove( id ); - unsafeMappings.put( migratedId, value ); + LOG.info("Migrates [{}] to [{}] in the missing file.", id, migratedId); + Object value = unsafeMappings.get(id); + unsafeMappings.remove(id); + unsafeMappings.put(migratedId, value); } } } - if ( !unknownDependenciesId.isEmpty() ) - { + if (!unknownDependenciesId.isEmpty()) { // there is some unknown dependencies in the missing file, remove them - for ( String id : unknownDependenciesId ) - { - LOG.warn( - "dependency [{}] does not exist in project, remove it from the missing file.", id ); - unsafeMappings.remove( id ); + for (String id : unknownDependenciesId) { + LOG.warn("dependency [{}] does not exist in project, remove it from the missing file.", id); + unsafeMappings.remove(id); } unknownDependenciesId.clear(); } // push back loaded dependencies - for ( Object o : unsafeMappings.keySet() ) - { + for (Object o : unsafeMappings.keySet()) { String id = (String) o; - MavenProject project = artifactCache.get( id ); - if ( project == null ) - { - LOG.warn( "dependency [{}] does not exist in project.", id ); + MavenProject project = artifactCache.get(id); + if (project == null) { + LOG.warn("dependency [{}] does not exist in project.", id); continue; } - String license = (String) unsafeMappings.get( id ); + String license = (String) unsafeMappings.get(id); - String[] licenses = StringUtils.split( license, '|' ); + String[] licenses = StringUtils.split(license, '|'); - if ( ArrayUtils.isEmpty( licenses ) ) - { + if (ArrayUtils.isEmpty(licenses)) { // empty license means not fill, skip it continue; } // add license in map - addLicense( licenseMap, project, licenses ); + addLicense(licenseMap, project, licenses); // remove unknown license - unsafeDependencies.remove( project ); + unsafeDependencies.remove(project); } - if ( unsafeDependencies.isEmpty() ) - { + if (unsafeDependencies.isEmpty()) { // no more unknown license in map - licenseMap.remove( LicenseMap.UNKNOWN_LICENSE_MESSAGE ); - } - else - { + licenseMap.remove(LicenseMap.UNKNOWN_LICENSE_MESSAGE); + } else { // add a "with no value license" for missing dependencies - for ( MavenProject project : unsafeDependencies ) - { - String id = MojoHelper.getArtifactId( project.getArtifact() ); - LOG.debug( "dependency [{}] has no license, add it in the missing file.", id ); - unsafeMappings.setProperty( id, "" ); + for (MavenProject project : unsafeDependencies) { + String id = MojoHelper.getArtifactId(project.getArtifact()); + LOG.debug("dependency [{}] has no license, add it in the missing file.", id); + unsafeMappings.setProperty(id, ""); } } return unsafeMappings; @@ -590,58 +523,51 @@ public SortedProperties loadUnsafeMapping( LicenseMap licenseMap, /** * {@inheritDoc} */ - public void overrideLicenses( LicenseMap licenseMap, SortedMap artifactCache, String encoding, - String overrideUrl ) throws IOException - { - if ( LicenseMojoUtils.isValid( overrideUrl ) ) - { - final SortedProperties overrideMappings = new SortedProperties( encoding ); - try ( Reader reader = new StringReader( UrlRequester.getFromUrl( overrideUrl, encoding ) ) ) - { - overrideMappings.load( reader ); + public void overrideLicenses( + LicenseMap licenseMap, SortedMap artifactCache, String encoding, String overrideUrl) + throws IOException { + if (LicenseMojoUtils.isValid(overrideUrl)) { + final SortedProperties overrideMappings = new SortedProperties(encoding); + try (Reader reader = new StringReader(UrlRequester.getFromUrl(overrideUrl, encoding))) { + overrideMappings.load(reader); } boolean isExternalUrl = UrlRequester.isExternalUrl(overrideUrl); - for ( Object o : overrideMappings.keySet() ) - { + for (Object o : overrideMappings.keySet()) { String id = (String) o; - MavenProject project = artifactCache.get( id ); - if ( project == null ) - { + MavenProject project = artifactCache.get(id); + if (project == null) { // Log at warn for local override files, but at debug for remote (presumably shared) override files. - if ( isExternalUrl ) - { - LOG.debug( "dependency [{}] does not exist in project.", id ); - } - else - { - LOG.warn( "dependency [{}] does not exist in project.", id ); + if (isExternalUrl) { + LOG.debug("dependency [{}] does not exist in project.", id); + } else { + LOG.warn("dependency [{}] does not exist in project.", id); } continue; } - String license = (String) overrideMappings.get( id ); + String license = (String) overrideMappings.get(id); - String[] licenses = StringUtils.split( license, '|' ); + String[] licenses = StringUtils.split(license, '|'); - if ( ArrayUtils.isEmpty( licenses ) ) - { + if (ArrayUtils.isEmpty(licenses)) { // empty license means not fill, skip it continue; } // remove project only removes first occurrence of project from license -> project[] map. - List removedFrom = licenseMap.removeProject( project ); + List removedFrom = licenseMap.removeProject(project); if (LOG.isDebugEnabled()) { - LOG.debug("Overriding license(s) for dependency [{}] with [{}], overriden license(s): [{}]", + LOG.debug( + "Overriding license(s) for dependency [{}] with [{}], overriden license(s): [{}]", id, "(" + StringUtils.join(licenses, ") (") + ")", "(" + StringUtils.join(removedFrom.toArray(), ") (") + ")"); } // add licenses to map - addLicense( licenseMap, project, licenses ); + addLicense(licenseMap, project, licenses); } } } @@ -649,84 +575,81 @@ public void overrideLicenses( LicenseMap licenseMap, SortedMap properties = new HashMap<>(); - properties.put( "licenseMap", licenseMap.entrySet() ); - properties.put( "dependencyMap", licenseMap.toDependencyMap().entrySet() ); - String content = freeMarkerHelper.renderTemplate( lineFormat, properties ); - - LOG.info( "Writing third-party file to " + thirdPartyFile ); - if ( verbose ) - { - LOG.info( content ); - } + properties.put("licenseMap", licenseMap.entrySet()); + properties.put("dependencyMap", licenseMap.toDependencyMap().entrySet()); + String content = freeMarkerHelper.renderTemplate(lineFormat, properties); - FileUtil.printString( thirdPartyFile, content, encoding ); + LOG.info("Writing third-party file to " + thirdPartyFile); + if (verbose) { + LOG.info(content); + } + FileUtil.printString(thirdPartyFile, content, encoding); } /** * {@inheritDoc} */ - public void writeBundleThirdPartyFile( File thirdPartyFile, File outputDirectory, String bundleThirdPartyPath ) - throws IOException - { + public void writeBundleThirdPartyFile(File thirdPartyFile, File outputDirectory, String bundleThirdPartyPath) + throws IOException { // creates the bundled license file - File bundleTarget = FileUtil.getFile( outputDirectory, bundleThirdPartyPath ); - LOG.info( "Writing bundled third-party file to {}", bundleTarget ); - FileUtil.copyFile( thirdPartyFile, bundleTarget ); + File bundleTarget = FileUtil.getFile(outputDirectory, bundleThirdPartyPath); + LOG.info("Writing bundled third-party file to {}", bundleTarget); + FileUtil.copyFile(thirdPartyFile, bundleTarget); } - private void loadGlobalLicenses( Set dependencies, List remoteRepositories, + private void loadGlobalLicenses( + Set dependencies, + List remoteRepositories, SortedSet unsafeDependencies, - LicenseMap licenseMap, Map unsafeProjects, - SortedProperties result ) - throws IOException, ArtifactNotFoundException, ArtifactResolutionException - { - for ( Artifact dep : dependencies ) - { - if ( LICENSE_DB_TYPE.equals( dep.getType() ) ) - { - loadOneGlobalSet( unsafeDependencies, licenseMap, unsafeProjects, dep, remoteRepositories, - result ); + LicenseMap licenseMap, + Map unsafeProjects, + SortedProperties result) + throws IOException, ArtifactNotFoundException, ArtifactResolutionException { + for (Artifact dep : dependencies) { + if (LICENSE_DB_TYPE.equals(dep.getType())) { + loadOneGlobalSet(unsafeDependencies, licenseMap, unsafeProjects, dep, remoteRepositories, result); } } } - private void loadOneGlobalSet( SortedSet unsafeDependencies, LicenseMap licenseMap, - Map unsafeProjects, Artifact dep, - List remoteRepositories, - SortedProperties result ) - throws IOException, ArtifactResolutionException - { - File propFile = resolveArtifact( dep.getGroupId(), dep.getArtifactId(), dep.getVersion(), dep.getType(), - dep.getClassifier(), remoteRepositories ); - LOG.info( - "Loading global license map from {}: {}", dep.toString(), propFile.getAbsolutePath() ); - SortedProperties props = new SortedProperties( "utf-8" ); - - try ( InputStream propStream = new FileInputStream( propFile ) ) - { - props.load( propStream ); - } - catch ( IOException e ) - { - throw new IOException( "Unable to load " + propFile.getAbsolutePath(), e ); - } - - for ( Object keyObj : props.keySet() ) - { + private void loadOneGlobalSet( + SortedSet unsafeDependencies, + LicenseMap licenseMap, + Map unsafeProjects, + Artifact dep, + List remoteRepositories, + SortedProperties result) + throws IOException, ArtifactResolutionException { + File propFile = resolveArtifact( + dep.getGroupId(), + dep.getArtifactId(), + dep.getVersion(), + dep.getType(), + dep.getClassifier(), + remoteRepositories); + LOG.info("Loading global license map from {}: {}", dep.toString(), propFile.getAbsolutePath()); + SortedProperties props = new SortedProperties("utf-8"); + + try (InputStream propStream = new FileInputStream(propFile)) { + props.load(propStream); + } catch (IOException e) { + throw new IOException("Unable to load " + propFile.getAbsolutePath(), e); + } + + for (Object keyObj : props.keySet()) { String key = (String) keyObj; - String val = (String) props.get( key ); - result.put( key, val ); + String val = (String) props.get(key); + result.put(key, val); } - resolveUnsafe( unsafeDependencies, licenseMap, unsafeProjects, props, result ); + resolveUnsafe(unsafeDependencies, licenseMap, unsafeProjects, props, result); } // ---------------------------------------------------------------------- @@ -739,37 +662,37 @@ private void loadOneGlobalSet( SortedSet unsafeDependencies, Licen * @return the resolved third party descriptor * @throws ArtifactResolutionException if any */ - private File resolveThirdPartyDescriptor( MavenProject project, List remoteRepositories ) - throws ArtifactResolutionException - { + private File resolveThirdPartyDescriptor(MavenProject project, List remoteRepositories) + throws ArtifactResolutionException { File result; - try - { - result = resolveArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(), - DESCRIPTOR_TYPE, DESCRIPTOR_CLASSIFIER, remoteRepositories ); + try { + result = resolveArtifact( + project.getGroupId(), + project.getArtifactId(), + project.getVersion(), + DESCRIPTOR_TYPE, + DESCRIPTOR_CLASSIFIER, + remoteRepositories); // we use zero length files to avoid re-resolution (see below) - if ( result.length() == 0 ) - { - LOG.debug( "Skipped third party descriptor" ); + if (result.length() == 0) { + LOG.debug("Skipped third party descriptor"); } - } - catch ( ArtifactResolutionException e ) - { - if ( e.getCause() instanceof ArtifactNotFoundException ) - { - ArtifactNotFoundException artifactNotFoundException = ( ArtifactNotFoundException ) e.getCause(); - LOG.debug( "Unable to locate third party files descriptor", artifactNotFoundException ); + } catch (ArtifactResolutionException e) { + if (e.getCause() instanceof ArtifactNotFoundException) { + ArtifactNotFoundException artifactNotFoundException = (ArtifactNotFoundException) e.getCause(); + LOG.debug("Unable to locate third party files descriptor", artifactNotFoundException); org.eclipse.aether.artifact.Artifact artifact; - if ( artifactNotFoundException.getArtifact() == null ) - { - artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), - DESCRIPTOR_CLASSIFIER, null, project.getVersion(), - new DefaultArtifactType( DESCRIPTOR_TYPE ) ); - } - else - { + if (artifactNotFoundException.getArtifact() == null) { + artifact = new DefaultArtifact( + project.getGroupId(), + project.getArtifactId(), + DESCRIPTOR_CLASSIFIER, + null, + project.getVersion(), + new DefaultArtifactType(DESCRIPTOR_TYPE)); + } else { artifact = artifactNotFoundException.getArtifact(); } @@ -779,12 +702,12 @@ private File resolveThirdPartyDescriptor( MavenProject project, List remoteRepositories ) - throws IOException, ArtifactResolutionException, ArtifactNotFoundException - { - return resolveArtifact( groupId, artifactId, version, DESCRIPTOR_TYPE, - DESCRIPTOR_CLASSIFIER, remoteRepositories ); + public File resolveMissingLicensesDescriptor( + String groupId, String artifactId, String version, List remoteRepositories) + throws IOException, ArtifactResolutionException, ArtifactNotFoundException { + return resolveArtifact( + groupId, artifactId, version, DESCRIPTOR_TYPE, DESCRIPTOR_CLASSIFIER, remoteRepositories); } - private File resolveArtifact( String groupId, String artifactId, String version, - String type, String classifier, List remoteRepositories ) - throws ArtifactResolutionException - { - org.eclipse.aether.artifact.Artifact artifact2 - = new DefaultArtifact( groupId, artifactId, classifier, null, - version, new DefaultArtifactType( type ) ); - ArtifactRequest artifactRequest = new ArtifactRequest() - .setArtifact( artifact2 ) - .setRepositories( remoteRepositories ); - ArtifactResult result = aetherRepoSystem.resolveArtifact( mavenSessionProvider.get().getRepositorySession(), - artifactRequest ); + private File resolveArtifact( + String groupId, + String artifactId, + String version, + String type, + String classifier, + List remoteRepositories) + throws ArtifactResolutionException { + org.eclipse.aether.artifact.Artifact artifact2 = + new DefaultArtifact(groupId, artifactId, classifier, null, version, new DefaultArtifactType(type)); + ArtifactRequest artifactRequest = + new ArtifactRequest().setArtifact(artifact2).setRepositories(remoteRepositories); + ArtifactResult result = + aetherRepoSystem.resolveArtifact(mavenSessionProvider.get().getRepositorySession(), artifactRequest); return result.getArtifact().getFile(); } - private Map migrateMissingFileKeys( Set missingFileKeys ) - { + private Map migrateMissingFileKeys(Set missingFileKeys) { Map migrateKeys = new HashMap<>(); - for ( Object object : missingFileKeys ) - { + for (Object object : missingFileKeys) { String id = (String) object; Matcher matcher; String newId = id; - matcher = GAV_PLUS_TYPE_AND_CLASSIFIER_PATTERN.matcher( id ); - if ( matcher.matches() ) - { - newId = matcher.group( 1 ) + "--" + matcher.group( 2 ) + "--" + matcher.group( 3 ); - - } - else - { - matcher = GAV_PLUS_TYPE_PATTERN.matcher( id ); - if ( matcher.matches() ) - { - newId = matcher.group( 1 ) + "--" + matcher.group( 2 ) + "--" + matcher.group( 3 ); - + matcher = GAV_PLUS_TYPE_AND_CLASSIFIER_PATTERN.matcher(id); + if (matcher.matches()) { + newId = matcher.group(1) + "--" + matcher.group(2) + "--" + matcher.group(3); + + } else { + matcher = GAV_PLUS_TYPE_PATTERN.matcher(id); + if (matcher.matches()) { + newId = matcher.group(1) + "--" + matcher.group(2) + "--" + matcher.group(3); } } - migrateKeys.put( id, newId ); + migrateKeys.put(id, newId); } return migrateKeys; } diff --git a/src/main/java/org/codehaus/mojo/license/api/DependenciesTool.java b/src/main/java/org/codehaus/mojo/license/api/DependenciesTool.java index 014997931..95023c3f4 100644 --- a/src/main/java/org/codehaus/mojo/license/api/DependenciesTool.java +++ b/src/main/java/org/codehaus/mojo/license/api/DependenciesTool.java @@ -27,25 +27,25 @@ import javax.inject.Provider; import javax.inject.Singleton; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.ProjectBuildingException; -import org.codehaus.mojo.license.utils.MojoHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; + +import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.building.ModelBuildingRequest; import org.apache.maven.project.DefaultProjectBuildingRequest; +import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuilder; +import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.ProjectBuildingRequest; +import org.codehaus.mojo.license.utils.MojoHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A tool to deal with dependencies of a project. @@ -55,15 +55,14 @@ */ @Named @Singleton -public class DependenciesTool -{ - private static final Logger LOG = LoggerFactory.getLogger( DependenciesTool.class ); +public class DependenciesTool { + private static final Logger LOG = LoggerFactory.getLogger(DependenciesTool.class); /** * Message used when an invalid expression pattern is found. */ public static final String INVALID_PATTERN_MESSAGE = - "The pattern specified by expression <%s> seems to be invalid."; + "The pattern specified by expression <%s> seems to be invalid."; /** * Project builder. @@ -88,11 +87,11 @@ public class DependenciesTool * @return the map of resolved dependencies indexed by their unique id. * @see MavenProjectDependenciesConfigurator */ - public SortedMap loadProjectDependencies( ResolvedProjectDependencies artifacts, - MavenProjectDependenciesConfigurator configuration, - List remoteRepositories, - SortedMap cache ) - { + public SortedMap loadProjectDependencies( + ResolvedProjectDependencies artifacts, + MavenProjectDependenciesConfigurator configuration, + List remoteRepositories, + SortedMap cache) { final ArtifactFilters artifactFilters = configuration.getArtifactFilters(); @@ -100,13 +99,10 @@ public SortedMap loadProjectDependencies( ResolvedProjectD final Set depArtifacts; - if ( configuration.isIncludeTransitiveDependencies() ) - { + if (configuration.isIncludeTransitiveDependencies()) { // All project dependencies depArtifacts = artifacts.getAllDependencies(); - } - else - { + } else { // Only direct project dependencies depArtifacts = artifacts.getDirectDependencies(); } @@ -119,138 +115,116 @@ public SortedMap loadProjectDependencies( ResolvedProjectD Map includeArtifacts = new HashMap<>(); SortedMap localCache = new TreeMap<>(); - if ( cache != null ) - { - synchronized ( cache ) - { - localCache.putAll( cache ); + if (cache != null) { + synchronized (cache) { + localCache.putAll(cache); } } - ProjectBuildingRequest projectBuildingRequest - = new DefaultProjectBuildingRequest( mavenSessionProvider.get().getProjectBuildingRequest() ) - .setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ) - //We already have the relevant part of the dependency tree - //Re-resolving risks including e.g. excluded artifacts - .setResolveDependencies( false ) - //We don't care about plugin licensing - .setProcessPlugins( false ) - .setRemoteRepositories( remoteRepositories ); - - for ( Artifact artifact : depArtifacts ) - { - - excludeArtifacts.put( artifact.getId(), artifact ); - - if ( DefaultThirdPartyTool.LICENSE_DB_TYPE.equals( artifact.getType() ) ) - { + ProjectBuildingRequest projectBuildingRequest = new DefaultProjectBuildingRequest( + mavenSessionProvider.get().getProjectBuildingRequest()) + .setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL) + // We already have the relevant part of the dependency tree + // Re-resolving risks including e.g. excluded artifacts + .setResolveDependencies(false) + // We don't care about plugin licensing + .setProcessPlugins(false) + .setRemoteRepositories(remoteRepositories); + + for (Artifact artifact : depArtifacts) { + + excludeArtifacts.put(artifact.getId(), artifact); + + if (DefaultThirdPartyTool.LICENSE_DB_TYPE.equals(artifact.getType())) { // the special dependencies for license databases don't count. // Note that this will still see transitive deps of a license db; so using the build helper inside of // another project to make them will be noisy. continue; } - if ( !artifactFilters.isIncluded( artifact ) ) - { - LOG.debug( "Excluding artifact {}", artifact ); + if (!artifactFilters.isIncluded(artifact)) { + LOG.debug("Excluding artifact {}", artifact); continue; } - String id = MojoHelper.getArtifactId( artifact ); + String id = MojoHelper.getArtifactId(artifact); - if ( verbose ) - { - LOG.info( "detected artifact {}", id ); + if (verbose) { + LOG.info("detected artifact {}", id); } MavenProject depMavenProject; // try to get project from cache - depMavenProject = localCache.get( id ); + depMavenProject = localCache.get(id); - if ( depMavenProject != null ) - { - if ( verbose ) - { - LOG.info( "add dependency [{}] (from cache)", id ); + if (depMavenProject != null) { + if (verbose) { + LOG.info("add dependency [{}] (from cache)", id); } - } - else - { + } else { // build project - try - { - depMavenProject - = mavenProjectBuilder.build( artifact, true, projectBuildingRequest ).getProject(); - depMavenProject.getArtifact().setScope( artifact.getScope() ); + try { + depMavenProject = mavenProjectBuilder + .build(artifact, true, projectBuildingRequest) + .getProject(); + depMavenProject.getArtifact().setScope(artifact.getScope()); // In case maven-metadata.xml has different artifactId, groupId or version. - if ( !depMavenProject.getGroupId().equals( artifact.getGroupId() ) ) - { - depMavenProject.setGroupId( artifact.getGroupId() ); - depMavenProject.getArtifact().setGroupId( artifact.getGroupId() ); + if (!depMavenProject.getGroupId().equals(artifact.getGroupId())) { + depMavenProject.setGroupId(artifact.getGroupId()); + depMavenProject.getArtifact().setGroupId(artifact.getGroupId()); } - if ( !depMavenProject.getArtifactId().equals( artifact.getArtifactId() ) ) - { - depMavenProject.setArtifactId( artifact.getArtifactId() ); - depMavenProject.getArtifact().setArtifactId( artifact.getArtifactId() ); + if (!depMavenProject.getArtifactId().equals(artifact.getArtifactId())) { + depMavenProject.setArtifactId(artifact.getArtifactId()); + depMavenProject.getArtifact().setArtifactId(artifact.getArtifactId()); } - if ( !depMavenProject.getVersion().equals( artifact.getVersion() ) ) - { - depMavenProject.setVersion( artifact.getVersion() ); - depMavenProject.getArtifact().setVersion( artifact.getVersion() ); + if (!depMavenProject.getVersion().equals(artifact.getVersion())) { + depMavenProject.setVersion(artifact.getVersion()); + depMavenProject.getArtifact().setVersion(artifact.getVersion()); } - } - catch ( ProjectBuildingException e ) - { - LOG.warn( "Unable to obtain POM for artifact: {}", artifact, e ); + } catch (ProjectBuildingException e) { + LOG.warn("Unable to obtain POM for artifact: {}", artifact, e); continue; } - if ( verbose ) - { - LOG.info( "add dependency [{}]", id ); + if (verbose) { + LOG.info("add dependency [{}]", id); } // store it also in cache - localCache.put( id, depMavenProject ); + localCache.put(id, depMavenProject); } // keep the project - result.put( id, depMavenProject ); + result.put(id, depMavenProject); - excludeArtifacts.remove( artifact.getId() ); - includeArtifacts.put( artifact.getId(), artifact ); + excludeArtifacts.remove(artifact.getId()); + includeArtifacts.put(artifact.getId(), artifact); } // exclude artifacts from the result that contain excluded artifacts in the dependency trail - if ( excludeTransitiveDependencies ) - { - for ( Map.Entry entry : includeArtifacts.entrySet() ) - { + if (excludeTransitiveDependencies) { + for (Map.Entry entry : includeArtifacts.entrySet()) { List dependencyTrail = entry.getValue().getDependencyTrail(); boolean remove = false; - for ( int i = 1; i < dependencyTrail.size() - 1; i++ ) - { - if ( excludeArtifacts.containsKey( dependencyTrail.get( i ) ) ) - { + for (int i = 1; i < dependencyTrail.size() - 1; i++) { + if (excludeArtifacts.containsKey(dependencyTrail.get(i))) { remove = true; break; } } - if ( remove ) - { - result.remove( MojoHelper.getArtifactId( entry.getValue() ) ); + if (remove) { + result.remove(MojoHelper.getArtifactId(entry.getValue())); } } } - if ( cache != null ) - { - cache.putAll( result ); + if (cache != null) { + cache.putAll(result); } return result; diff --git a/src/main/java/org/codehaus/mojo/license/api/DependenciesToolException.java b/src/main/java/org/codehaus/mojo/license/api/DependenciesToolException.java index 98238404e..6f8682f80 100644 --- a/src/main/java/org/codehaus/mojo/license/api/DependenciesToolException.java +++ b/src/main/java/org/codehaus/mojo/license/api/DependenciesToolException.java @@ -28,13 +28,10 @@ * @author Tony Chemit - dev@tchemit.fr * @since 1.10 */ -public class DependenciesToolException - extends Exception -{ +public class DependenciesToolException extends Exception { private static final long serialVersionUID = 1L; - public DependenciesToolException( Throwable cause ) - { - super( cause ); + public DependenciesToolException(Throwable cause) { + super(cause); } } diff --git a/src/main/java/org/codehaus/mojo/license/api/FreeMarkerHelper.java b/src/main/java/org/codehaus/mojo/license/api/FreeMarkerHelper.java index cdab1cab4..e18a5e896 100644 --- a/src/main/java/org/codehaus/mojo/license/api/FreeMarkerHelper.java +++ b/src/main/java/org/codehaus/mojo/license/api/FreeMarkerHelper.java @@ -22,6 +22,11 @@ * #L% */ +import java.io.File; +import java.io.IOException; +import java.io.StringWriter; +import java.util.Map; + import freemarker.cache.ClassTemplateLoader; import freemarker.cache.FileTemplateLoader; import freemarker.cache.StringTemplateLoader; @@ -32,19 +37,13 @@ import freemarker.template.Template; import freemarker.template.TemplateException; -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.util.Map; - /** * A helper to deal with freemarker templating. * * @author tchemit dev@tchemit.fr * @since 1.1 */ -public class FreeMarkerHelper -{ +public class FreeMarkerHelper { public static final String TEMPLATE = "template"; @@ -61,10 +60,9 @@ public class FreeMarkerHelper * @return a default helper, if template is a file, then will use it as it, otherwise will have a look into * classloader in current package. */ - public static FreeMarkerHelper newDefaultHelper() - { - ClassTemplateLoader templateLoader = new ClassTemplateLoader( FreeMarkerHelper.class, "/" ); - FreeMarkerHelper result = new FreeMarkerHelper( templateLoader ); + public static FreeMarkerHelper newDefaultHelper() { + ClassTemplateLoader templateLoader = new ClassTemplateLoader(FreeMarkerHelper.class, "/"); + FreeMarkerHelper result = new FreeMarkerHelper(templateLoader); return result; } @@ -73,73 +71,57 @@ public static FreeMarkerHelper newDefaultHelper() * @param stringTemplate template * @return a helper, if template is a file, then will use it as it, otherwise will use the given template */ - public static FreeMarkerHelper newHelperFromContent( String stringTemplate ) - { + public static FreeMarkerHelper newHelperFromContent(String stringTemplate) { StringTemplateLoader templateLoader = new StringTemplateLoader(); - templateLoader.putTemplate( TEMPLATE, stringTemplate ); + templateLoader.putTemplate(TEMPLATE, stringTemplate); - FreeMarkerHelper result = new FreeMarkerHelper( templateLoader ); + FreeMarkerHelper result = new FreeMarkerHelper(templateLoader); return result; } - protected FreeMarkerHelper( TemplateLoader templateLoader ) - { + protected FreeMarkerHelper(TemplateLoader templateLoader) { this.templateLoader = templateLoader; freemarkerConfiguration = new Configuration(); - freemarkerConfiguration.setTemplateLoader( templateLoader ); + freemarkerConfiguration.setTemplateLoader(templateLoader); BeansWrapper objectWrapper = new DefaultObjectWrapper(); - freemarkerConfiguration.setObjectWrapper( objectWrapper ); + freemarkerConfiguration.setObjectWrapper(objectWrapper); } - public Template getTemplate( String templateName ) - throws IOException - { + public Template getTemplate(String templateName) throws IOException { - File file = new File( templateName ); - if ( file.exists() ) - { + File file = new File(templateName); + if (file.exists()) { // this is a file - freemarkerConfiguration.setTemplateLoader( new FileTemplateLoader( file.getParentFile() ) ); + freemarkerConfiguration.setTemplateLoader(new FileTemplateLoader(file.getParentFile())); templateName = file.getName(); - } - else - { + } else { // just use the classloader - freemarkerConfiguration.setTemplateLoader( templateLoader ); + freemarkerConfiguration.setTemplateLoader(templateLoader); } - Template template = freemarkerConfiguration.getTemplate( templateName ); + Template template = freemarkerConfiguration.getTemplate(templateName); - if ( template == null ) - { - throw new IOException( "Could not find template " + templateName ); + if (template == null) { + throw new IOException("Could not find template " + templateName); } return template; } - public String renderTemplate( String templateName, Map parameters ) - throws IOException - { + public String renderTemplate(String templateName, Map parameters) throws IOException { - Template template = getTemplate( templateName ); - return renderTemplate( template, parameters ); + Template template = getTemplate(templateName); + return renderTemplate(template, parameters); } - public String renderTemplate( Template template, Map parameters ) - throws IOException - { + public String renderTemplate(Template template, Map parameters) throws IOException { StringWriter out = new StringWriter(); - try - { - template.process( parameters, out ); - } - catch ( TemplateException e ) - { - throw new IOException( "Could not render template " + template.getName() + " for reason " - + e.getMessage() ); + try { + template.process(parameters, out); + } catch (TemplateException e) { + throw new IOException("Could not render template " + template.getName() + " for reason " + e.getMessage()); } return out.toString(); } diff --git a/src/main/java/org/codehaus/mojo/license/api/MavenProjectDependenciesConfigurator.java b/src/main/java/org/codehaus/mojo/license/api/MavenProjectDependenciesConfigurator.java index c58251c94..1d494765a 100644 --- a/src/main/java/org/codehaus/mojo/license/api/MavenProjectDependenciesConfigurator.java +++ b/src/main/java/org/codehaus/mojo/license/api/MavenProjectDependenciesConfigurator.java @@ -32,8 +32,7 @@ * @see DependenciesTool * @since 1.0 */ -public interface MavenProjectDependenciesConfigurator -{ +public interface MavenProjectDependenciesConfigurator { /** * @return {@code true} if should include transitive dependencies, {@code false} to include only direct diff --git a/src/main/java/org/codehaus/mojo/license/api/ResolvedProjectDependencies.java b/src/main/java/org/codehaus/mojo/license/api/ResolvedProjectDependencies.java index 3ba71f77d..b955d5695 100644 --- a/src/main/java/org/codehaus/mojo/license/api/ResolvedProjectDependencies.java +++ b/src/main/java/org/codehaus/mojo/license/api/ResolvedProjectDependencies.java @@ -25,6 +25,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.Set; + import org.apache.maven.artifact.Artifact; /** @@ -38,26 +39,21 @@ * replace B with its dependencies when processing A. This field stores that modified view of the project's * dependencies. */ -public class ResolvedProjectDependencies -{ +public class ResolvedProjectDependencies { private final Set allDependencies; private final Set directDependencies; - public ResolvedProjectDependencies( Set allDependencies, Set directDependencies ) - { - this.allDependencies = Collections.unmodifiableSet( new HashSet<>( allDependencies ) ); - this.directDependencies = Collections.unmodifiableSet( new HashSet<>( directDependencies ) ); + public ResolvedProjectDependencies(Set allDependencies, Set directDependencies) { + this.allDependencies = Collections.unmodifiableSet(new HashSet<>(allDependencies)); + this.directDependencies = Collections.unmodifiableSet(new HashSet<>(directDependencies)); } - public Set getAllDependencies() - { + public Set getAllDependencies() { return allDependencies; } - public Set getDirectDependencies() - { + public Set getDirectDependencies() { return directDependencies; } - } diff --git a/src/main/java/org/codehaus/mojo/license/api/ThirdPartyDetails.java b/src/main/java/org/codehaus/mojo/license/api/ThirdPartyDetails.java index af363debf..249f5ba1b 100644 --- a/src/main/java/org/codehaus/mojo/license/api/ThirdPartyDetails.java +++ b/src/main/java/org/codehaus/mojo/license/api/ThirdPartyDetails.java @@ -28,8 +28,7 @@ * @author tchemit dev@tchemit.fr * @since 1.1 */ -public interface ThirdPartyDetails -{ +public interface ThirdPartyDetails { /** * @return the groupId of the dependency @@ -86,7 +85,7 @@ public interface ThirdPartyDetails * * @param pomLicenses licenses loaded from the pom file */ - void setPomLicenses( String[] pomLicenses ); + void setPomLicenses(String[] pomLicenses); /** * @return the licenses defined in the third-party file. @@ -98,7 +97,7 @@ public interface ThirdPartyDetails * * @param thirdPartyLicenses licenses loaded from the third-party file */ - void setThirdPartyLicenses( String[] thirdPartyLicenses ); + void setThirdPartyLicenses(String[] thirdPartyLicenses); /** * @return {@code true} if the project has his licenses defined in the third-party file. diff --git a/src/main/java/org/codehaus/mojo/license/api/ThirdPartyHelper.java b/src/main/java/org/codehaus/mojo/license/api/ThirdPartyHelper.java index 4f6c9ced2..2dd7d165d 100644 --- a/src/main/java/org/codehaus/mojo/license/api/ThirdPartyHelper.java +++ b/src/main/java/org/codehaus/mojo/license/api/ThirdPartyHelper.java @@ -22,14 +22,6 @@ * #L% */ -import org.apache.maven.artifact.Artifact; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.ProjectBuildingException; -import org.codehaus.mojo.license.model.LicenseMap; -import org.codehaus.mojo.license.utils.SortedProperties; - import java.io.File; import java.io.IOException; import java.util.Collection; @@ -38,14 +30,21 @@ import java.util.SortedMap; import java.util.SortedSet; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.ProjectBuildingException; +import org.codehaus.mojo.license.model.LicenseMap; +import org.codehaus.mojo.license.utils.SortedProperties; + /** * Helper class that provides common functionality required by both the mojos and the reports. * * @author tchemit dev@tchemit.fr * @since 1.1 */ -public interface ThirdPartyHelper -{ +public interface ThirdPartyHelper { /** * Load all dependencies given the configuration as {@link MavenProject}. @@ -54,9 +53,8 @@ public interface ThirdPartyHelper * @param dependencyArtifacts the dependency artifacts of the project * @return the dictionary of loaded dependencies as {@link MavenProject} indexed by their gav. */ - SortedMap loadDependencies( MavenProjectDependenciesConfigurator configuration, - ResolvedProjectDependencies dependencyArtifacts ); - + SortedMap loadDependencies( + MavenProjectDependenciesConfigurator configuration, ResolvedProjectDependencies dependencyArtifacts); /** * Try to load maximum of unsafe license mapping using third-party descriptors (from maven repositories) and @@ -70,10 +68,11 @@ SortedMap loadDependencies( MavenProjectDependenciesConfig * @throws ThirdPartyToolException if any * @throws IOException if any */ - SortedProperties loadThirdPartyDescriptorForUnsafeMapping( Set topLevelDependencies, - SortedSet unsafeDependencies, - Collection projects, - LicenseMap licenseMap ) + SortedProperties loadThirdPartyDescriptorForUnsafeMapping( + Set topLevelDependencies, + SortedSet unsafeDependencies, + Collection projects, + LicenseMap licenseMap) throws ThirdPartyToolException, IOException; /** @@ -89,9 +88,12 @@ SortedProperties loadThirdPartyDescriptorForUnsafeMapping( Set topLeve * @return the map of all unsafe mapping * @throws IOException if could not load missing file */ - SortedProperties loadUnsafeMapping( LicenseMap licenseMap, File missingFile, String missingFileUrl, - SortedMap projectDependencies ) - throws IOException, MojoExecutionException; + SortedProperties loadUnsafeMapping( + LicenseMap licenseMap, + File missingFile, + String missingFileUrl, + SortedMap projectDependencies) + throws IOException, MojoExecutionException; /** * Creates a license map from given dependencies. @@ -99,14 +101,14 @@ SortedProperties loadUnsafeMapping( LicenseMap licenseMap, File missingFile, Str * @param dependencies dependencies to store in the license map * @return the created license map fro the given dependencies */ - LicenseMap createLicenseMap( SortedMap dependencies ); + LicenseMap createLicenseMap(SortedMap dependencies); /** * Attach the third-party descriptor to the build. * * @param file location of the third-party descriptor */ - void attachThirdPartyDescriptor( File file ); + void attachThirdPartyDescriptor(File file); /** * Obtains all dependencies with no license form the given license map. @@ -114,7 +116,7 @@ SortedProperties loadUnsafeMapping( LicenseMap licenseMap, File missingFile, Str * @param licenseMap license map where to find * @return all dependencies with no license */ - SortedSet getProjectsWithNoLicense( LicenseMap licenseMap ); + SortedSet getProjectsWithNoLicense(LicenseMap licenseMap); /** * Obtains the cache of loaded dependencies indexed by their gav. @@ -152,12 +154,15 @@ SortedProperties loadUnsafeMapping( LicenseMap licenseMap, File missingFile, Str * @throws IOException if could not load missing file * @throws ThirdPartyToolException if pb with third-party tool */ - SortedProperties createUnsafeMapping( LicenseMap licenseMap, File missingFile, String missingFileUrl, - boolean useRepositoryMissingFiles, - SortedSet unsafeDependencies, - SortedMap projectDependencies, - Set dependencyArtifacts ) - throws ProjectBuildingException, IOException, ThirdPartyToolException, MojoExecutionException; + SortedProperties createUnsafeMapping( + LicenseMap licenseMap, + File missingFile, + String missingFileUrl, + boolean useRepositoryMissingFiles, + SortedSet unsafeDependencies, + SortedMap projectDependencies, + Set dependencyArtifacts) + throws ProjectBuildingException, IOException, ThirdPartyToolException, MojoExecutionException; /** * Merges licenses. @@ -168,5 +173,5 @@ SortedProperties createUnsafeMapping( LicenseMap licenseMap, File missingFile, S * @throws MojoFailureException if there is a bad license merge definition (says for example two license with * same name) */ - void mergeLicenses( List licenseMerges, LicenseMap licenseMap ) throws MojoFailureException; + void mergeLicenses(List licenseMerges, LicenseMap licenseMap) throws MojoFailureException; } diff --git a/src/main/java/org/codehaus/mojo/license/api/ThirdPartyTool.java b/src/main/java/org/codehaus/mojo/license/api/ThirdPartyTool.java index 8ce799e2d..98e7eba61 100644 --- a/src/main/java/org/codehaus/mojo/license/api/ThirdPartyTool.java +++ b/src/main/java/org/codehaus/mojo/license/api/ThirdPartyTool.java @@ -22,13 +22,6 @@ * #L% */ -import org.apache.maven.artifact.Artifact; -import org.apache.maven.model.License; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.project.MavenProject; -import org.codehaus.mojo.license.model.LicenseMap; -import org.codehaus.mojo.license.utils.SortedProperties; - import java.io.File; import java.io.IOException; import java.util.Collection; @@ -36,6 +29,13 @@ import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.model.License; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.project.MavenProject; +import org.codehaus.mojo.license.model.LicenseMap; +import org.codehaus.mojo.license.utils.SortedProperties; import org.eclipse.aether.repository.RemoteRepository; import org.eclipse.aether.resolution.ArtifactResolutionException; import org.eclipse.aether.transfer.ArtifactNotFoundException; @@ -48,8 +48,7 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public interface ThirdPartyTool -{ +public interface ThirdPartyTool { /** * Plexus Role. @@ -70,7 +69,7 @@ public interface ThirdPartyTool * @param verbose new verbose mode to set * @since 1.4 */ - void setVerbose( boolean verbose ); + void setVerbose(boolean verbose); /** * Collect license information from property file, 'third-party' classified artifacts, and .license.properties @@ -86,11 +85,13 @@ public interface ThirdPartyTool * @throws ThirdPartyToolException if any * @throws IOException if any */ - SortedProperties loadThirdPartyDescriptorsForUnsafeMapping( Set dependencies, String encoding, - Collection projects, - SortedSet unsafeProjects, - LicenseMap licenseMap, - List remoteRepositories ) + SortedProperties loadThirdPartyDescriptorsForUnsafeMapping( + Set dependencies, + String encoding, + Collection projects, + SortedSet unsafeProjects, + LicenseMap licenseMap, + List remoteRepositories) throws ThirdPartyToolException, IOException; /** @@ -101,7 +102,7 @@ SortedProperties loadThirdPartyDescriptorsForUnsafeMapping( Set depend * @param project the project on which to attch the third-party file * @param file the third-party file to attach. */ - void attachThirdPartyDescriptor( MavenProject project, File file ); + void attachThirdPartyDescriptor(MavenProject project, File file); /** * Obtain the third party file from the repository. @@ -113,11 +114,11 @@ SortedProperties loadThirdPartyDescriptorsForUnsafeMapping( Set depend * @return the locale file resolved into the local repository * @throws ThirdPartyToolException if any */ - File resolvThirdPartyDescriptor( MavenProject project, List remoteRepositories ) + File resolvThirdPartyDescriptor(MavenProject project, List remoteRepositories) throws ThirdPartyToolException; - File resolveMissingLicensesDescriptor( String groupId, String artifactId, String version, - List remoteRepositories ) + File resolveMissingLicensesDescriptor( + String groupId, String artifactId, String version, List remoteRepositories) throws IOException, ArtifactResolutionException, ArtifactNotFoundException; /** @@ -127,7 +128,7 @@ File resolveMissingLicensesDescriptor( String groupId, String artifactId, String * @param doLog a flag to add debug logs * @return the set of projects with no license */ - SortedSet getProjectsWithNoLicense( LicenseMap licenseMap ); + SortedSet getProjectsWithNoLicense(LicenseMap licenseMap); /** * Loads unsafe mapping and returns it. @@ -141,8 +142,12 @@ File resolveMissingLicensesDescriptor( String groupId, String artifactId, String * @return the unsafe mapping * @throws IOException if pb while reading missing file */ - SortedProperties loadUnsafeMapping( LicenseMap licenseMap, SortedMap artifactCache, - String encoding, File missingFile, String missingFileUrl ) + SortedProperties loadUnsafeMapping( + LicenseMap licenseMap, + SortedMap artifactCache, + String encoding, + File missingFile, + String missingFileUrl) throws IOException, MojoExecutionException; /** @@ -155,8 +160,9 @@ SortedProperties loadUnsafeMapping( LicenseMap licenseMap, SortedMap artifactCache, String encoding, - String overrideUrl ) throws IOException; + void overrideLicenses( + LicenseMap licenseMap, SortedMap artifactCache, String encoding, String overrideUrl) + throws IOException; /** * Add one or more licenses (name and url are {@code licenseNames}) to the given {@code licenseMap} for the given @@ -166,7 +172,7 @@ void overrideLicenses( LicenseMap licenseMap, SortedMap ar * @param project the project * @param licenseNames the names of the licenses */ - void addLicense( LicenseMap licenseMap, MavenProject project, String... licenseNames ); + void addLicense(LicenseMap licenseMap, MavenProject project, String... licenseNames); /** * Add a given {@code license} to the given {@code licenseMap} for the given {@code project}. @@ -175,7 +181,7 @@ void overrideLicenses( LicenseMap licenseMap, SortedMap ar * @param project the project * @param license the license to add */ - void addLicense( LicenseMap licenseMap, MavenProject project, License license ); + void addLicense(LicenseMap licenseMap, MavenProject project, License license); /** * Add a given {@code licenses} to the given {@code licenseMap} for the given {@code project}. @@ -184,7 +190,7 @@ void overrideLicenses( LicenseMap licenseMap, SortedMap ar * @param project the project * @param licenses the licenses to add */ - void addLicense( LicenseMap licenseMap, MavenProject project, List licenses ); + void addLicense(LicenseMap licenseMap, MavenProject project, List licenses); /** * For a given {@code licenseMap}, merge all {@code licenses}. @@ -196,7 +202,7 @@ void overrideLicenses( LicenseMap licenseMap, SortedMap ar * @param mainLicense the main license to keep * @param licensesToMerge all the licenses to merge */ - void mergeLicenses( LicenseMap licenseMap, String mainLicense, Set licensesToMerge ); + void mergeLicenses(LicenseMap licenseMap, String mainLicense, Set licensesToMerge); /** * Write the content of the third-party file. @@ -208,8 +214,8 @@ void overrideLicenses( LicenseMap licenseMap, SortedMap ar * @param template the location of the freemarker template used to generate the file content * @throws IOException if any probem while writing file */ - void writeThirdPartyFile( LicenseMap licenseMap, File thirdPartyFile, boolean verbose, String encoding, - String template ) + void writeThirdPartyFile( + LicenseMap licenseMap, File thirdPartyFile, boolean verbose, String encoding, String template) throws IOException; /** @@ -220,6 +226,6 @@ void writeThirdPartyFile( LicenseMap licenseMap, File thirdPartyFile, boolean ve * @param bundleThirdPartyPath relative end path of the file to generate * @throws IOException if any problem while writing file */ - void writeBundleThirdPartyFile( File thirdPartyFile, File outputDirectory, String bundleThirdPartyPath ) + void writeBundleThirdPartyFile(File thirdPartyFile, File outputDirectory, String bundleThirdPartyPath) throws IOException; } diff --git a/src/main/java/org/codehaus/mojo/license/api/ThirdPartyToolException.java b/src/main/java/org/codehaus/mojo/license/api/ThirdPartyToolException.java index ea35da068..b8ef5020e 100644 --- a/src/main/java/org/codehaus/mojo/license/api/ThirdPartyToolException.java +++ b/src/main/java/org/codehaus/mojo/license/api/ThirdPartyToolException.java @@ -28,9 +28,7 @@ * @author tony chemit * @version $Id$ */ -public class ThirdPartyToolException - extends Exception -{ +public class ThirdPartyToolException extends Exception { /** * Construct a new ThirdPartyToolException exception wrapping an underlying Exception * and providing a message. @@ -38,9 +36,8 @@ public class ThirdPartyToolException * @param message could be null * @param cause could be null */ - public ThirdPartyToolException( String message, Exception cause ) - { - super( message, cause ); + public ThirdPartyToolException(String message, Exception cause) { + super(message, cause); } /** @@ -50,9 +47,8 @@ public ThirdPartyToolException( String message, Exception cause ) * @param message could be null * @param cause could be null */ - public ThirdPartyToolException( String message, Throwable cause ) - { - super( message, cause ); + public ThirdPartyToolException(String message, Throwable cause) { + super(message, cause); } /** @@ -60,8 +56,7 @@ public ThirdPartyToolException( String message, Throwable cause ) * * @param message could be null */ - public ThirdPartyToolException( String message ) - { - super( message ); + public ThirdPartyToolException(String message) { + super(message); } } diff --git a/src/main/java/org/codehaus/mojo/license/download/Cache.java b/src/main/java/org/codehaus/mojo/license/download/Cache.java index 7bbe5b199..9e92ce8cf 100644 --- a/src/main/java/org/codehaus/mojo/license/download/Cache.java +++ b/src/main/java/org/codehaus/mojo/license/download/Cache.java @@ -35,16 +35,14 @@ * @author Peter Palaga * @since 1.18 */ -public class Cache -{ +public class Cache { private final Map urlToFile = new HashMap<>(); private final Map sha1ToFile = new HashMap<>(); private final boolean enforcingUniqueSha1s; - public Cache( boolean enforcingUniqueSha1s ) - { + public Cache(boolean enforcingUniqueSha1s) { super(); this.enforcingUniqueSha1s = enforcingUniqueSha1s; } @@ -54,9 +52,8 @@ public Cache( boolean enforcingUniqueSha1s ) * @return the {@link LicenseDownloadResult} bound to the given {@code url} or {@code null} if no entry is bound to * the given {@code url} */ - public LicenseDownloadResult get( String url ) - { - return urlToFile.get( url ); + public LicenseDownloadResult get(String url) { + return urlToFile.get(url); } /** @@ -68,38 +65,29 @@ public LicenseDownloadResult get( String url ) * @param url the URL the given {@code entry} comes from * @param entry the result of downloading from {@code url} */ - public void put( String url, LicenseDownloadResult entry ) - { - if ( entry.isSuccess() ) - { + public void put(String url, LicenseDownloadResult entry) { + if (entry.isSuccess()) { final String sha1 = entry.getSha1(); final File entryFile = entry.getFile(); - final LicenseDownloadResult existing = sha1ToFile.get( sha1 ); - if ( existing == null ) - { - sha1ToFile.put( sha1, entry ); - } - else if ( enforcingUniqueSha1s && !existing.getFile().equals( entryFile ) ) - { + final LicenseDownloadResult existing = sha1ToFile.get(sha1); + if (existing == null) { + sha1ToFile.put(sha1, entry); + } else if (enforcingUniqueSha1s && !existing.getFile().equals(entryFile)) { final File existingFile = existing.getFile(); final StringBuilder sb = new StringBuilder(); - for ( Entry en : urlToFile.entrySet() ) - { - if ( existingFile.equals( en.getValue().getFile() ) ) - { - if ( sb.length() > 0 ) - { - sb.append( ", " ); + for (Entry en : urlToFile.entrySet()) { + if (existingFile.equals(en.getValue().getFile())) { + if (sb.length() > 0) { + sb.append(", "); } - sb.append( en.getKey() ); + sb.append(en.getKey()); } } - throw new IllegalStateException( "URL '" + url - + "' should belong to licenseUrlFileName having key '" + existingFile.getName() - + "' together with URLs '" + sb.toString() + "'" ); + throw new IllegalStateException("URL '" + url + + "' should belong to licenseUrlFileName having key '" + existingFile.getName() + + "' together with URLs '" + sb.toString() + "'"); } } - urlToFile.put( url, entry ); + urlToFile.put(url, entry); } - -} \ No newline at end of file +} diff --git a/src/main/java/org/codehaus/mojo/license/download/FileNameEntry.java b/src/main/java/org/codehaus/mojo/license/download/FileNameEntry.java index aa6278f4a..e41ab6bd8 100644 --- a/src/main/java/org/codehaus/mojo/license/download/FileNameEntry.java +++ b/src/main/java/org/codehaus/mojo/license/download/FileNameEntry.java @@ -31,10 +31,8 @@ * @author Peter Palaga * @since 1.18 */ -public class FileNameEntry -{ - public FileNameEntry( File file, boolean preferred, String sha1 ) - { +public class FileNameEntry { + public FileNameEntry(File file, boolean preferred, String sha1) { super(); this.file = file; this.preferred = preferred; @@ -47,18 +45,15 @@ public FileNameEntry( File file, boolean preferred, String sha1 ) private final String sha1; - public File getFile() - { + public File getFile() { return file; } - public boolean isPreferred() - { + public boolean isPreferred() { return preferred; } - public String getSha1() - { + public String getSha1() { return sha1; } -} \ No newline at end of file +} diff --git a/src/main/java/org/codehaus/mojo/license/download/License.java b/src/main/java/org/codehaus/mojo/license/download/License.java index e7da40a36..070020610 100644 --- a/src/main/java/org/codehaus/mojo/license/download/License.java +++ b/src/main/java/org/codehaus/mojo/license/download/License.java @@ -26,8 +26,7 @@ * @author Peter Palaga * @since 1.20 */ -public class License -{ +public class License { /** * The full legal name of the license. @@ -55,8 +54,7 @@ public class License */ private final String comments; - public License( String name, String url, String distribution, String comments ) - { + public License(String name, String url, String distribution, String comments) { super(); this.name = name; this.url = url; @@ -64,24 +62,19 @@ public License( String name, String url, String distribution, String comments ) this.comments = comments; } - public String getName() - { + public String getName() { return name; } - public String getUrl() - { + public String getUrl() { return url; } - public String getDistribution() - { + public String getDistribution() { return distribution; } - public String getComments() - { + public String getComments() { return comments; } - } diff --git a/src/main/java/org/codehaus/mojo/license/download/LicenseDownloader.java b/src/main/java/org/codehaus/mojo/license/download/LicenseDownloader.java index 944cdeb60..940348d26 100644 --- a/src/main/java/org/codehaus/mojo/license/download/LicenseDownloader.java +++ b/src/main/java/org/codehaus/mojo/license/download/LicenseDownloader.java @@ -79,77 +79,69 @@ * @author pgier * @since 1.0 */ -public class LicenseDownloader implements AutoCloseable -{ - private static final Logger LOG = LoggerFactory.getLogger( LicenseDownloader.class ); +public class LicenseDownloader implements AutoCloseable { + private static final Logger LOG = LoggerFactory.getLogger(LicenseDownloader.class); - private static final Pattern EXTENSION_PATTERN = Pattern.compile( "\\.[a-z]{1,4}$", Pattern.CASE_INSENSITIVE ); + private static final Pattern EXTENSION_PATTERN = Pattern.compile("\\.[a-z]{1,4}$", Pattern.CASE_INSENSITIVE); private final CloseableHttpClient client; private final Map contentSanitizers; private final Charset charset; - public LicenseDownloader( Proxy proxy, int connectTimeout, int socketTimeout, int connectionRequestTimeout, - Map contentSanitizers, Charset charset ) - { + public LicenseDownloader( + Proxy proxy, + int connectTimeout, + int socketTimeout, + int connectionRequestTimeout, + Map contentSanitizers, + Charset charset) { this.contentSanitizers = contentSanitizers; this.charset = charset; - final Builder configBuilder = RequestConfig.copy( RequestConfig.DEFAULT ) // - .setConnectTimeout( connectTimeout ) // - .setSocketTimeout( socketTimeout ) // - .setCookieSpec(CookieSpecs.STANDARD) - .setConnectionRequestTimeout( connectionRequestTimeout ); - - if ( proxy != null ) - { - configBuilder.setProxy( new HttpHost( proxy.getHost(), proxy.getPort(), proxy.getProtocol() ) ); + final Builder configBuilder = RequestConfig.copy(RequestConfig.DEFAULT) // + .setConnectTimeout(connectTimeout) // + .setSocketTimeout(socketTimeout) // + .setCookieSpec(CookieSpecs.STANDARD) + .setConnectionRequestTimeout(connectionRequestTimeout); + + if (proxy != null) { + configBuilder.setProxy(new HttpHost(proxy.getHost(), proxy.getPort(), proxy.getProtocol())); } - HttpClientBuilder clientBuilder = HttpClients.custom().setDefaultRequestConfig( configBuilder.build() ); - if ( proxy != null ) - { - if ( proxy.getUsername() != null && proxy.getPassword() != null ) - { + HttpClientBuilder clientBuilder = HttpClients.custom().setDefaultRequestConfig(configBuilder.build()); + if (proxy != null) { + if (proxy.getUsername() != null && proxy.getPassword() != null) { final CredentialsProvider credsProvider = new BasicCredentialsProvider(); - final Credentials creds = new UsernamePasswordCredentials( proxy.getUsername(), proxy.getPassword() ); - credsProvider.setCredentials( new AuthScope( proxy.getHost(), proxy.getPort() ), creds ); - clientBuilder.setDefaultCredentialsProvider( credsProvider ); + final Credentials creds = new UsernamePasswordCredentials(proxy.getUsername(), proxy.getPassword()); + credsProvider.setCredentials(new AuthScope(proxy.getHost(), proxy.getPort()), creds); + clientBuilder.setDefaultCredentialsProvider(credsProvider); } final String rawNonProxyHosts = proxy.getNonProxyHosts(); - if ( rawNonProxyHosts != null ) - { - final String[] nonProxyHosts = rawNonProxyHosts.split( "|" ); - if ( nonProxyHosts.length > 0 ) - { + if (rawNonProxyHosts != null) { + final String[] nonProxyHosts = rawNonProxyHosts.split("|"); + if (nonProxyHosts.length > 0) { final List nonProxyPatterns = new ArrayList<>(); - for ( String nonProxyHost : nonProxyHosts ) - { - final Pattern pat = - Pattern.compile( nonProxyHost.replaceAll( "\\.", "\\\\." ).replaceAll( "\\*", ".*" ), - Pattern.CASE_INSENSITIVE ); - nonProxyPatterns.add( pat ); + for (String nonProxyHost : nonProxyHosts) { + final Pattern pat = Pattern.compile( + nonProxyHost.replaceAll("\\.", "\\\\.").replaceAll("\\*", ".*"), + Pattern.CASE_INSENSITIVE); + nonProxyPatterns.add(pat); } - final HttpHost proxyHost = new HttpHost( proxy.getHost(), proxy.getPort() ); - final HttpRoutePlanner routePlanner = new DefaultProxyRoutePlanner( proxyHost ) - { + final HttpHost proxyHost = new HttpHost(proxy.getHost(), proxy.getPort()); + final HttpRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxyHost) { @Override - protected HttpHost determineProxy( HttpHost target, HttpRequest request, HttpContext context ) - throws HttpException - { - for ( Pattern pattern : nonProxyPatterns ) - { - if ( pattern.matcher( target.getHostName() ).matches() ) - { + protected HttpHost determineProxy(HttpHost target, HttpRequest request, HttpContext context) + throws HttpException { + for (Pattern pattern : nonProxyPatterns) { + if (pattern.matcher(target.getHostName()).matches()) { return null; } } - return super.determineProxy( target, request, context ); + return super.determineProxy(target, request, context); } - }; - clientBuilder.setRoutePlanner( routePlanner ); + clientBuilder.setRoutePlanner(routePlanner); } } } @@ -169,172 +161,139 @@ protected HttpHost determineProxy( HttpHost target, HttpRequest request, HttpCon * @throws URISyntaxException * @throws MojoFailureException */ - public LicenseDownloadResult downloadLicense( String licenseUrlString, FileNameEntry fileNameEntry ) - throws IOException, URISyntaxException, MojoFailureException - { + public LicenseDownloadResult downloadLicense(String licenseUrlString, FileNameEntry fileNameEntry) + throws IOException, URISyntaxException, MojoFailureException { final File outputFile = fileNameEntry.getFile(); - if ( licenseUrlString == null || licenseUrlString.length() == 0 ) - { - throw new IllegalArgumentException( "Null URL for file " + outputFile.getPath() ); + if (licenseUrlString == null || licenseUrlString.length() == 0) { + throw new IllegalArgumentException("Null URL for file " + outputFile.getPath()); } - List sanitizers = filterSanitizers( licenseUrlString ); - - if ( licenseUrlString.startsWith( "file://" ) ) - { - LOG.debug( "Downloading '{}' -> '{}'", licenseUrlString, outputFile ); - Path in = Paths.get( new URI( licenseUrlString ) ); - if ( sanitizers.isEmpty() ) - { - Files.copy( in, outputFile.toPath() ); - return LicenseDownloadResult.success( outputFile, FileUtil.sha1( in ), fileNameEntry.isPreferred() ); - } - else - { - try ( BufferedReader r = Files.newBufferedReader( in, charset ) ) - { - return sanitize( r, outputFile, charset, sanitizers, fileNameEntry.isPreferred() ); + List sanitizers = filterSanitizers(licenseUrlString); + + if (licenseUrlString.startsWith("file://")) { + LOG.debug("Downloading '{}' -> '{}'", licenseUrlString, outputFile); + Path in = Paths.get(new URI(licenseUrlString)); + if (sanitizers.isEmpty()) { + Files.copy(in, outputFile.toPath()); + return LicenseDownloadResult.success(outputFile, FileUtil.sha1(in), fileNameEntry.isPreferred()); + } else { + try (BufferedReader r = Files.newBufferedReader(in, charset)) { + return sanitize(r, outputFile, charset, sanitizers, fileNameEntry.isPreferred()); } } - } - else - { - LOG.debug( "About to download '{}'", licenseUrlString ); - try ( CloseableHttpResponse response = client.execute( new HttpGet( licenseUrlString ) ) ) - { + } else { + LOG.debug("About to download '{}'", licenseUrlString); + try (CloseableHttpResponse response = client.execute(new HttpGet(licenseUrlString))) { final StatusLine statusLine = response.getStatusLine(); - if ( statusLine.getStatusCode() != HttpStatus.SC_OK ) - { - return LicenseDownloadResult.failure( "'" + licenseUrlString + "' returned " - + statusLine.getStatusCode() - + ( statusLine.getReasonPhrase() != null ? " " + statusLine.getReasonPhrase() : "" ) ); + if (statusLine.getStatusCode() != HttpStatus.SC_OK) { + return LicenseDownloadResult.failure("'" + licenseUrlString + "' returned " + + statusLine.getStatusCode() + + (statusLine.getReasonPhrase() != null ? " " + statusLine.getReasonPhrase() : "")); } final HttpEntity entity = response.getEntity(); - if ( entity != null ) - { - final ContentType contentType = ContentType.get( entity ); - - File updatedFile = fileNameEntry.isPreferred() ? outputFile - : updateFileExtension( outputFile, - contentType != null ? contentType.getMimeType() : null ); - LOG.debug( "Downloading '{}' -> '{}'{}", - licenseUrlString, - updatedFile, - fileNameEntry.isPreferred() ? " (preferred file name)" : "" ); - - if ( sanitizers.isEmpty() ) - { - try ( InputStream in = entity.getContent(); - FileOutputStream fos = new FileOutputStream( updatedFile ) ) - { - final MessageDigest md = MessageDigest.getInstance( "SHA-1" ); + if (entity != null) { + final ContentType contentType = ContentType.get(entity); + + File updatedFile = fileNameEntry.isPreferred() + ? outputFile + : updateFileExtension(outputFile, contentType != null ? contentType.getMimeType() : null); + LOG.debug( + "Downloading '{}' -> '{}'{}", + licenseUrlString, + updatedFile, + fileNameEntry.isPreferred() ? " (preferred file name)" : ""); + + if (sanitizers.isEmpty()) { + try (InputStream in = entity.getContent(); + FileOutputStream fos = new FileOutputStream(updatedFile)) { + final MessageDigest md = MessageDigest.getInstance("SHA-1"); final byte[] buf = new byte[1024]; int len; - while ( ( len = in.read( buf ) ) >= 0 ) - { - md.update( buf, 0, len ); - fos.write( buf, 0, len ); + while ((len = in.read(buf)) >= 0) { + md.update(buf, 0, len); + fos.write(buf, 0, len); } - final String actualSha1 = Hex.encodeHexString( md.digest() ); + final String actualSha1 = Hex.encodeHexString(md.digest()); final String expectedSha1 = fileNameEntry.getSha1(); - if ( expectedSha1 != null && !expectedSha1.equals( actualSha1 ) ) - { - throw new MojoFailureException( "URL '" + licenseUrlString - + "' returned content with unexpected sha1 '" + actualSha1 + "'; expected '" - + expectedSha1 + "'. You may want to (a) re-run the current mojo" - + " with -Dlicense.forceDownload=true or (b) change the expected sha1 in" - + " the licenseUrlFileNames entry '" + fileNameEntry.getFile().getName() - + "' or (c) split the entry so that" - + " its URLs return content with different sha1 sums." ); + if (expectedSha1 != null && !expectedSha1.equals(actualSha1)) { + throw new MojoFailureException("URL '" + licenseUrlString + + "' returned content with unexpected sha1 '" + actualSha1 + "'; expected '" + + expectedSha1 + "'. You may want to (a) re-run the current mojo" + + " with -Dlicense.forceDownload=true or (b) change the expected sha1 in" + + " the licenseUrlFileNames entry '" + + fileNameEntry.getFile().getName() + + "' or (c) split the entry so that" + + " its URLs return content with different sha1 sums."); } - return LicenseDownloadResult.success( updatedFile, actualSha1, - fileNameEntry.isPreferred() ); + return LicenseDownloadResult.success(updatedFile, actualSha1, fileNameEntry.isPreferred()); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); } - catch ( NoSuchAlgorithmException e ) - { - throw new RuntimeException( e ); - } - } - else - { + } else { final Charset cs = contentType != null - ? ( contentType.getCharset() == null ? this.charset : contentType.getCharset() ) - : this.charset; - try ( BufferedReader r = - new BufferedReader( new InputStreamReader( entity.getContent(), cs ) ) ) - { - return sanitize( r, updatedFile, cs, sanitizers, fileNameEntry.isPreferred() ); + ? (contentType.getCharset() == null ? this.charset : contentType.getCharset()) + : this.charset; + try (BufferedReader r = new BufferedReader(new InputStreamReader(entity.getContent(), cs))) { + return sanitize(r, updatedFile, cs, sanitizers, fileNameEntry.isPreferred()); } } - } - else - { - return LicenseDownloadResult.failure( "'" + licenseUrlString + "' returned no body." ); + } else { + return LicenseDownloadResult.failure("'" + licenseUrlString + "' returned no body."); } } } } - static LicenseDownloadResult sanitize( BufferedReader r, File out, Charset charset, - List sanitizers, boolean preferredFileName ) - throws IOException - { + static LicenseDownloadResult sanitize( + BufferedReader r, File out, Charset charset, List sanitizers, boolean preferredFileName) + throws IOException { final StringBuilder contentBuilder = new StringBuilder(); // CHECKSTYLE_OFF: MagicNumber char[] buffer = new char[8192]; // CHECKSTYLE_ON: MagicNumber int len = 0; - while ( ( len = r.read( buffer ) ) >= 0 ) - { - contentBuilder.append( buffer, 0, len ); + while ((len = r.read(buffer)) >= 0) { + contentBuilder.append(buffer, 0, len); } String content = contentBuilder.toString(); - for ( ContentSanitizer sanitizer : sanitizers ) - { - content = sanitizer.sanitize( content ); + for (ContentSanitizer sanitizer : sanitizers) { + content = sanitizer.sanitize(content); } - byte[] bytes = content.getBytes( charset ); - Files.write( out.toPath(), bytes ); - final String sha1 = DigestUtils.sha1Hex( bytes ); - return LicenseDownloadResult.success( out, sha1, preferredFileName ); + byte[] bytes = content.getBytes(charset); + Files.write(out.toPath(), bytes); + final String sha1 = DigestUtils.sha1Hex(bytes); + return LicenseDownloadResult.success(out, sha1, preferredFileName); } - List filterSanitizers( String licenseUrlString ) - { + List filterSanitizers(String licenseUrlString) { ArrayList result = new ArrayList<>(); - for ( ContentSanitizer s : contentSanitizers.values() ) - { - if ( s.applies( licenseUrlString ) ) - { - result.add( s ); + for (ContentSanitizer s : contentSanitizers.values()) { + if (s.applies(licenseUrlString)) { + result.add(s); } } return result; } - static File updateFileExtension( File outputFile, String mimeType ) - { - String realExtension = FileUtil.toExtension( mimeType, false ); - if ( realExtension == null ) - { + static File updateFileExtension(File outputFile, String mimeType) { + String realExtension = FileUtil.toExtension(mimeType, false); + if (realExtension == null) { /* default extension is .txt */ realExtension = ".txt"; } final String oldFileName = outputFile.getName(); - if ( !oldFileName.endsWith( realExtension ) ) - { - final String newFileName = EXTENSION_PATTERN.matcher( oldFileName ).replaceAll( "" ) + realExtension; - return new File( outputFile.getParentFile(), newFileName ); + if (!oldFileName.endsWith(realExtension)) { + final String newFileName = EXTENSION_PATTERN.matcher(oldFileName).replaceAll("") + realExtension; + return new File(outputFile.getParentFile(), newFileName); } return outputFile; } @Override - public void close() throws IOException - { + public void close() throws IOException { client.close(); } @@ -343,20 +302,16 @@ public void close() throws IOException * * @since 1.18 */ - public static class LicenseDownloadResult - { - public static LicenseDownloadResult success( File file, String sha1, boolean preferredFileName ) - { - return new LicenseDownloadResult( file, sha1, preferredFileName, null ); + public static class LicenseDownloadResult { + public static LicenseDownloadResult success(File file, String sha1, boolean preferredFileName) { + return new LicenseDownloadResult(file, sha1, preferredFileName, null); } - public static LicenseDownloadResult failure( String errorMessage ) - { - return new LicenseDownloadResult( null, null, false, errorMessage ); + public static LicenseDownloadResult failure(String errorMessage) { + return new LicenseDownloadResult(null, null, false, errorMessage); } - private LicenseDownloadResult( File file, String sha1, boolean preferredFileName, String errorMessage ) - { + private LicenseDownloadResult(File file, String sha1, boolean preferredFileName, String errorMessage) { super(); this.file = file; this.errorMessage = errorMessage; @@ -372,35 +327,28 @@ private LicenseDownloadResult( File file, String sha1, boolean preferredFileName private final boolean preferredFileName; - public File getFile() - { + public File getFile() { return file; } - public String getErrorMessage() - { + public String getErrorMessage() { return errorMessage; } - public boolean isSuccess() - { + public boolean isSuccess() { return errorMessage == null; } - public boolean isPreferredFileName() - { + public boolean isPreferredFileName() { return preferredFileName; } - public String getSha1() - { + public String getSha1() { return sha1; } - public LicenseDownloadResult withFile( File otherFile ) - { - return new LicenseDownloadResult( otherFile, sha1, preferredFileName, errorMessage ); + public LicenseDownloadResult withFile(File otherFile) { + return new LicenseDownloadResult(otherFile, sha1, preferredFileName, errorMessage); } } - } diff --git a/src/main/java/org/codehaus/mojo/license/download/LicenseMatchers.java b/src/main/java/org/codehaus/mojo/license/download/LicenseMatchers.java index 1436343f4..fca373043 100644 --- a/src/main/java/org/codehaus/mojo/license/download/LicenseMatchers.java +++ b/src/main/java/org/codehaus/mojo/license/download/LicenseMatchers.java @@ -37,17 +37,15 @@ * @author Peter Palaga * @since 1.18 */ -public class LicenseMatchers -{ +public class LicenseMatchers { - private static final Pattern MATCH_EMPTY_PATTERN = Pattern.compile( "" ); - private static final Pattern MATCH_ALL_PATTERN = Pattern.compile( ".*" ); + private static final Pattern MATCH_EMPTY_PATTERN = Pattern.compile(""); + private static final Pattern MATCH_ALL_PATTERN = Pattern.compile(".*"); /** * @return a new {@link Builder} */ - public static Builder builder() - { + public static Builder builder() { return new Builder(); } @@ -56,46 +54,40 @@ public static Builder builder() * @return new {@link LicenseMatchers} configured from the given {@code licenseMatchersFile} * @throws MojoExecutionException */ - public static LicenseMatchers load( File licenseMatchersFile ) - throws MojoExecutionException - { + public static LicenseMatchers load(File licenseMatchersFile) throws MojoExecutionException { final List matchers = new ArrayList<>(); - try - { - if ( licenseMatchersFile != null && licenseMatchersFile.exists() ) - { + try { + if (licenseMatchersFile != null && licenseMatchersFile.exists()) { final List replacements = - LicenseSummaryReader.parseLicenseSummary( licenseMatchersFile ); + LicenseSummaryReader.parseLicenseSummary(licenseMatchersFile); - for ( ProjectLicenseInfo dependency : replacements ) - { - matchers.add( DependencyMatcher.of( dependency ) ); + for (ProjectLicenseInfo dependency : replacements) { + matchers.add(DependencyMatcher.of(dependency)); } } + } catch (Exception e) { + throw new MojoExecutionException("Could not parse licensesReplacementsFile " + licenseMatchersFile, e); } - catch ( Exception e ) - { - throw new MojoExecutionException( "Could not parse licensesReplacementsFile " + licenseMatchersFile, e ); - } - return new LicenseMatchers( matchers ); + return new LicenseMatchers(matchers); } - private static boolean match( Pattern pattern, String string ) - { - return string == null ? pattern.matcher( "" ).matches() : pattern.matcher( string ).matches(); + private static boolean match(Pattern pattern, String string) { + return string == null + ? pattern.matcher("").matches() + : pattern.matcher(string).matches(); } - private static Pattern pattern( String string, boolean isPre118Match ) - { - return string == null || string.isEmpty() ? MATCH_EMPTY_PATTERN - : isPre118Match ? Pattern.compile( Pattern.quote( string ) ) - : Pattern.compile( string, Pattern.CASE_INSENSITIVE ); + private static Pattern pattern(String string, boolean isPre118Match) { + return string == null || string.isEmpty() + ? MATCH_EMPTY_PATTERN + : isPre118Match + ? Pattern.compile(Pattern.quote(string)) + : Pattern.compile(string, Pattern.CASE_INSENSITIVE); } private final List matchers; - private LicenseMatchers( List matchers ) - { + private LicenseMatchers(List matchers) { super(); this.matchers = matchers; } @@ -105,21 +97,15 @@ private LicenseMatchers( List matchers ) * * @param dependency */ - public void replaceMatches( ProjectLicenseInfo dependency ) - { - for ( DependencyMatcher matcher : matchers ) - { - if ( matcher.matches( dependency ) ) - { - if ( matcher.isApproved() ) - { + public void replaceMatches(ProjectLicenseInfo dependency) { + for (DependencyMatcher matcher : matchers) { + if (matcher.matches(dependency)) { + if (matcher.isApproved()) { /* do nothing */ + } else { + dependency.setLicenses(matcher.cloneLicenses()); } - else - { - dependency.setLicenses( matcher.cloneLicenses() ); - } - dependency.setApproved( true ); + dependency.setApproved(true); dependency.getDownloaderMessages().clear(); } } @@ -128,21 +114,18 @@ public void replaceMatches( ProjectLicenseInfo dependency ) /** * A {@link LicenseMatchers} builder */ - public static class Builder - { + public static class Builder { private List matchers = new ArrayList<>(); - public Builder matcher( DependencyMatcher matcher ) - { - matchers.add( matcher ); + public Builder matcher(DependencyMatcher matcher) { + matchers.add(matcher); return this; } - public LicenseMatchers build() - { + public LicenseMatchers build() { final List ms = matchers; matchers = null; - return new LicenseMatchers( ms ); + return new LicenseMatchers(ms); } } @@ -151,19 +134,20 @@ public LicenseMatchers build() * * @since 1.18 */ - static class DependencyMatcher - { + static class DependencyMatcher { - public static DependencyMatcher of( ProjectLicenseInfo dependency ) - { + public static DependencyMatcher of(ProjectLicenseInfo dependency) { final String version = dependency.getVersion(); final boolean isPre118Match = !dependency.hasMatchLicenses(); - return new DependencyMatcher( pattern( dependency.getGroupId(), isPre118Match ), - pattern( dependency.getArtifactId(), isPre118Match ), - isPre118Match || version == null || version.isEmpty() ? MATCH_ALL_PATTERN - : Pattern.compile( version, Pattern.CASE_INSENSITIVE ), - LicenseListMatcher.of( dependency ), dependency.cloneLicenses(), - dependency.isApproved() ); + return new DependencyMatcher( + pattern(dependency.getGroupId(), isPre118Match), + pattern(dependency.getArtifactId(), isPre118Match), + isPre118Match || version == null || version.isEmpty() + ? MATCH_ALL_PATTERN + : Pattern.compile(version, Pattern.CASE_INSENSITIVE), + LicenseListMatcher.of(dependency), + dependency.cloneLicenses(), + dependency.isApproved()); } private final Pattern artifactId; @@ -177,9 +161,13 @@ public static DependencyMatcher of( ProjectLicenseInfo dependency ) private final Pattern version; - DependencyMatcher( Pattern groupId, Pattern artifactId, Pattern version, LicenseListMatcher licenseListMatcher, - List licenses, boolean approved ) - { + DependencyMatcher( + Pattern groupId, + Pattern artifactId, + Pattern version, + LicenseListMatcher licenseListMatcher, + List licenses, + boolean approved) { super(); this.groupId = groupId; this.artifactId = artifactId; @@ -189,45 +177,37 @@ public static DependencyMatcher of( ProjectLicenseInfo dependency ) this.approved = approved; } - public List getLicenseMatchers() - { + public List getLicenseMatchers() { return null; } /** * @return a deep clone of {@link #licenses} */ - public List cloneLicenses() - { - try - { - final ArrayList result = new ArrayList<>( licenses != null ? licenses.size() : 0 ); - if ( licenses != null ) - { - for ( ProjectLicense license : licenses ) - { - result.add( license.clone() ); + public List cloneLicenses() { + try { + final ArrayList result = new ArrayList<>(licenses != null ? licenses.size() : 0); + if (licenses != null) { + for (ProjectLicense license : licenses) { + result.add(license.clone()); } } return result; - } - catch ( CloneNotSupportedException e ) - { - throw new RuntimeException( e ); + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); } } - public boolean matches( ProjectLicenseInfo dependency ) - { - return match( groupId, dependency.getGroupId() ) && match( artifactId, dependency.getArtifactId() ) - && match( version, dependency.getVersion() ) && licenseListMatcher.matches( dependency.getLicenses() ); + public boolean matches(ProjectLicenseInfo dependency) { + return match(groupId, dependency.getGroupId()) + && match(artifactId, dependency.getArtifactId()) + && match(version, dependency.getVersion()) + && licenseListMatcher.matches(dependency.getLicenses()); } - public boolean isApproved() - { + public boolean isApproved() { return approved; } - } /** @@ -235,66 +215,52 @@ public boolean isApproved() * * @since 1.18 */ - static class LicenseListMatcher - { + static class LicenseListMatcher { private final List licenseMatchers; - private static final LicenseListMatcher MATCHES_ALL_LICENSE_LIST_MATCHER = new LicenseListMatcher( null ) - { + private static final LicenseListMatcher MATCHES_ALL_LICENSE_LIST_MATCHER = new LicenseListMatcher(null) { @Override - public boolean matches( List licenses ) - { + public boolean matches(List licenses) { return true; } }; - LicenseListMatcher( List licenseMatchers ) - { + LicenseListMatcher(List licenseMatchers) { this.licenseMatchers = licenseMatchers; } - public boolean matches( List licenses ) - { + public boolean matches(List licenses) { final int licsSize = licenses == null ? 0 : licenses.size(); - if ( licenseMatchers.size() != licsSize ) - { + if (licenseMatchers.size() != licsSize) { return false; } final Iterator matchersIt = licenseMatchers.iterator(); final Iterator licsIt = licenses.iterator(); - while ( matchersIt.hasNext() ) - { - if ( !matchersIt.next().matches( licsIt.next() ) ) - { + while (matchersIt.hasNext()) { + if (!matchersIt.next().matches(licsIt.next())) { return false; } } return true; } - public static LicenseListMatcher of( ProjectLicenseInfo dependency ) - { - if ( !dependency.hasMatchLicenses() ) - { + public static LicenseListMatcher of(ProjectLicenseInfo dependency) { + if (!dependency.hasMatchLicenses()) { return MATCHES_ALL_LICENSE_LIST_MATCHER; } final List licenseMatchers; final List rawMatchers = dependency.getMatchLicenses(); - if ( rawMatchers == null || rawMatchers.isEmpty() ) - { + if (rawMatchers == null || rawMatchers.isEmpty()) { licenseMatchers = Collections.emptyList(); - } - else - { + } else { licenseMatchers = new ArrayList<>(); - for ( ProjectLicense lic : rawMatchers ) - { - licenseMatchers.add( new LicenseMatcher( lic.getName(), lic.getUrl(), lic.getDistribution(), - lic.getComments() ) ); + for (ProjectLicense lic : rawMatchers) { + licenseMatchers.add( + new LicenseMatcher(lic.getName(), lic.getUrl(), lic.getDistribution(), lic.getComments())); } } - return new LicenseListMatcher( licenseMatchers ); + return new LicenseListMatcher(licenseMatchers); } } @@ -303,16 +269,14 @@ public static LicenseListMatcher of( ProjectLicenseInfo dependency ) * * @since 1.18 */ - static class LicenseMatcher - { + static class LicenseMatcher { private final Pattern comments; private final Pattern distribution; private final Pattern name; private final Pattern url; - LicenseMatcher( Pattern name, Pattern url, Pattern distribution, Pattern comments ) - { + LicenseMatcher(Pattern name, Pattern url, Pattern distribution, Pattern comments) { super(); this.name = name; this.url = url; @@ -320,21 +284,19 @@ static class LicenseMatcher this.comments = comments; } - LicenseMatcher( String name, String url, String distribution, String comments ) - { + LicenseMatcher(String name, String url, String distribution, String comments) { super(); - this.name = pattern( name, false ); - this.url = pattern( url, false ); - this.distribution = pattern( distribution, false ); - this.comments = pattern( comments, false ); + this.name = pattern(name, false); + this.url = pattern(url, false); + this.distribution = pattern(distribution, false); + this.comments = pattern(comments, false); } - public boolean matches( ProjectLicense license ) - { - return match( name, license.getName() ) && match( url, license.getUrl() ) - && match( distribution, license.getDistribution() ) && match( comments, license.getComments() ); + public boolean matches(ProjectLicense license) { + return match(name, license.getName()) + && match(url, license.getUrl()) + && match(distribution, license.getDistribution()) + && match(comments, license.getComments()); } - } - } diff --git a/src/main/java/org/codehaus/mojo/license/download/LicenseSummaryReader.java b/src/main/java/org/codehaus/mojo/license/download/LicenseSummaryReader.java index e057f3891..d0c88d15a 100644 --- a/src/main/java/org/codehaus/mojo/license/download/LicenseSummaryReader.java +++ b/src/main/java/org/codehaus/mojo/license/download/LicenseSummaryReader.java @@ -22,12 +22,6 @@ * #L% */ -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -42,6 +36,12 @@ import java.util.List; import java.util.Map; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + /** * A LicenseSummaryReader. * @@ -49,17 +49,13 @@ * @version $Revision$ * @since 1.0 */ -public class LicenseSummaryReader -{ - - public static List parseLicenseSummary( File licSummaryFile ) - throws IOException, ParserConfigurationException, SAXException - { - if ( licSummaryFile.exists() ) - { - try ( InputStream in = Files.newInputStream( licSummaryFile.toPath() ) ) - { - return parseLicenseSummary( in ); +public class LicenseSummaryReader { + + public static List parseLicenseSummary(File licSummaryFile) + throws IOException, ParserConfigurationException, SAXException { + if (licSummaryFile.exists()) { + try (InputStream in = Files.newInputStream(licSummaryFile.toPath())) { + return parseLicenseSummary(in); } } return Collections.emptyList(); @@ -74,121 +70,91 @@ public static List parseLicenseSummary( File licSummaryFile * @throws ParserConfigurationException if there is a problem parsing the XML stream * @throws SAXException if there is a problem parsing the XML stream */ - public static List parseLicenseSummary( InputStream licSummaryIS ) - throws IOException, ParserConfigurationException, SAXException - { + public static List parseLicenseSummary(InputStream licSummaryIS) + throws IOException, ParserConfigurationException, SAXException { List dependencies = new ArrayList<>(); DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); - Document doc = docBuilder.parse( licSummaryIS ); + Document doc = docBuilder.parse(licSummaryIS); // normalize text representation doc.getDocumentElement().normalize(); Element documentElement = doc.getDocumentElement(); - Node dependenciesNode = documentElement.getElementsByTagName( "dependencies" ).item( 0 ); + Node dependenciesNode = + documentElement.getElementsByTagName("dependencies").item(0); NodeList dependencyNodes = dependenciesNode.getChildNodes(); - for ( int i = 0; i < dependencyNodes.getLength(); ++i ) - { - Node dependencyNode = dependencyNodes.item( i ); - if ( dependencyNode.getNodeType() == Node.ELEMENT_NODE ) - { - dependencies.add( parseDependencyNode( dependencyNode ) ); + for (int i = 0; i < dependencyNodes.getLength(); ++i) { + Node dependencyNode = dependencyNodes.item(i); + if (dependencyNode.getNodeType() == Node.ELEMENT_NODE) { + dependencies.add(parseDependencyNode(dependencyNode)); } } return dependencies; - } - private static ProjectLicenseInfo parseDependencyNode( Node dependencyNode ) - { + private static ProjectLicenseInfo parseDependencyNode(Node dependencyNode) { ProjectLicenseInfo dependency = new ProjectLicenseInfo(); NodeList depElements = dependencyNode.getChildNodes(); - for ( int i = 0; i < depElements.getLength(); ++i ) - { - Node node = depElements.item( i ); - - if ( node.getNodeName().equals( "groupId" ) ) - { - dependency.setGroupId( node.getTextContent() ); - } - else if ( node.getNodeName().equals( "artifactId" ) ) - { - dependency.setArtifactId( node.getTextContent() ); - } - else if ( node.getNodeName().equals( "version" ) ) - { - dependency.setVersion( node.getTextContent() ); - } - else if ( node.getNodeName().equals( "licenses" ) ) - { - Map.Entry> entry = parseLicenses( node ); - dependency.setLicenses( entry.getValue() ); - dependency.setApproved( entry.getKey() ); - } - else if ( node.getNodeName().equals( "matchLicenses" ) ) - { - dependency.setHasMatchLicenses( true ); - dependency.setMatchLicenses( parseLicenses( node ).getValue() ); + for (int i = 0; i < depElements.getLength(); ++i) { + Node node = depElements.item(i); + + if (node.getNodeName().equals("groupId")) { + dependency.setGroupId(node.getTextContent()); + } else if (node.getNodeName().equals("artifactId")) { + dependency.setArtifactId(node.getTextContent()); + } else if (node.getNodeName().equals("version")) { + dependency.setVersion(node.getTextContent()); + } else if (node.getNodeName().equals("licenses")) { + Map.Entry> entry = parseLicenses(node); + dependency.setLicenses(entry.getValue()); + dependency.setApproved(entry.getKey()); + } else if (node.getNodeName().equals("matchLicenses")) { + dependency.setHasMatchLicenses(true); + dependency.setMatchLicenses(parseLicenses(node).getValue()); } } return dependency; } - private static Map.Entry> parseLicenses( Node node ) - { + private static Map.Entry> parseLicenses(Node node) { final List result = new ArrayList(); final NodeList licensesChildNodes = node.getChildNodes(); - final Node approvedNode = node.getAttributes().getNamedItem( "approved" ); - boolean approved = Boolean.parseBoolean( approvedNode != null ? approvedNode.getNodeValue() : "false" ); - for ( int j = 0; j < licensesChildNodes.getLength(); ++j ) - { - final Node licensesChildNode = licensesChildNodes.item( j ); + final Node approvedNode = node.getAttributes().getNamedItem("approved"); + boolean approved = Boolean.parseBoolean(approvedNode != null ? approvedNode.getNodeValue() : "false"); + for (int j = 0; j < licensesChildNodes.getLength(); ++j) { + final Node licensesChildNode = licensesChildNodes.item(j); final String nodeName = licensesChildNode.getNodeName(); - if ( nodeName.equals( "license" ) ) - { - if ( approved ) - { - throw new IllegalStateException( "Cannot combine approved=\"true\" with elements" ); + if (nodeName.equals("license")) { + if (approved) { + throw new IllegalStateException("Cannot combine approved=\"true\" with elements"); } - result.add( parseLicense( licensesChildNode ) ); + result.add(parseLicense(licensesChildNode)); } } - return new AbstractMap.SimpleImmutableEntry>( approved, result ); + return new AbstractMap.SimpleImmutableEntry>(approved, result); } - private static ProjectLicense parseLicense( Node licenseNode ) - { + private static ProjectLicense parseLicense(Node licenseNode) { ProjectLicense license = new ProjectLicense(); NodeList licenseElements = licenseNode.getChildNodes(); - for ( int i = 0; i < licenseElements.getLength(); ++i ) - { - Node node = licenseElements.item( i ); - if ( node.getNodeName().equals( "name" ) ) - { - license.setName( node.getTextContent() ); - } - else if ( node.getNodeName().equals( "url" ) ) - { - license.setUrl( node.getTextContent() ); - } - else if ( node.getNodeName().equals( "distribution" ) ) - { - license.setDistribution( node.getTextContent() ); - } - else if ( node.getNodeName().equals( "comments" ) ) - { - license.setComments( node.getTextContent() ); - } - else if ( node.getNodeName().equals( "file" ) ) - { - license.setFile( node.getTextContent() ); + for (int i = 0; i < licenseElements.getLength(); ++i) { + Node node = licenseElements.item(i); + if (node.getNodeName().equals("name")) { + license.setName(node.getTextContent()); + } else if (node.getNodeName().equals("url")) { + license.setUrl(node.getTextContent()); + } else if (node.getNodeName().equals("distribution")) { + license.setDistribution(node.getTextContent()); + } else if (node.getNodeName().equals("comments")) { + license.setComments(node.getTextContent()); + } else if (node.getNodeName().equals("file")) { + license.setFile(node.getTextContent()); } } return license; } - } diff --git a/src/main/java/org/codehaus/mojo/license/download/LicenseSummaryWriter.java b/src/main/java/org/codehaus/mojo/license/download/LicenseSummaryWriter.java index 6238ab3f9..b7a102503 100644 --- a/src/main/java/org/codehaus/mojo/license/download/LicenseSummaryWriter.java +++ b/src/main/java/org/codehaus/mojo/license/download/LicenseSummaryWriter.java @@ -22,10 +22,6 @@ * #L% */ -import org.codehaus.mojo.license.Eol; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -35,6 +31,7 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; + import java.io.File; import java.io.IOException; import java.io.StringWriter; @@ -44,6 +41,10 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.codehaus.mojo.license.Eol; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + /** * A LicenseSummaryWriter. * @@ -51,192 +52,157 @@ * @version $Revision$ * @since 1.0 */ -public class LicenseSummaryWriter -{ - public static void writeLicenseSummary( List dependencies, File outputFile, Charset charset, - Eol eol, boolean writeVersions ) - throws ParserConfigurationException, TransformerException, IOException - { +public class LicenseSummaryWriter { + public static void writeLicenseSummary( + List dependencies, File outputFile, Charset charset, Eol eol, boolean writeVersions) + throws ParserConfigurationException, TransformerException, IOException { DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance(); DocumentBuilder parser = fact.newDocumentBuilder(); Document doc = parser.newDocument(); - Node root = doc.createElement( "licenseSummary" ); - doc.appendChild( root ); - Node dependenciesNode = doc.createElement( "dependencies" ); - root.appendChild( dependenciesNode ); + Node root = doc.createElement("licenseSummary"); + doc.appendChild(root); + Node dependenciesNode = doc.createElement("dependencies"); + root.appendChild(dependenciesNode); - for ( ProjectLicenseInfo dep : dependencies ) - { - dependenciesNode.appendChild( createDependencyNode( doc, dep, writeVersions ) ); + for (ProjectLicenseInfo dep : dependencies) { + dependenciesNode.appendChild(createDependencyNode(doc, dep, writeVersions)); } // Prepare the output file File - try ( StringWriter sw = new StringWriter() ) - { + try (StringWriter sw = new StringWriter()) { Transformer xformer = TransformerFactory.newInstance().newTransformer(); - xformer.setOutputProperty( OutputKeys.INDENT, "yes" ); - xformer.setOutputProperty( "{http://xml.apache.org/xslt}indent-amount", "2" ); - xformer.transform( new DOMSource( doc ), new StreamResult( sw ) ); + xformer.setOutputProperty(OutputKeys.INDENT, "yes"); + xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); + xformer.transform(new DOMSource(doc), new StreamResult(sw)); final String platformEol = Eol.PLATFORM.getEolString(); - final String outputString = !platformEol.equals( eol.getEolString() ) - ? sw.toString().replace( platformEol, eol.getEolString() ) - : sw.toString(); - Files.write( outputFile.toPath(), outputString.getBytes( charset ) ); + final String outputString = !platformEol.equals(eol.getEolString()) + ? sw.toString().replace(platformEol, eol.getEolString()) + : sw.toString(); + Files.write(outputFile.toPath(), outputString.getBytes(charset)); } } - public static Node createDependencyNode( Document doc, ProjectLicenseInfo dep, boolean writeVersions ) - { + public static Node createDependencyNode(Document doc, ProjectLicenseInfo dep, boolean writeVersions) { final List messages = dep.getDownloaderMessages(); final boolean hasDownloaderMessages = messages != null && !messages.isEmpty(); - final Node depNode = doc.createElement( "dependency" ); + final Node depNode = doc.createElement("dependency"); - final Node groupIdNode = doc.createElement( "groupId" ); - groupIdNode.appendChild( doc.createTextNode( patternOrText( dep.getGroupId(), hasDownloaderMessages ) ) ); - depNode.appendChild( groupIdNode ); + final Node groupIdNode = doc.createElement("groupId"); + groupIdNode.appendChild(doc.createTextNode(patternOrText(dep.getGroupId(), hasDownloaderMessages))); + depNode.appendChild(groupIdNode); - final Node artifactIdNode = doc.createElement( "artifactId" ); - artifactIdNode.appendChild( doc.createTextNode( patternOrText( dep.getArtifactId(), hasDownloaderMessages ) ) ); - depNode.appendChild( artifactIdNode ); + final Node artifactIdNode = doc.createElement("artifactId"); + artifactIdNode.appendChild(doc.createTextNode(patternOrText(dep.getArtifactId(), hasDownloaderMessages))); + depNode.appendChild(artifactIdNode); - if ( writeVersions ) - { - final Node versionNode = doc.createElement( "version" ); - versionNode.appendChild( doc.createTextNode( patternOrText( dep.getVersion(), hasDownloaderMessages ) ) ); - depNode.appendChild( versionNode ); - } - else if ( hasDownloaderMessages ) - { - depNode.appendChild( doc.createComment( " " + dep.getVersion() + " " ) ); + if (writeVersions) { + final Node versionNode = doc.createElement("version"); + versionNode.appendChild(doc.createTextNode(patternOrText(dep.getVersion(), hasDownloaderMessages))); + depNode.appendChild(versionNode); + } else if (hasDownloaderMessages) { + depNode.appendChild(doc.createComment(" " + dep.getVersion() + " ")); } - if ( hasDownloaderMessages ) - { - Node matchLicensesNode = doc.createElement( "matchLicenses" ); - if ( dep.getLicenses() == null || dep.getLicenses().size() == 0 ) - { - matchLicensesNode.appendChild( doc.createComment( " Match dependency with no licenses " ) ); - } - else - { - for ( ProjectLicense lic : dep.getLicenses() ) - { - matchLicensesNode.appendChild( createLicenseNode( doc, lic, true ) ); + if (hasDownloaderMessages) { + Node matchLicensesNode = doc.createElement("matchLicenses"); + if (dep.getLicenses() == null || dep.getLicenses().size() == 0) { + matchLicensesNode.appendChild(doc.createComment(" Match dependency with no licenses ")); + } else { + for (ProjectLicense lic : dep.getLicenses()) { + matchLicensesNode.appendChild(createLicenseNode(doc, lic, true)); } } - depNode.appendChild( matchLicensesNode ); + depNode.appendChild(matchLicensesNode); } - - Node licensesNode = doc.createElement( "licenses" ); - if ( dep.getLicenses() == null || dep.getLicenses().size() == 0 ) - { - final String comment = - hasDownloaderMessages ? " Manually add license elements here: " : " No license information available. "; - licensesNode.appendChild( doc.createComment( comment ) ); - } - else - { - if ( hasDownloaderMessages ) - { - licensesNode.appendChild( doc.createComment( " Manually fix the existing license nodes: " ) ); + Node licensesNode = doc.createElement("licenses"); + if (dep.getLicenses() == null || dep.getLicenses().size() == 0) { + final String comment = hasDownloaderMessages + ? " Manually add license elements here: " + : " No license information available. "; + licensesNode.appendChild(doc.createComment(comment)); + } else { + if (hasDownloaderMessages) { + licensesNode.appendChild(doc.createComment(" Manually fix the existing license nodes: ")); } - for ( ProjectLicense lic : dep.getLicenses() ) - { - licensesNode.appendChild( createLicenseNode( doc, lic, false ) ); + for (ProjectLicense lic : dep.getLicenses()) { + licensesNode.appendChild(createLicenseNode(doc, lic, false)); } } - depNode.appendChild( licensesNode ); - - if ( hasDownloaderMessages ) - { - final Node downloaderMessagesNode = doc.createElement( "downloaderMessages" ); - for ( String msg : messages ) - { - final Node downloaderMessageNode = doc.createElement( "downloaderMessage" ); - downloaderMessageNode.appendChild( doc.createTextNode( msg ) ); - downloaderMessagesNode.appendChild( downloaderMessageNode ); + depNode.appendChild(licensesNode); + + if (hasDownloaderMessages) { + final Node downloaderMessagesNode = doc.createElement("downloaderMessages"); + for (String msg : messages) { + final Node downloaderMessageNode = doc.createElement("downloaderMessage"); + downloaderMessageNode.appendChild(doc.createTextNode(msg)); + downloaderMessagesNode.appendChild(downloaderMessageNode); } - depNode.appendChild( downloaderMessagesNode ); + depNode.appendChild(downloaderMessagesNode); } return depNode; - } - public static Node createLicenseNode( Document doc, ProjectLicense lic, boolean isMatcher ) - { - Node licenseNode = doc.createElement( "license" ); + public static Node createLicenseNode(Document doc, ProjectLicense lic, boolean isMatcher) { + Node licenseNode = doc.createElement("license"); - if ( lic.getName() != null ) - { - Node licNameNode = doc.createElement( "name" ); - licNameNode.appendChild( doc.createTextNode( patternOrText( lic.getName(), isMatcher ) ) ); - licenseNode.appendChild( licNameNode ); + if (lic.getName() != null) { + Node licNameNode = doc.createElement("name"); + licNameNode.appendChild(doc.createTextNode(patternOrText(lic.getName(), isMatcher))); + licenseNode.appendChild(licNameNode); } - if ( lic.getUrl() != null ) - { - Node licUrlNode = doc.createElement( "url" ); - licUrlNode.appendChild( doc.createTextNode( patternOrText( lic.getUrl(), isMatcher ) ) ); - licenseNode.appendChild( licUrlNode ); + if (lic.getUrl() != null) { + Node licUrlNode = doc.createElement("url"); + licUrlNode.appendChild(doc.createTextNode(patternOrText(lic.getUrl(), isMatcher))); + licenseNode.appendChild(licUrlNode); } - if ( lic.getDistribution() != null ) - { - Node licDistNode = doc.createElement( "distribution" ); - licDistNode.appendChild( doc.createTextNode( patternOrText( lic.getDistribution(), isMatcher ) ) ); - licenseNode.appendChild( licDistNode ); + if (lic.getDistribution() != null) { + Node licDistNode = doc.createElement("distribution"); + licDistNode.appendChild(doc.createTextNode(patternOrText(lic.getDistribution(), isMatcher))); + licenseNode.appendChild(licDistNode); } - if ( lic.getFile() != null ) - { - Node licFileNode = doc.createElement( "file" ); - licFileNode.appendChild( doc.createTextNode( patternOrText( lic.getFile(), isMatcher ) ) ); - licenseNode.appendChild( licFileNode ); + if (lic.getFile() != null) { + Node licFileNode = doc.createElement("file"); + licFileNode.appendChild(doc.createTextNode(patternOrText(lic.getFile(), isMatcher))); + licenseNode.appendChild(licFileNode); } - if ( lic.getComments() != null ) - { - Node licCommentsNode = doc.createElement( "comments" ); - licCommentsNode.appendChild( doc.createTextNode( patternOrText( lic.getComments(), isMatcher ) ) ); - licenseNode.appendChild( licCommentsNode ); + if (lic.getComments() != null) { + Node licCommentsNode = doc.createElement("comments"); + licCommentsNode.appendChild(doc.createTextNode(patternOrText(lic.getComments(), isMatcher))); + licenseNode.appendChild(licCommentsNode); } return licenseNode; } - private static final Pattern WHITESPACE_PATTERN = Pattern.compile( "\\s{2,}" ); + private static final Pattern WHITESPACE_PATTERN = Pattern.compile("\\s{2,}"); - static String patternOrText( String value, boolean isMatcher ) - { - if ( value != null && !value.isEmpty() && isMatcher ) - { + static String patternOrText(String value, boolean isMatcher) { + if (value != null && !value.isEmpty() && isMatcher) { final StringBuilder result = new StringBuilder(); - final Matcher m = WHITESPACE_PATTERN.matcher( value ); + final Matcher m = WHITESPACE_PATTERN.matcher(value); int offset = 0; - while ( m.find() ) - { - if ( m.start() > offset ) - { - result.append( Pattern.quote( value.substring( offset, m.start() ) ) ); + while (m.find()) { + if (m.start() > offset) { + result.append(Pattern.quote(value.substring(offset, m.start()))); } - result.append( "\\s+" ); + result.append("\\s+"); offset = m.end(); } - if ( offset < value.length() ) - { - result.append( Pattern.quote( value.substring( offset ) ) ); + if (offset < value.length()) { + result.append(Pattern.quote(value.substring(offset))); } return result.toString(); - } - else - { + } else { return value; } } - } diff --git a/src/main/java/org/codehaus/mojo/license/download/LicensedArtifact.java b/src/main/java/org/codehaus/mojo/license/download/LicensedArtifact.java index 6f17dc53c..604ec3206 100644 --- a/src/main/java/org/codehaus/mojo/license/download/LicensedArtifact.java +++ b/src/main/java/org/codehaus/mojo/license/download/LicensedArtifact.java @@ -30,12 +30,10 @@ * @author Peter Palaga * @since 1.20 */ -public class LicensedArtifact -{ +public class LicensedArtifact { - public static Builder builder( String groupId, String artifactId, String version ) - { - return new Builder( groupId, artifactId, version ); + public static Builder builder(String groupId, String artifactId, String version) { + return new Builder(groupId, artifactId, version); } private final String groupId; @@ -48,9 +46,8 @@ public static Builder builder( String groupId, String artifactId, String version private final List errorMessages; - LicensedArtifact( String groupId, String artifactId, String version, List licenses, - List errorMessages ) - { + LicensedArtifact( + String groupId, String artifactId, String version, List licenses, List errorMessages) { super(); this.groupId = groupId; this.artifactId = artifactId; @@ -60,93 +57,65 @@ public static Builder builder( String groupId, String artifactId, String version } @Override - public int hashCode() - { + public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() ); - result = prime * result + ( ( groupId == null ) ? 0 : groupId.hashCode() ); - result = prime * result + ( ( licenses == null ) ? 0 : licenses.hashCode() ); - result = prime * result + ( ( version == null ) ? 0 : version.hashCode() ); + result = prime * result + ((artifactId == null) ? 0 : artifactId.hashCode()); + result = prime * result + ((groupId == null) ? 0 : groupId.hashCode()); + result = prime * result + ((licenses == null) ? 0 : licenses.hashCode()); + result = prime * result + ((version == null) ? 0 : version.hashCode()); return result; } @Override - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { // CHECKSTYLE_OFF: NeedBraces - if ( this == obj ) - return true; - if ( obj == null ) - return false; - if ( getClass() != obj.getClass() ) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; LicensedArtifact other = (LicensedArtifact) obj; - if ( artifactId == null ) - { - if ( other.artifactId != null ) - return false; - } - else if ( !artifactId.equals( other.artifactId ) ) - return false; - if ( groupId == null ) - { - if ( other.groupId != null ) - return false; - } - else if ( !groupId.equals( other.groupId ) ) - return false; - if ( licenses == null ) - { - if ( other.licenses != null ) - return false; - } - else if ( !licenses.equals( other.licenses ) ) - return false; - if ( version == null ) - { - if ( other.version != null ) - return false; - } - else if ( !version.equals( other.version ) ) - return false; + if (artifactId == null) { + if (other.artifactId != null) return false; + } else if (!artifactId.equals(other.artifactId)) return false; + if (groupId == null) { + if (other.groupId != null) return false; + } else if (!groupId.equals(other.groupId)) return false; + if (licenses == null) { + if (other.licenses != null) return false; + } else if (!licenses.equals(other.licenses)) return false; + if (version == null) { + if (other.version != null) return false; + } else if (!version.equals(other.version)) return false; return true; // CHECKSTYLE_ON: NeedBraces } - public String getGroupId() - { + public String getGroupId() { return groupId; } - public String getArtifactId() - { + public String getArtifactId() { return artifactId; } - public String getVersion() - { + public String getVersion() { return version; } - public List getLicenses() - { + public List getLicenses() { return licenses; } - public List getErrorMessages() - { + public List getErrorMessages() { return errorMessages; } /** * A {@link LicensedArtifact} builder. */ - public static class Builder - { + public static class Builder { - public Builder( String groupId, String artifactId, String version ) - { + public Builder(String groupId, String artifactId, String version) { super(); this.groupId = groupId; this.artifactId = artifactId; @@ -163,26 +132,22 @@ public Builder( String groupId, String artifactId, String version ) private List errorMessages = new ArrayList<>(); - public Builder errorMessage( String errorMessage ) - { - this.errorMessages.add( errorMessage ); + public Builder errorMessage(String errorMessage) { + this.errorMessages.add(errorMessage); return this; } - public Builder license( License license ) - { - this.licenses.add( license ); + public Builder license(License license) { + this.licenses.add(license); return this; } - public LicensedArtifact build() - { - final List lics = Collections.unmodifiableList( licenses ); + public LicensedArtifact build() { + final List lics = Collections.unmodifiableList(licenses); licenses = null; - final List msgs = Collections.unmodifiableList( errorMessages ); + final List msgs = Collections.unmodifiableList(errorMessages); errorMessages = null; - return new LicensedArtifact( groupId, artifactId, version, lics, msgs ); + return new LicensedArtifact(groupId, artifactId, version, lics, msgs); } } - } diff --git a/src/main/java/org/codehaus/mojo/license/download/LicensedArtifactResolver.java b/src/main/java/org/codehaus/mojo/license/download/LicensedArtifactResolver.java index dd86f9fbf..7a8f4a312 100644 --- a/src/main/java/org/codehaus/mojo/license/download/LicensedArtifactResolver.java +++ b/src/main/java/org/codehaus/mojo/license/download/LicensedArtifactResolver.java @@ -57,15 +57,14 @@ */ @Named @Singleton -public class LicensedArtifactResolver -{ - private static final Logger LOG = LoggerFactory.getLogger( LicensedArtifactResolver.class ); +public class LicensedArtifactResolver { + private static final Logger LOG = LoggerFactory.getLogger(LicensedArtifactResolver.class); /** * Message used when an invalid expression pattern is found. */ public static final String INVALID_PATTERN_MESSAGE = - "The pattern specified by expression <%s> seems to be invalid."; + "The pattern specified by expression <%s> seems to be invalid."; /** * Project builder. @@ -85,11 +84,11 @@ public class LicensedArtifactResolver * @param remoteRepositories remote repositories used to resolv dependencies * @see MavenProjectDependenciesConfigurator */ - public void loadProjectDependencies( ResolvedProjectDependencies artifacts, - MavenProjectDependenciesConfigurator configuration, - List remoteRepositories, - Map result ) - { + public void loadProjectDependencies( + ResolvedProjectDependencies artifacts, + MavenProjectDependenciesConfigurator configuration, + List remoteRepositories, + Map result) { final ArtifactFilters artifactFilters = configuration.getArtifactFilters(); @@ -97,13 +96,10 @@ public void loadProjectDependencies( ResolvedProjectDependencies artifacts, final Set depArtifacts; - if ( configuration.isIncludeTransitiveDependencies() ) - { + if (configuration.isIncludeTransitiveDependencies()) { // All project dependencies depArtifacts = artifacts.getAllDependencies(); - } - else - { + } else { // Only direct project dependencies depArtifacts = artifacts.getDirectDependencies(); } @@ -113,114 +109,94 @@ public void loadProjectDependencies( ResolvedProjectDependencies artifacts, final Map excludeArtifacts = new HashMap<>(); final Map includeArtifacts = new HashMap<>(); - ProjectBuildingRequest projectBuildingRequest - = new DefaultProjectBuildingRequest( mavenSessionProvider.get().getProjectBuildingRequest() ) - .setRemoteRepositories( remoteRepositories ) - .setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ) - .setResolveDependencies( false ) - .setProcessPlugins( false ); + ProjectBuildingRequest projectBuildingRequest = new DefaultProjectBuildingRequest( + mavenSessionProvider.get().getProjectBuildingRequest()) + .setRemoteRepositories(remoteRepositories) + .setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL) + .setResolveDependencies(false) + .setProcessPlugins(false); - for ( Artifact artifact : depArtifacts ) - { + for (Artifact artifact : depArtifacts) { - excludeArtifacts.put( artifact.getId(), artifact ); + excludeArtifacts.put(artifact.getId(), artifact); - if ( DefaultThirdPartyTool.LICENSE_DB_TYPE.equals( artifact.getType() ) ) - { + if (DefaultThirdPartyTool.LICENSE_DB_TYPE.equals(artifact.getType())) { // the special dependencies for license databases don't count. // Note that this will still see transitive deps of a license db; so using the build helper inside of // another project to make them will be noisy. continue; } - if ( !artifactFilters.isIncluded( artifact ) ) - { - LOG.debug( "Excluding artifact {}", artifact ); + if (!artifactFilters.isIncluded(artifact)) { + LOG.debug("Excluding artifact {}", artifact); continue; } final String id = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion(); - if ( verbose ) - { - LOG.info( "detected artifact {}", id ); + if (verbose) { + LOG.info("detected artifact {}", id); } LicensedArtifact depMavenProject; // try to get project from cache - depMavenProject = result.get( id ); + depMavenProject = result.get(id); - if ( depMavenProject != null ) - { - LOG.debug( "Dependency [{}] already present in the result", id ); - } - else - { + if (depMavenProject != null) { + LOG.debug("Dependency [{}] already present in the result", id); + } else { // build project - final Builder laBuilder = - LicensedArtifact.builder( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() ); - try - { + final Builder laBuilder = LicensedArtifact.builder( + artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion()); + try { final MavenProject project = mavenProjectBuilder - .build( artifact, true, projectBuildingRequest ) + .build(artifact, true, projectBuildingRequest) .getProject(); List lics = project.getLicenses(); - if ( lics != null ) - { - for ( org.apache.maven.model.License lic : lics ) - { - laBuilder.license( new License( lic.getName(), lic.getUrl(), lic.getDistribution(), - lic.getComments() ) ); + if (lics != null) { + for (org.apache.maven.model.License lic : lics) { + laBuilder.license( + new License(lic.getName(), lic.getUrl(), lic.getDistribution(), lic.getComments())); } } - } - catch ( ProjectBuildingException e ) - { - laBuilder.errorMessage( "Could not create effective POM for '" + id + "': " - + e.getClass().getSimpleName() + ": " + e.getMessage() ); + } catch (ProjectBuildingException e) { + laBuilder.errorMessage("Could not create effective POM for '" + id + "': " + + e.getClass().getSimpleName() + ": " + e.getMessage()); } depMavenProject = laBuilder.build(); - if ( verbose ) - { - LOG.info( "add dependency [{}]", id ); + if (verbose) { + LOG.info("add dependency [{}]", id); } - result.put( id, depMavenProject ); + result.put(id, depMavenProject); } - - excludeArtifacts.remove( artifact.getId() ); - includeArtifacts.put( artifact.getId(), artifact ); + excludeArtifacts.remove(artifact.getId()); + includeArtifacts.put(artifact.getId(), artifact); } // exclude artifacts from the result that contain excluded artifacts in the dependency trail - if ( excludeTransitiveDependencies ) - { - for ( Map.Entry entry : includeArtifacts.entrySet() ) - { + if (excludeTransitiveDependencies) { + for (Map.Entry entry : includeArtifacts.entrySet()) { List dependencyTrail = entry.getValue().getDependencyTrail(); boolean remove = false; - for ( int i = 1; i < dependencyTrail.size() - 1; i++ ) - { - if ( excludeArtifacts.containsKey( dependencyTrail.get( i ) ) ) - { + for (int i = 1; i < dependencyTrail.size() - 1; i++) { + if (excludeArtifacts.containsKey(dependencyTrail.get(i))) { remove = true; break; } } - if ( remove ) - { - result.remove( entry.getKey() ); + if (remove) { + result.remove(entry.getKey()); } } } - } // CHECKSTYLE_ON: MethodLength } diff --git a/src/main/java/org/codehaus/mojo/license/download/PreferredFileNames.java b/src/main/java/org/codehaus/mojo/license/download/PreferredFileNames.java index 7cd03b12a..a5f9b1e3b 100644 --- a/src/main/java/org/codehaus/mojo/license/download/PreferredFileNames.java +++ b/src/main/java/org/codehaus/mojo/license/download/PreferredFileNames.java @@ -53,242 +53,193 @@ * @since 1.18 */ // CHECKSTYLE_OFF: MethodLength -public class PreferredFileNames -{ - private static final Logger LOG = LoggerFactory.getLogger( PreferredFileNames.class ); +public class PreferredFileNames { + private static final Logger LOG = LoggerFactory.getLogger(PreferredFileNames.class); /** * @param licensesOutputDirectory * @param licenseUrlFileNames * @return a new {@link PreferredFileNames} built of AbstractDownloadLicensesMojo.licenseUrlFileNames */ - public static PreferredFileNames build( File licensesOutputDirectory, Map licenseUrlFileNames ) - { + public static PreferredFileNames build(File licensesOutputDirectory, Map licenseUrlFileNames) { final Map>> fileNameToUrlPatterns = new LinkedHashMap<>(); final Map sha1TofileName = new LinkedHashMap(); - - if ( licenseUrlFileNames != null ) - { - if ( licenseUrlFileNames.containsKey( "spdx" ) ) - { - spdx( fileNameToUrlPatterns, sha1TofileName ); + if (licenseUrlFileNames != null) { + if (licenseUrlFileNames.containsKey("spdx")) { + spdx(fileNameToUrlPatterns, sha1TofileName); } - for ( Entry en : licenseUrlFileNames.entrySet() ) - { + for (Entry en : licenseUrlFileNames.entrySet()) { final String fileName = en.getKey(); - if ( fileName != null && !fileName.isEmpty() ) - { - if ( "spdx".equals( fileName ) ) - { + if (fileName != null && !fileName.isEmpty()) { + if ("spdx".equals(fileName)) { // ignore - } - else if ( en.getValue() != null ) - { - String[] rawPatters = en.getValue().split( "\\s+" ); - if ( rawPatters != null ) - { + } else if (en.getValue() != null) { + String[] rawPatters = en.getValue().split("\\s+"); + if (rawPatters != null) { final List patterns = new ArrayList<>(); String sha1 = null; - for ( String rawPattern : rawPatters ) - { - if ( rawPattern.startsWith( "sha1:" ) ) - { - if ( sha1 != null ) - { - throw new IllegalStateException( "sha1 defined twice for licenseFileName '" - + fileName + "'" ); + for (String rawPattern : rawPatters) { + if (rawPattern.startsWith("sha1:")) { + if (sha1 != null) { + throw new IllegalStateException( + "sha1 defined twice for licenseFileName '" + fileName + "'"); } - sha1 = rawPattern.substring( 5 ); - } - else - { - patterns.add( Pattern.compile( rawPattern, Pattern.CASE_INSENSITIVE ) ); + sha1 = rawPattern.substring(5); + } else { + patterns.add(Pattern.compile(rawPattern, Pattern.CASE_INSENSITIVE)); } } - if ( sha1 != null ) - { - sha1TofileName.put( sha1, fileName ); + if (sha1 != null) { + sha1TofileName.put(sha1, fileName); } - fileNameToUrlPatterns.put( fileName, + fileNameToUrlPatterns.put( + fileName, new AbstractMap.SimpleImmutableEntry<>( - sha1, - Collections.unmodifiableList( patterns ) ) ); + sha1, Collections.unmodifiableList(patterns))); } } } } } - return new PreferredFileNames( licensesOutputDirectory, fileNameToUrlPatterns, sha1TofileName ); - + return new PreferredFileNames(licensesOutputDirectory, fileNameToUrlPatterns, sha1TofileName); } - private static void spdx( Map>> result, - Map sha1TofileName ) - { + private static void spdx( + Map>> result, Map sha1TofileName) { final Map>> fileNameToUrlPatterns = new TreeMap<>(); final SpdxLicenseList spdxList = SpdxLicenseList.getLatest(); final Map lics = spdxList.getLicenses(); - LOG.info( "Honoring {} SPDX licenses", lics.size() ); + LOG.info("Honoring {} SPDX licenses", lics.size()); /* Count in how many licenses is the given sha1 used */ final Map> sha1ToLicenseIds = new HashMap<>(); final Map> sha1ToUrls = new HashMap<>(); final Set stableSha1s = new HashSet<>(); - for ( SpdxLicenseInfo lic : lics.values() ) - { - if ( !lic.isDeprecatedLicenseId() ) - { - for ( Entry urlInfoEntry : lic.getAttachments().getUrlInfos().entrySet() ) - { + for (SpdxLicenseInfo lic : lics.values()) { + if (!lic.isDeprecatedLicenseId()) { + for (Entry urlInfoEntry : + lic.getAttachments().getUrlInfos().entrySet()) { final UrlInfo urlInfo = urlInfoEntry.getValue(); - if ( urlInfo.getSha1() != null && urlInfo.getMimeType() != null ) - { + if (urlInfo.getSha1() != null && urlInfo.getMimeType() != null) { final String sha1 = urlInfo.getSha1(); - if ( urlInfo.isStable() ) - { - stableSha1s.add( sha1 ); + if (urlInfo.isStable()) { + stableSha1s.add(sha1); } - Set licIds = sha1ToLicenseIds.get( sha1 ); - if ( licIds == null ) - { + Set licIds = sha1ToLicenseIds.get(sha1); + if (licIds == null) { licIds = new TreeSet<>(); - sha1ToLicenseIds.put( sha1, licIds ); + sha1ToLicenseIds.put(sha1, licIds); } - licIds.add( lic.getLicenseId() ); + licIds.add(lic.getLicenseId()); - Set urls = sha1ToUrls.get( sha1 ); - if ( urls == null ) - { + Set urls = sha1ToUrls.get(sha1); + if (urls == null) { urls = new TreeSet<>(); - sha1ToUrls.put( sha1, urls ); + sha1ToUrls.put(sha1, urls); } - urls.add( urlInfoEntry.getKey() ); + urls.add(urlInfoEntry.getKey()); } } } } /* For license sets in which a given sha1 is used, check if a . name would be unique */ - for ( Entry> sha1LicenseId : sha1ToLicenseIds.entrySet() ) - { + for (Entry> sha1LicenseId : sha1ToLicenseIds.entrySet()) { final Set licIds = sha1LicenseId.getValue(); final StringBuilder baseNameBuilder = new StringBuilder(); final Map> mimeTypeToSha1 = new HashMap<>(); - for ( String licId : licIds ) - { - if ( baseNameBuilder.length() > 0 ) - { - baseNameBuilder.append( "-OR-" ); + for (String licId : licIds) { + if (baseNameBuilder.length() > 0) { + baseNameBuilder.append("-OR-"); } - baseNameBuilder.append( licId ); + baseNameBuilder.append(licId); - final SpdxLicenseInfo lic = lics.get( licId ); - for ( Entry urlInfoEntry : lic.getAttachments().getUrlInfos().entrySet() ) - { + final SpdxLicenseInfo lic = lics.get(licId); + for (Entry urlInfoEntry : + lic.getAttachments().getUrlInfos().entrySet()) { final UrlInfo urlInfo = urlInfoEntry.getValue(); final String mimeType = urlInfo.getMimeType(); - if ( sha1ToLicenseIds.containsKey( urlInfo.getSha1() ) && mimeType != null ) - { - Set sha1s = mimeTypeToSha1.get( mimeType ); - if ( sha1s == null ) - { + if (sha1ToLicenseIds.containsKey(urlInfo.getSha1()) && mimeType != null) { + Set sha1s = mimeTypeToSha1.get(mimeType); + if (sha1s == null) { sha1s = new LinkedHashSet<>(); - mimeTypeToSha1.put( mimeType, sha1s ); + mimeTypeToSha1.put(mimeType, sha1s); } - sha1s.add( urlInfo.getSha1() ); + sha1s.add(urlInfo.getSha1()); } } } final String baseName = baseNameBuilder.toString(); - for ( Entry> mimeTypeSha1 : mimeTypeToSha1.entrySet() ) - { + for (Entry> mimeTypeSha1 : mimeTypeToSha1.entrySet()) { final String mimeType = mimeTypeSha1.getKey(); - if ( mimeType == null ) - { - throw new IllegalStateException( "mimeType must not be null" ); + if (mimeType == null) { + throw new IllegalStateException("mimeType must not be null"); } final Set sha1s = mimeTypeSha1.getValue(); - for ( String sha1 : sha1s ) - { - final String uniqueName = - sha1s.size() == 1 ? baseName : ( baseName + "-" + sha1.substring( 0, 7 ) ); - final String fileName = uniqueName + FileUtil.toExtension( mimeType, true ); + for (String sha1 : sha1s) { + final String uniqueName = sha1s.size() == 1 ? baseName : (baseName + "-" + sha1.substring(0, 7)); + final String fileName = uniqueName + FileUtil.toExtension(mimeType, true); final List patterns = new ArrayList<>(); - Set urls = sha1ToUrls.get( sha1 ); - for ( String url : urls ) - { - patterns.add( Pattern.compile( Pattern.quote( url ), Pattern.CASE_INSENSITIVE ) ); + Set urls = sha1ToUrls.get(sha1); + for (String url : urls) { + patterns.add(Pattern.compile(Pattern.quote(url), Pattern.CASE_INSENSITIVE)); } - final String useSha1 = stableSha1s.contains( sha1 ) ? sha1 : null; - if ( useSha1 != null ) - { - sha1TofileName.put( useSha1, fileName ); + final String useSha1 = stableSha1s.contains(sha1) ? sha1 : null; + if (useSha1 != null) { + sha1TofileName.put(useSha1, fileName); } - final List usePatterns = Collections.unmodifiableList( patterns ); + final List usePatterns = Collections.unmodifiableList(patterns); - final Entry> avail = fileNameToUrlPatterns.get( fileName ); - if ( avail == null ) - { - fileNameToUrlPatterns.put( fileName, - new AbstractMap.SimpleImmutableEntry<>( useSha1, usePatterns ) ); + final Entry> avail = fileNameToUrlPatterns.get(fileName); + if (avail == null) { + fileNameToUrlPatterns.put( + fileName, new AbstractMap.SimpleImmutableEntry<>(useSha1, usePatterns)); + } else if (!(avail.getKey() == useSha1 + || (avail.getKey() != null && avail.getKey().equals(useSha1))) + || !isEqual(usePatterns, avail.getValue())) { + LOG.warn("Available: {}, {}, {}", fileName, avail.getKey(), avail.getValue()); + LOG.warn("To add : {}, {}, {}", fileName, useSha1, patterns); + throw new IllegalStateException(fileName + " already present"); } - else if ( !( avail.getKey() == useSha1 - || ( avail.getKey() != null && avail.getKey().equals( useSha1 ) ) ) - || !isEqual( usePatterns, avail.getValue() ) ) - { - LOG.warn( "Available: {}, {}, {}", fileName, avail.getKey(), avail.getValue() ); - LOG.warn( "To add : {}, {}, {}", fileName, useSha1, patterns ); - throw new IllegalStateException( fileName + " already present" ); - } - } } } - if ( LOG.isDebugEnabled() ) - { + if (LOG.isDebugEnabled()) { final StringBuilder sb = new StringBuilder(); - sb.append( "\n" ); + sb.append("\n"); - for ( Entry>> en : fileNameToUrlPatterns.entrySet() ) - { + for (Entry>> en : fileNameToUrlPatterns.entrySet()) { final String fileName = en.getKey(); final String sha1 = en.getValue().getKey(); final List patterns = en.getValue().getValue(); - sb.append( " <" + fileName + ">\n" ); - if ( sha1 != null ) - { - sb.append( " sha1:" + sha1 + "\n" ); + sb.append(" <" + fileName + ">\n"); + if (sha1 != null) { + sb.append(" sha1:" + sha1 + "\n"); } - for ( Pattern pattern : patterns ) - { - sb.append( " " + pattern.pattern() + "\n" ); + for (Pattern pattern : patterns) { + sb.append(" " + pattern.pattern() + "\n"); } - sb.append( " \n" ); - + sb.append(" \n"); } - sb.append( "\n" ); - LOG.debug( "SPDX licenseUrlFileNames:" ); - LOG.debug( sb.toString() ); + sb.append("\n"); + LOG.debug("SPDX licenseUrlFileNames:"); + LOG.debug(sb.toString()); } - result.putAll( fileNameToUrlPatterns ); + result.putAll(fileNameToUrlPatterns); } - private static boolean isEqual( final List newPatterns, List oldPatterns ) - { - if ( oldPatterns.size() != newPatterns.size() ) - { + private static boolean isEqual(final List newPatterns, List oldPatterns) { + if (oldPatterns.size() != newPatterns.size()) { return false; } final Iterator newIt = newPatterns.iterator(); final Iterator oldIt = oldPatterns.iterator(); - while ( newIt.hasNext() ) - { - if ( !newIt.next().pattern().equals( oldIt.next().pattern() ) ) - { + while (newIt.hasNext()) { + if (!newIt.next().pattern().equals(oldIt.next().pattern())) { return false; } } @@ -299,10 +250,10 @@ private static boolean isEqual( final List newPatterns, List o private final Map>> fileNameToUrlPatterns; private final Map sha1ToFileName; - public PreferredFileNames( File licensesOutputDirectory, - Map>> fileNameToUrlPatterns, - Map sha1ToFileName ) - { + public PreferredFileNames( + File licensesOutputDirectory, + Map>> fileNameToUrlPatterns, + Map sha1ToFileName) { super(); this.licensesOutputDirectory = licensesOutputDirectory; this.fileNameToUrlPatterns = fileNameToUrlPatterns; @@ -313,32 +264,30 @@ public PreferredFileNames( File licensesOutputDirectory, * @param sha1 the checksum to search by * @return a file name bound the given {@code sha1} checksum or {@code null} */ - public String getFileNameBySha1( String sha1 ) - { - return sha1ToFileName.get( sha1 ); + public String getFileNameBySha1(String sha1) { + return sha1ToFileName.get(sha1); } /** * @param url the URL to query * @return the preferred {@link FileNameEntry} for the given {@code url} or {@code null} */ - public FileNameEntry getEntryByUrl( String url ) - { - for ( Entry>> fn : fileNameToUrlPatterns.entrySet() ) - { - for ( Pattern pat : fn.getValue().getValue() ) - { - if ( pat.matcher( url ).matches() ) - { - LOG.debug( "Using file name '{}' for URL '{}' that matched pattern '{}'", - fn.getKey(), - url, - pat.pattern() ); - return new FileNameEntry( new File( licensesOutputDirectory, fn.getKey() ), true, - fn.getValue().getKey() ); + public FileNameEntry getEntryByUrl(String url) { + for (Entry>> fn : fileNameToUrlPatterns.entrySet()) { + for (Pattern pat : fn.getValue().getValue()) { + if (pat.matcher(url).matches()) { + LOG.debug( + "Using file name '{}' for URL '{}' that matched pattern '{}'", + fn.getKey(), + url, + pat.pattern()); + return new FileNameEntry( + new File(licensesOutputDirectory, fn.getKey()), + true, + fn.getValue().getKey()); } } } return null; } -} \ No newline at end of file +} diff --git a/src/main/java/org/codehaus/mojo/license/download/ProjectLicense.java b/src/main/java/org/codehaus/mojo/license/download/ProjectLicense.java index f9c3e5826..25952f70f 100644 --- a/src/main/java/org/codehaus/mojo/license/download/ProjectLicense.java +++ b/src/main/java/org/codehaus/mojo/license/download/ProjectLicense.java @@ -29,9 +29,7 @@ * * @since 1.17 */ -public class ProjectLicense implements Cloneable -{ - +public class ProjectLicense implements Cloneable { /** * The full legal name of the license. @@ -74,9 +72,7 @@ public class ProjectLicense implements Cloneable /** * The default constructor. */ - public ProjectLicense() - { - } + public ProjectLicense() {} /** * Equivalent to {@code new ProjectLicense( license.getName(), license.getUrl(), license.getDistribution(), @@ -84,9 +80,8 @@ public ProjectLicense() * * @param license the license to get name, URL, ditribution and comments from */ - public ProjectLicense( License license ) - { - this( license.getName(), license.getUrl(), license.getDistribution(), license.getComments(), null ); + public ProjectLicense(License license) { + this(license.getName(), license.getUrl(), license.getDistribution(), license.getComments(), null); } /** @@ -98,8 +93,7 @@ public ProjectLicense( License license ) * @param comments additional information related to this license * @param file file name without path */ - public ProjectLicense( String name, String url, String distribution, String comments, String file ) - { + public ProjectLicense(String name, String url, String distribution, String comments, String file) { super(); this.name = name; this.url = url; @@ -113,8 +107,7 @@ public ProjectLicense( String name, String url, String distribution, String comm * * @return String */ - public String getComments() - { + public String getComments() { return this.comments; } @@ -132,8 +125,7 @@ public String getComments() * * @return String */ - public String getDistribution() - { + public String getDistribution() { return this.distribution; } @@ -142,8 +134,7 @@ public String getDistribution() * * @return String */ - public String getName() - { + public String getName() { return this.name; } @@ -152,8 +143,7 @@ public String getName() * * @return String */ - public String getUrl() - { + public String getUrl() { return this.url; } @@ -162,8 +152,7 @@ public String getUrl() * * @return a path or {@code null} */ - public String getFile() - { + public String getFile() { return this.file; } @@ -172,8 +161,7 @@ public String getFile() * * @param comments */ - public void setComments( String comments ) - { + public void setComments(String comments) { this.comments = comments; } @@ -191,8 +179,7 @@ public void setComments( String comments ) * * @param distribution */ - public void setDistribution( String distribution ) - { + public void setDistribution(String distribution) { this.distribution = distribution; } @@ -201,8 +188,7 @@ public void setDistribution( String distribution ) * * @param name */ - public void setName( String name ) - { + public void setName(String name) { this.name = name; } @@ -211,8 +197,7 @@ public void setName( String name ) * * @param url */ - public void setUrl( String url ) - { + public void setUrl(String url) { this.url = url; } @@ -221,79 +206,50 @@ public void setUrl( String url ) * * @param file the path to set */ - public void setFile( String file ) - { + public void setFile(String file) { this.file = file; } @Override - public ProjectLicense clone() - throws CloneNotSupportedException - { + public ProjectLicense clone() throws CloneNotSupportedException { return (ProjectLicense) super.clone(); } @Override - public int hashCode() - { + public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ( ( comments == null ) ? 0 : comments.hashCode() ); - result = prime * result + ( ( distribution == null ) ? 0 : distribution.hashCode() ); - result = prime * result + ( ( file == null ) ? 0 : file.hashCode() ); - result = prime * result + ( ( name == null ) ? 0 : name.hashCode() ); - result = prime * result + ( ( url == null ) ? 0 : url.hashCode() ); + result = prime * result + ((comments == null) ? 0 : comments.hashCode()); + result = prime * result + ((distribution == null) ? 0 : distribution.hashCode()); + result = prime * result + ((file == null) ? 0 : file.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((url == null) ? 0 : url.hashCode()); return result; } @Override - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { // CHECKSTYLE_OFF: NeedBraces - if ( this == obj ) - return true; - if ( obj == null ) - return false; - if ( getClass() != obj.getClass() ) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; ProjectLicense other = (ProjectLicense) obj; - if ( comments == null ) - { - if ( other.comments != null ) - return false; - } - else if ( !comments.equals( other.comments ) ) - return false; - if ( distribution == null ) - { - if ( other.distribution != null ) - return false; - } - else if ( !distribution.equals( other.distribution ) ) - return false; - if ( file == null ) - { - if ( other.file != null ) - return false; - } - else if ( !file.equals( other.file ) ) - return false; - if ( name == null ) - { - if ( other.name != null ) - return false; - } - else if ( !name.equals( other.name ) ) - return false; - if ( url == null ) - { - if ( other.url != null ) - return false; - } - else if ( !url.equals( other.url ) ) - return false; + if (comments == null) { + if (other.comments != null) return false; + } else if (!comments.equals(other.comments)) return false; + if (distribution == null) { + if (other.distribution != null) return false; + } else if (!distribution.equals(other.distribution)) return false; + if (file == null) { + if (other.file != null) return false; + } else if (!file.equals(other.file)) return false; + if (name == null) { + if (other.name != null) return false; + } else if (!name.equals(other.name)) return false; + if (url == null) { + if (other.url != null) return false; + } else if (!url.equals(other.url)) return false; return true; // CHECKSTYLE_ON: NeedBraces } - } diff --git a/src/main/java/org/codehaus/mojo/license/download/ProjectLicenseInfo.java b/src/main/java/org/codehaus/mojo/license/download/ProjectLicenseInfo.java index c66b686f3..f6e27fbdb 100644 --- a/src/main/java/org/codehaus/mojo/license/download/ProjectLicenseInfo.java +++ b/src/main/java/org/codehaus/mojo/license/download/ProjectLicenseInfo.java @@ -22,20 +22,19 @@ * #L% */ -import org.apache.maven.artifact.Artifact; - import java.util.ArrayList; import java.util.List; import java.util.Objects; +import org.apache.maven.artifact.Artifact; + /** * Contains the license information for a single project/dependency * * @author pgier * @since 1.0 */ -public class ProjectLicenseInfo -{ +public class ProjectLicenseInfo { private String groupId; private String artifactId; @@ -54,93 +53,74 @@ public class ProjectLicenseInfo /** * Default constructor. */ - public ProjectLicenseInfo() - { + public ProjectLicenseInfo() {} - } - - public ProjectLicenseInfo( String groupId, String artifactId, String version ) - { + public ProjectLicenseInfo(String groupId, String artifactId, String version) { this.groupId = groupId; this.artifactId = artifactId; this.version = version; } - public ProjectLicenseInfo( String groupId, String artifactId, String version, boolean hasMatchLicenses ) - { + public ProjectLicenseInfo(String groupId, String artifactId, String version, boolean hasMatchLicenses) { this.groupId = groupId; this.artifactId = artifactId; this.version = version; this.hasMatchLicenses = hasMatchLicenses; } - public String getGroupId() - { + public String getGroupId() { return groupId; } - public void setGroupId( String groupId ) - { + public void setGroupId(String groupId) { this.groupId = groupId; } - public String getArtifactId() - { + public String getArtifactId() { return artifactId; } - public void setArtifactId( String artifactId ) - { + public void setArtifactId(String artifactId) { this.artifactId = artifactId; } - public String getVersion() - { + public String getVersion() { return version; } - public void setVersion( String version ) - { + public void setVersion(String version) { this.version = version; } - public List getLicenses() - { + public List getLicenses() { return licenses; } - public void setLicenses( List licenses ) - { + public void setLicenses(List licenses) { this.licenses = licenses; } - public void addLicense( ProjectLicense license ) - { - licenses.add( license ); + public void addLicense(ProjectLicense license) { + licenses.add(license); } - public List getMatchLicenses() - { + public List getMatchLicenses() { return matchLicenses; } - public void setMatchLicenses( List matchLicenses ) - { + public void setMatchLicenses(List matchLicenses) { this.matchLicenses = matchLicenses; } - public void addMatchLicense( ProjectLicense license ) - { - matchLicenses.add( license ); + public void addMatchLicense(ProjectLicense license) { + matchLicenses.add(license); } - public boolean hasMatchLicenses() - { + public boolean hasMatchLicenses() { return hasMatchLicenses; } - public void setHasMatchLicenses( boolean hasMatchLicenses ) - { + public void setHasMatchLicenses(boolean hasMatchLicenses) { this.hasMatchLicenses = hasMatchLicenses; } @@ -149,109 +129,89 @@ public void setHasMatchLicenses( boolean hasMatchLicenses ) * * @return String containing "groupId:artifactId" */ - public String getId() - { + public String getId() { return groupId + ":" + artifactId; } - public List getDownloaderMessages() - { + public List getDownloaderMessages() { return downloaderMessages; } - public void addDownloaderMessage( String message ) - { - downloaderMessages.add( message ); + public void addDownloaderMessage(String message) { + downloaderMessages.add(message); } /** * {@inheritDoc} */ @Override - public String toString() - { + public String toString() { return getId(); } - public String toGavString() - { - return groupId + ":" + artifactId + ( version == null ? "" : ( ":" + version ) ); + public String toGavString() { + return groupId + ":" + artifactId + (version == null ? "" : (":" + version)); } /** * {@inheritDoc} */ @Override - public boolean equals( Object compareTo ) - { - if ( compareTo instanceof ProjectLicenseInfo ) - { + public boolean equals(Object compareTo) { + if (compareTo instanceof ProjectLicenseInfo) { ProjectLicenseInfo compare = (ProjectLicenseInfo) compareTo; - if ( groupId.equals( compare.getGroupId() ) && artifactId.equals( compare.getArtifactId() ) ) - { + if (groupId.equals(compare.getGroupId()) && artifactId.equals(compare.getArtifactId())) { return true; } } - if ( compareTo instanceof Artifact ) - { + if (compareTo instanceof Artifact) { Artifact compare = (Artifact) compareTo; - if ( groupId.equals( compare.getGroupId() ) && artifactId.equals( compare.getArtifactId() ) ) - { + if (groupId.equals(compare.getGroupId()) && artifactId.equals(compare.getArtifactId())) { return true; } } return false; } - public boolean deepEquals( ProjectLicenseInfo other ) - { - return Objects.equals( groupId, other.groupId ) && Objects.equals( artifactId, other.artifactId ) - && Objects.equals( version, other.version ) && Objects.equals( licenses, other.licenses ) - && Objects.equals( matchLicenses, other.matchLicenses ) - && Objects.equals( downloaderMessages, other.downloaderMessages ); + public boolean deepEquals(ProjectLicenseInfo other) { + return Objects.equals(groupId, other.groupId) + && Objects.equals(artifactId, other.artifactId) + && Objects.equals(version, other.version) + && Objects.equals(licenses, other.licenses) + && Objects.equals(matchLicenses, other.matchLicenses) + && Objects.equals(downloaderMessages, other.downloaderMessages); } /** * {@inheritDoc} */ @Override - public int hashCode() - { + public int hashCode() { return getId().hashCode(); } - /** * @return a deep clone of {@link #licenses} */ - public List cloneLicenses() - { - try - { - final ArrayList result = new ArrayList<>( licenses != null ? licenses.size() : 0 ); - if ( licenses != null ) - { - for ( ProjectLicense license : licenses ) - { - result.add( license.clone() ); + public List cloneLicenses() { + try { + final ArrayList result = new ArrayList<>(licenses != null ? licenses.size() : 0); + if (licenses != null) { + for (ProjectLicense license : licenses) { + result.add(license.clone()); } } return result; - } - catch ( CloneNotSupportedException e ) - { - throw new RuntimeException( e ); + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); } } - public void setApproved( boolean approved ) - { + public void setApproved(boolean approved) { this.approved = approved; } - public boolean isApproved() - { + public boolean isApproved() { return approved; } - } diff --git a/src/main/java/org/codehaus/mojo/license/download/UrlReplacements.java b/src/main/java/org/codehaus/mojo/license/download/UrlReplacements.java index 703745db5..d67abbe56 100644 --- a/src/main/java/org/codehaus/mojo/license/download/UrlReplacements.java +++ b/src/main/java/org/codehaus/mojo/license/download/UrlReplacements.java @@ -40,34 +40,28 @@ * @author Peter Palaga * @since 1.20 */ -public class UrlReplacements -{ - private static final Logger LOG = LoggerFactory.getLogger( UrlReplacements.class ); +public class UrlReplacements { + private static final Logger LOG = LoggerFactory.getLogger(UrlReplacements.class); - public static Builder builder() - { + public static Builder builder() { return new Builder(); } private final List replacements; - UrlReplacements( List replacements ) - { + UrlReplacements(List replacements) { super(); this.replacements = replacements; } - public String rewriteIfNecessary( final String originalLicenseUrl ) - { + public String rewriteIfNecessary(final String originalLicenseUrl) { String resultUrl = originalLicenseUrl; - for ( UrlReplacement r : replacements ) - { - resultUrl = r.getUrlPattern().matcher( resultUrl ).replaceAll( r.getReplacement() ); + for (UrlReplacement r : replacements) { + resultUrl = r.getUrlPattern().matcher(resultUrl).replaceAll(r.getReplacement()); } - if ( LOG.isDebugEnabled() && !resultUrl.equals( originalLicenseUrl ) ) - { - LOG.debug( "Rewrote URL {} => {}", originalLicenseUrl, resultUrl ); + if (LOG.isDebugEnabled() && !resultUrl.equals(originalLicenseUrl)) { + LOG.debug("Rewrote URL {} => {}", originalLicenseUrl, resultUrl); } return resultUrl; } @@ -77,83 +71,70 @@ public String rewriteIfNecessary( final String originalLicenseUrl ) * * @since 1.20 */ - public static class Builder - { + public static class Builder { private List replacements = new ArrayList<>(); private boolean useDefaults; private Set ids = new HashSet<>(); - public Builder replacement( String id, String urlPattern, String replacement ) - { + public Builder replacement(String id, String urlPattern, String replacement) { - if ( id != null ) - { - ids.add( id ); - } - else - { + if (id != null) { + ids.add(id); + } else { id = urlPattern + "_" + replacement; } - replacements.add( UrlReplacement.compile( id, urlPattern, replacement ) ); + replacements.add(UrlReplacement.compile(id, urlPattern, replacement)); return this; } - public Builder useDefaults( boolean useDefaults ) - { + public Builder useDefaults(boolean useDefaults) { this.useDefaults = useDefaults; return this; } - public UrlReplacements build() - { - if ( useDefaults ) - { - final Collection defaults = - SpdxLicenseList.getLatest().getAttachments().getUrlReplacements().values(); + public UrlReplacements build() { + if (useDefaults) { + final Collection defaults = SpdxLicenseList.getLatest() + .getAttachments() + .getUrlReplacements() + .values(); int usedDefaults = 0; - for ( UrlReplacement r : defaults ) - { - if ( !ids.contains( r.getId() ) ) - { - replacements.add( r ); + for (UrlReplacement r : defaults) { + if (!ids.contains(r.getId())) { + replacements.add(r); usedDefaults++; } } - if ( usedDefaults > 0 && LOG.isDebugEnabled() ) - { + if (usedDefaults > 0 && LOG.isDebugEnabled()) { final StringBuilder sb = new StringBuilder(); - sb.append( "Appending " + usedDefaults + " default licenseUrlReplacements:\n" ) - .append( "\n" ); - - for ( UrlReplacement r : defaults ) - { - if ( !ids.contains( r.getId() ) ) - { - sb - .append( " \n" ) - .append( " " ) // - .append( r.getId() ) // - .append( "\n" ) // - .append( " " ) // - .append( r.getUrlPattern() ) // - .append( "\n" ) // - .append( " " ) // - .append( r.getReplacement() ) // - .append( "\n" ) // - .append( " \n" ); + sb.append("Appending " + usedDefaults + " default licenseUrlReplacements:\n") + .append("\n"); + + for (UrlReplacement r : defaults) { + if (!ids.contains(r.getId())) { + sb.append(" \n") + .append(" ") // + .append(r.getId()) // + .append("\n") // + .append(" ") // + .append(r.getUrlPattern()) // + .append("\n") // + .append(" ") // + .append(r.getReplacement()) // + .append("\n") // + .append(" \n"); } } - sb - .append( "\n" ); - LOG.debug( sb.toString() ); + sb.append("\n"); + LOG.debug(sb.toString()); } } - List rs = Collections.unmodifiableList( replacements ); + List rs = Collections.unmodifiableList(replacements); replacements = null; - return new UrlReplacements( rs ); + return new UrlReplacements(rs); } } } diff --git a/src/main/java/org/codehaus/mojo/license/header/FileHeader.java b/src/main/java/org/codehaus/mojo/license/header/FileHeader.java index 72d26ba18..8a850c029 100644 --- a/src/main/java/org/codehaus/mojo/license/header/FileHeader.java +++ b/src/main/java/org/codehaus/mojo/license/header/FileHeader.java @@ -40,8 +40,7 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class FileHeader -{ +public class FileHeader { /** * Description of the project or module to add in header. @@ -62,16 +61,14 @@ public class FileHeader * @return the project name, or nay other common informations for all * files of a project (or module) */ - public String getDescription() - { + public String getDescription() { return description; } /** * @return the copyright model. */ - public Copyright getCopyright() - { + public Copyright getCopyright() { return copyright; } @@ -79,23 +76,19 @@ public Copyright getCopyright() * @return the license content (this is not the fully license content, * but just a per file license resume) */ - public String getLicense() - { + public String getLicense() { return license; } - public void setCopyright( Copyright copyright ) - { + public void setCopyright(Copyright copyright) { this.copyright = copyright; } - public void setDescription( String description ) - { + public void setDescription(String description) { this.description = description; } - public void setLicense( String license ) - { + public void setLicense(String license) { this.license = license; } } diff --git a/src/main/java/org/codehaus/mojo/license/header/FileHeaderFilter.java b/src/main/java/org/codehaus/mojo/license/header/FileHeaderFilter.java index 7379902f9..139511347 100644 --- a/src/main/java/org/codehaus/mojo/license/header/FileHeaderFilter.java +++ b/src/main/java/org/codehaus/mojo/license/header/FileHeaderFilter.java @@ -33,10 +33,8 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public abstract class FileHeaderFilter - extends DefaultFilter -{ - private static final Logger LOG = LoggerFactory.getLogger( FileHeaderFilter.class ); +public abstract class FileHeaderFilter extends DefaultFilter { + private static final Logger LOG = LoggerFactory.getLogger(FileHeaderFilter.class); /** * flag set to {@code true} when a header was detected (says detects both @@ -88,53 +86,45 @@ public abstract class FileHeaderFilter * @return {@code null} if header is still the same, otherwise the new header to apply * @since 1.0 */ - protected abstract FileHeader getNewHeader( FileHeader oldHeader ); + protected abstract FileHeader getNewHeader(FileHeader oldHeader); /** * Default constructor. */ - public FileHeaderFilter() - { - } + public FileHeaderFilter() {} /** * {@inheritDoc} */ @Override - protected String performInFilter( String ch ) - { - LOG.debug( "performInFilter - original header =\n{}", ch ); + protected String performInFilter(String ch) { + LOG.debug("performInFilter - original header =\n{}", ch); - if ( isTouched() ) - { + if (isTouched()) { // Can NOT authorize two header in a same source - throw new IllegalStateException( "Can only have one file header start tag : " + getHeader() ); + throw new IllegalStateException("Can only have one file header start tag : " + getHeader()); } - if ( getMatchIndexFor( ch, getHeader() ) == NOT_FOUND ) - { + if (getMatchIndexFor(ch, getHeader()) == NOT_FOUND) { // the header was detected, mark file to be touched touched = true; // obtain old header model FileHeaderTransformer headerTransformer = getTransformer(); - String tmp = headerTransformer.unboxComent( ch ); - FileHeader oldHeader = headerTransformer.toFileHeader( tmp ); + String tmp = headerTransformer.unboxComent(ch); + FileHeader oldHeader = headerTransformer.toFileHeader(tmp); // obtain the new header (according to what to update) - FileHeader newFileHeader = getNewHeader( oldHeader ); + FileHeader newFileHeader = getNewHeader(oldHeader); FileHeader header; - if ( newFileHeader == null ) - { + if (newFileHeader == null) { // keep the old header header = oldHeader; - } - else - { + } else { // mark that the header was updated modified = true; @@ -142,7 +132,7 @@ protected String performInFilter( String ch ) header = newFileHeader; } - return transformer.toHeaderContent( header ); + return transformer.toHeaderContent(header); } // Means we detects the process start tag but not the end one. // coming then here from the flush filter method... So changes nothing @@ -154,9 +144,8 @@ protected String performInFilter( String ch ) * {@inheritDoc} */ @Override - protected String performOutFilter( String ch ) - { - LOG.debug( ch ); + protected String performOutFilter(String ch) { + LOG.debug(ch); return ch; } @@ -164,8 +153,7 @@ protected String performOutFilter( String ch ) * {@inheritDoc} */ @Override - protected String getHeader() - { + protected String getHeader() { return getTransformer().getProcessStartTag(); } @@ -173,8 +161,7 @@ protected String getHeader() * {@inheritDoc} */ @Override - protected String getFooter() - { + protected String getFooter() { return getTransformer().getProcessEndTag(); } @@ -182,93 +169,75 @@ protected String getFooter() * {@inheritDoc} */ @Override - protected void changeState( State newState ) - { - super.changeState( newState ); - if ( newState == State.SEARCH_FOOTER ) - { + protected void changeState(State newState) { + super.changeState(newState); + if (newState == State.SEARCH_FOOTER) { // on a decouvert un header detectHeader = true; } } - public String getHeaderContent() - { - if ( headerContent == null ) - { - headerContent = getTransformer().toString( getFileHeader() ); + public String getHeaderContent() { + if (headerContent == null) { + headerContent = getTransformer().toString(getFileHeader()); } return headerContent; } - public String getProcessTagHeaderContent() - { - if ( processTagHeaderContent == null ) - { + public String getProcessTagHeaderContent() { + if (processTagHeaderContent == null) { // box with process tag - processTagHeaderContent = getTransformer().boxProcessTag( getHeaderContent() ); - + processTagHeaderContent = getTransformer().boxProcessTag(getHeaderContent()); } return processTagHeaderContent; } - public String getFullHeaderContent() - { - if ( fullHeaderContent == null ) - { + public String getFullHeaderContent() { + if (fullHeaderContent == null) { // box with comment - fullHeaderContent = getTransformer().boxComment( getProcessTagHeaderContent(), true ); + fullHeaderContent = getTransformer().boxComment(getProcessTagHeaderContent(), true); } return fullHeaderContent; } - public boolean isTouched() - { + public boolean isTouched() { return touched; } - public boolean isModified() - { + public boolean isModified() { return modified; } - public boolean isDetectHeader() - { + public boolean isDetectHeader() { return detectHeader; } - public FileHeader getFileHeader() - { + public FileHeader getFileHeader() { return fileHeader; } - public FileHeaderTransformer getTransformer() - { + public FileHeaderTransformer getTransformer() { return transformer; } - public void setFileHeader( FileHeader fileHeader ) - { + public void setFileHeader(FileHeader fileHeader) { this.fileHeader = fileHeader; } - public void setTransformer( FileHeaderTransformer transformer ) - { + public void setTransformer(FileHeaderTransformer transformer) { this.transformer = transformer; } - public void reset() - { + public void reset() { touched = false; modified = false; detectHeader = false; state = State.SEARCH_HEADER; } - public void resetContent() - { + public void resetContent() { headerContent = null; processTagHeaderContent = null; fullHeaderContent = null; diff --git a/src/main/java/org/codehaus/mojo/license/header/FileHeaderProcessor.java b/src/main/java/org/codehaus/mojo/license/header/FileHeaderProcessor.java index cda669f30..4684df49e 100644 --- a/src/main/java/org/codehaus/mojo/license/header/FileHeaderProcessor.java +++ b/src/main/java/org/codehaus/mojo/license/header/FileHeaderProcessor.java @@ -30,6 +30,7 @@ import java.io.OutputStreamWriter; import java.io.Reader; import java.io.Writer; + import org.codehaus.mojo.license.header.transformer.FileHeaderTransformer; import org.nuiton.processor.Processor; @@ -39,37 +40,31 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class FileHeaderProcessor extends Processor -{ +public class FileHeaderProcessor extends Processor { /** * internal file header filter. */ private final FileHeaderFilter filter; - public FileHeaderProcessor( FileHeaderFilter filter, FileHeader fileHeader, FileHeaderTransformer transformer ) - { - if ( filter == null ) - { - throw new IllegalStateException( "no file header filter set." ); + public FileHeaderProcessor(FileHeaderFilter filter, FileHeader fileHeader, FileHeaderTransformer transformer) { + if (filter == null) { + throw new IllegalStateException("no file header filter set."); } - if ( fileHeader == null ) - { - throw new IllegalStateException( "no file header set." ); + if (fileHeader == null) { + throw new IllegalStateException("no file header set."); } - if ( transformer == null ) - { - throw new IllegalStateException( "no file header transformer set." ); + if (transformer == null) { + throw new IllegalStateException("no file header transformer set."); } this.filter = filter; - setInputFilter( filter ); - filter.setFileHeader( fileHeader ); - filter.setTransformer( transformer ); + setInputFilter(filter); + filter.setFileHeader(fileHeader); + filter.setTransformer(transformer); filter.resetContent(); } - public String addHeader( String content ) - { - return filter.getTransformer().addHeader( filter.getFullHeaderContent(), content ); + public String addHeader(String content) { + return filter.getTransformer().addHeader(filter.getFullHeaderContent(), content); } /** @@ -77,8 +72,7 @@ public String addHeader( String content ) * fully found), {@code false} otherwise * @see FileHeaderFilter#isTouched() */ - public boolean isTouched() - { + public boolean isTouched() { return filter.isTouched(); } @@ -87,8 +81,7 @@ public boolean isTouched() * fully found and content changed), {@code false} otherwise * @see FileHeaderFilter#isModified() */ - public boolean isModified() - { + public boolean isModified() { return filter.isModified(); } @@ -96,43 +89,33 @@ public boolean isModified() * @return {@code true} if header of header was detected * @see FileHeaderFilter#isDetectHeader() */ - public boolean isDetectHeader() - { + public boolean isDetectHeader() { return filter.isDetectHeader(); } - public synchronized void process( String inputContent, File outputFile, String encoding ) throws IOException - { + public synchronized void process(String inputContent, File outputFile, String encoding) throws IOException { filter.reset(); - Reader input = new InputStreamReader( new ByteArrayInputStream( inputContent.getBytes( encoding ) ), encoding ); - try - { - Writer output = new OutputStreamWriter( new FileOutputStream( outputFile ), encoding ); - try - { - process( input, output ); - } - finally - { + Reader input = new InputStreamReader(new ByteArrayInputStream(inputContent.getBytes(encoding)), encoding); + try { + Writer output = new OutputStreamWriter(new FileOutputStream(outputFile), encoding); + try { + process(input, output); + } finally { output.close(); } - } - finally - { + } finally { input.close(); } } - public String getFileHeaderDescription() - { + public String getFileHeaderDescription() { return filter.getFileHeader().getDescription(); } - public void updateDescription( String description ) - { - filter.getFileHeader().setDescription( description ); + public void updateDescription(String description) { + filter.getFileHeader().setDescription(description); filter.resetContent(); } } diff --git a/src/main/java/org/codehaus/mojo/license/header/InvalideFileHeaderException.java b/src/main/java/org/codehaus/mojo/license/header/InvalideFileHeaderException.java index 8fe961a71..1b0d874d0 100644 --- a/src/main/java/org/codehaus/mojo/license/header/InvalideFileHeaderException.java +++ b/src/main/java/org/codehaus/mojo/license/header/InvalideFileHeaderException.java @@ -31,25 +31,20 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class InvalideFileHeaderException - extends IOException -{ +public class InvalideFileHeaderException extends IOException { private static final long serialVersionUID = 1L; /** * Default constructor. */ - public InvalideFileHeaderException() - { - } + public InvalideFileHeaderException() {} /** * Constructor with a message. * * @param message message of the error */ - public InvalideFileHeaderException( String message ) - { - super( message ); + public InvalideFileHeaderException(String message) { + super(message); } } diff --git a/src/main/java/org/codehaus/mojo/license/header/UpdateFileHeaderFilter.java b/src/main/java/org/codehaus/mojo/license/header/UpdateFileHeaderFilter.java index 33752447c..423738fa4 100644 --- a/src/main/java/org/codehaus/mojo/license/header/UpdateFileHeaderFilter.java +++ b/src/main/java/org/codehaus/mojo/license/header/UpdateFileHeaderFilter.java @@ -33,9 +33,8 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class UpdateFileHeaderFilter extends FileHeaderFilter -{ - private static final Logger LOG = LoggerFactory.getLogger( UpdateFileHeaderFilter.class ); +public class UpdateFileHeaderFilter extends FileHeaderFilter { + private static final Logger LOG = LoggerFactory.getLogger(UpdateFileHeaderFilter.class); /** * Flag sets to {@code true} if description can be updated. @@ -53,8 +52,7 @@ public class UpdateFileHeaderFilter extends FileHeaderFilter private boolean updateCopyright; @Override - protected FileHeader getNewHeader( FileHeader oldHeader ) - { + protected FileHeader getNewHeader(FileHeader oldHeader) { FileHeader result = new FileHeader(); @@ -65,57 +63,50 @@ protected FileHeader getNewHeader( FileHeader oldHeader ) boolean modified = false; // by default, reuse the old header - result.setDescription( oldHeader.getDescription() ); - result.setCopyright( new Copyright( oldHeader.getCopyright() ) ); - result.setLicense( oldHeader.getLicense() ); + result.setDescription(oldHeader.getDescription()); + result.setCopyright(new Copyright(oldHeader.getCopyright())); + result.setLicense(oldHeader.getLicense()); - if ( isUpdateDescription() && !transformer.isDescriptionEquals( oldHeader, newHeader ) ) - { + if (isUpdateDescription() && !transformer.isDescriptionEquals(oldHeader, newHeader)) { // can update description and it has changed - LOG.debug( "description has changed from [{}] to [{}]", + LOG.debug( + "description has changed from [{}] to [{}]", oldHeader.getDescription(), - newHeader.getDescription() ); + newHeader.getDescription()); // description has changed, mark header to be updated modified = true; // use the new description - result.setDescription( newHeader.getDescription() ); + result.setDescription(newHeader.getDescription()); } - if ( isUpdateCopyright() && !transformer.isCopyrightEquals( oldHeader, newHeader ) ) - { + if (isUpdateCopyright() && !transformer.isCopyrightEquals(oldHeader, newHeader)) { // can update copyright and it has changed - LOG.debug( "copyright has changed from [{}] to [{}]", - oldHeader.getCopyright(), - newHeader.getCopyright() ); + LOG.debug("copyright has changed from [{}] to [{}]", oldHeader.getCopyright(), newHeader.getCopyright()); // description has changed, mark header to be updated modified = true; // use the new copyright - result.setCopyright( new Copyright( newHeader.getCopyright() ) ); + result.setCopyright(new Copyright(newHeader.getCopyright())); } - if ( isUpdateLicense() && !transformer.isLicenseEquals( oldHeader, newHeader ) ) - { + if (isUpdateLicense() && !transformer.isLicenseEquals(oldHeader, newHeader)) { // can update license and it has changed - LOG.debug( "license has changed from [{}] to [{}]", - oldHeader.getLicense(), - newHeader.getLicense() ); + LOG.debug("license has changed from [{}] to [{}]", oldHeader.getLicense(), newHeader.getLicense()); // description has changed, mark header to be updated modified = true; // use the new license - result.setLicense( newHeader.getLicense() ); + result.setLicense(newHeader.getLicense()); } - if ( !modified ) - { + if (!modified) { // nothing has to be updated, so return a {@code null} result result = null; @@ -124,33 +115,27 @@ protected FileHeader getNewHeader( FileHeader oldHeader ) return result; } - private boolean isUpdateCopyright() - { + private boolean isUpdateCopyright() { return updateCopyright; } - public void setUpdateCopyright( boolean updateCopyright ) - { + public void setUpdateCopyright(boolean updateCopyright) { this.updateCopyright = updateCopyright; } - private boolean isUpdateDescription() - { + private boolean isUpdateDescription() { return updateDescription; } - public void setUpdateDescription( boolean updateDescription ) - { + public void setUpdateDescription(boolean updateDescription) { this.updateDescription = updateDescription; } - private boolean isUpdateLicense() - { + private boolean isUpdateLicense() { return updateLicense; } - public void setUpdateLicense( boolean updateLicense ) - { + public void setUpdateLicense(boolean updateLicense) { this.updateLicense = updateLicense; } } diff --git a/src/main/java/org/codehaus/mojo/license/header/transformer/AbstractFileHeaderTransformer.java b/src/main/java/org/codehaus/mojo/license/header/transformer/AbstractFileHeaderTransformer.java index 589b157fd..369c4788b 100644 --- a/src/main/java/org/codehaus/mojo/license/header/transformer/AbstractFileHeaderTransformer.java +++ b/src/main/java/org/codehaus/mojo/license/header/transformer/AbstractFileHeaderTransformer.java @@ -22,13 +22,13 @@ * #L% */ +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import org.apache.commons.lang3.StringUtils; import org.codehaus.mojo.license.header.FileHeader; import org.codehaus.mojo.license.model.Copyright; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** * Abstract implementation of {@link FileHeaderTransformer}. * @@ -37,9 +37,7 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public abstract class AbstractFileHeaderTransformer - implements FileHeaderTransformer -{ +public abstract class AbstractFileHeaderTransformer implements FileHeaderTransformer { /** * pattern of the copyright string representation : @@ -52,7 +50,7 @@ public abstract class AbstractFileHeaderTransformer * */ static final Pattern COPYRIGHT_PATTERN = - Pattern.compile( "(.[^\\d]+)?\\s(\\d{4})?(\\s+-\\s+(\\d{4})?){0,1}\\s+(.+)?", Pattern.DOTALL ); + Pattern.compile("(.[^\\d]+)?\\s(\\d{4})?(\\s+-\\s+(\\d{4})?){0,1}\\s+(.+)?", Pattern.DOTALL); /** * name of transformer. @@ -109,24 +107,21 @@ public abstract class AbstractFileHeaderTransformer */ private String lineSeparator; - protected AbstractFileHeaderTransformer( String name, String description, String commentStartTag, - String commentEndTag, String commentLinePrefix ) - { + protected AbstractFileHeaderTransformer( + String name, String description, String commentStartTag, String commentEndTag, String commentLinePrefix) { this.name = name; this.description = description; // checks comment start tag is different from comment prefix - if ( commentStartTag.equals( commentLinePrefix ) ) - { + if (commentStartTag.equals(commentLinePrefix)) { throw new IllegalStateException( - "commentStartTag can not be equals to commentPrefixLine, " + "but was [" + commentStartTag + "]" ); + "commentStartTag can not be equals to commentPrefixLine, " + "but was [" + commentStartTag + "]"); } // checks comment end tag is different from comment prefix - if ( commentEndTag.equals( commentLinePrefix ) ) - { + if (commentEndTag.equals(commentLinePrefix)) { throw new IllegalStateException( - "commentEndTag can not be equals to commentPrefixLine, " + "but was [" + commentEndTag + "]" ); + "commentEndTag can not be equals to commentPrefixLine, " + "but was [" + commentEndTag + "]"); } this.commentStartTag = commentStartTag; @@ -137,158 +132,134 @@ protected AbstractFileHeaderTransformer( String name, String description, String /** * {@inheritDoc} */ - public String getName() - { + public String getName() { return name; } /** * {@inheritDoc} */ - public void setName( String name ) - { + public void setName(String name) { this.name = name; } /** * {@inheritDoc} */ - public String getDescription() - { + public String getDescription() { return description; } /** * {@inheritDoc} */ - public void setDescription( String description ) - { + public void setDescription(String description) { this.description = description; } /** * {@inheritDoc} */ - public String getSectionDelimiter() - { + public String getSectionDelimiter() { return sectionDelimiter; } /** * {@inheritDoc} */ - public void setSectionDelimiter( String sectionDelimiter ) - { + public void setSectionDelimiter(String sectionDelimiter) { this.sectionDelimiter = sectionDelimiter; } /** * {@inheritDoc} */ - public String getProcessStartTag() - { + public String getProcessStartTag() { return processStartTag; } /** * {@inheritDoc} */ - public void setProcessStartTag( String processStartTag ) - { + public void setProcessStartTag(String processStartTag) { this.processStartTag = processStartTag; } /** * {@inheritDoc} */ - public String getProcessEndTag() - { + public String getProcessEndTag() { return processEndTag; } /** * {@inheritDoc} */ - public void setProcessEndTag( String processEndTag ) - { + public void setProcessEndTag(String processEndTag) { this.processEndTag = processEndTag; } /** * {@inheritDoc} */ - public String getCommentStartTag() - { + public String getCommentStartTag() { return commentStartTag; } /** * {@inheritDoc} */ - public void setCommentStartTag( String commentStartTag ) - { + public void setCommentStartTag(String commentStartTag) { this.commentStartTag = commentStartTag; } /** * {@inheritDoc} */ - public String getCommentEndTag() - { + public String getCommentEndTag() { return commentEndTag; } /** * {@inheritDoc} */ - public void setCommentEndTag( String commentEndTag ) - { + public void setCommentEndTag(String commentEndTag) { this.commentEndTag = commentEndTag; } /** * {@inheritDoc} */ - public String getCommentLinePrefix() - { + public String getCommentLinePrefix() { return commentLinePrefix; } /** * {@inheritDoc} */ - public String getLineSeparator() - { - if ( lineSeparator == null ) - { + public String getLineSeparator() { + if (lineSeparator == null) { lineSeparator = LINE_SEPARATOR; return lineSeparator; - } - else - { + } else { return lineSeparator; } } /** * {@inheritDoc} */ - public void setLineSeparator( String lineSeparator ) - { + public void setLineSeparator(String lineSeparator) { this.lineSeparator = lineSeparator; } /** * {@inheritDoc} */ - public String addHeader( String header, String content ) - { - if ( isEmptyLineAfterHeader() ) - { - String[] contentSplit = content.split( "\\r?\\n", 2 ); - if ( contentSplit.length > 0 ) - { + public String addHeader(String header, String content) { + if (isEmptyLineAfterHeader()) { + String[] contentSplit = content.split("\\r?\\n", 2); + if (contentSplit.length > 0) { final String line = contentSplit[0].trim(); - if ( line.length() > 0 ) - { + if (line.length() > 0) { return header + getLineSeparator() + content; } } @@ -299,164 +270,145 @@ public String addHeader( String header, String content ) /** * {@inheritDoc} */ - public void setCommentLinePrefix( String commentLinePrefix ) - { + public void setCommentLinePrefix(String commentLinePrefix) { this.commentLinePrefix = commentLinePrefix; } /** * {@inheritDoc} */ - public boolean isEmptyLineAfterHeader() - { + public boolean isEmptyLineAfterHeader() { return emptyLineAfterHeader; } /** * {@inheritDoc} */ - public void setEmptyLineAfterHeader( boolean emptyLine ) - { + public void setEmptyLineAfterHeader(boolean emptyLine) { this.emptyLineAfterHeader = emptyLine; } /** * {@inheritDoc} */ - public boolean isTrimHeaderLine() - { + public boolean isTrimHeaderLine() { return trimHeaderLine; } /** * {@inheritDoc} */ - public void setTrimHeaderLine( boolean trimLine ) - { + public void setTrimHeaderLine(boolean trimLine) { this.trimHeaderLine = trimLine; } /** * {@inheritDoc} */ - public FileHeader toFileHeader( String header ) - { + public FileHeader toFileHeader(String header) { FileHeader model = new FileHeader(); - String[] sections = header.split( getSectionDelimiter() ); - if ( sections.length != 3 ) - { - throw new IllegalStateException( "could not find 3 sections in\n" + header ); + String[] sections = header.split(getSectionDelimiter()); + if (sections.length != 3) { + throw new IllegalStateException("could not find 3 sections in\n" + header); } // first section is the description String description = sections[0].trim(); - model.setDescription( description ); + model.setDescription(description); // second section is the copyright String copyrightModel = sections[1].trim(); - Matcher matcher = COPYRIGHT_PATTERN.matcher( copyrightModel ); - if ( !matcher.matches() ) - { - throw new IllegalStateException( "copyright [" + copyrightModel + "] is not valid" ); + Matcher matcher = COPYRIGHT_PATTERN.matcher(copyrightModel); + if (!matcher.matches()) { + throw new IllegalStateException("copyright [" + copyrightModel + "] is not valid"); } - String firstYear = matcher.group( 2 ); - String lastYear = matcher.group( 4 ); - String holder = matcher.group( 5 ); - Copyright copyright1 = - Copyright.newCopyright( Integer.valueOf( firstYear ), lastYear == null - ? null - : Integer.valueOf( lastYear.trim() ), holder.trim() ); - model.setCopyright( copyright1 ); + String firstYear = matcher.group(2); + String lastYear = matcher.group(4); + String holder = matcher.group(5); + Copyright copyright1 = Copyright.newCopyright( + Integer.valueOf(firstYear), lastYear == null ? null : Integer.valueOf(lastYear.trim()), holder.trim()); + model.setCopyright(copyright1); // third section is the license String license = sections[2].trim(); - model.setLicense( license ); + model.setLicense(license); return model; } /** * {@inheritDoc} */ - public String toString( FileHeader model ) - { - if ( model == null ) - { - throw new NullPointerException( "model can not be null!" ); + public String toString(FileHeader model) { + if (model == null) { + throw new NullPointerException("model can not be null!"); } StringBuilder buffer = new StringBuilder(); String sectionDelimiter = getLineSeparator() + getSectionDelimiter() + getLineSeparator(); // add description section - buffer.append( model.getDescription().trim() ); - buffer.append( sectionDelimiter ); + buffer.append(model.getDescription().trim()); + buffer.append(sectionDelimiter); // add copyright section - buffer.append( model.getCopyright().getText().trim() ); - buffer.append( sectionDelimiter ); + buffer.append(model.getCopyright().getText().trim()); + buffer.append(sectionDelimiter); // add license section - buffer.append( model.getLicense().trim() ).append( getLineSeparator() ); + buffer.append(model.getLicense().trim()).append(getLineSeparator()); return buffer.toString(); } /** * {@inheritDoc} */ - public String toHeaderContent( FileHeader model ) - { + public String toHeaderContent(FileHeader model) { String result; // model to text - result = toString( model ); + result = toString(model); // box with process tag - result = boxProcessTag( result ); + result = boxProcessTag(result); // box header with comment prefix - result = boxComment( result, false ); + result = boxComment(result, false); // remove all before process start tag // remove all after process end tag // this is a requirement for processor to respect involution. - int index = result.indexOf( getProcessStartTag() ); - int lastIndex = result.lastIndexOf( getProcessEndTag() ) + getProcessEndTag().length(); + int index = result.indexOf(getProcessStartTag()); + int lastIndex = + result.lastIndexOf(getProcessEndTag()) + getProcessEndTag().length(); - result = result.substring( index, lastIndex ); + result = result.substring(index, lastIndex); return result; } /** * {@inheritDoc} */ - public String boxComment( String header, boolean withTags ) - { + public String boxComment(String header, boolean withTags) { StringBuilder buffer = new StringBuilder(); - if ( withTags ) - { - buffer.append( getCommentStartTag() ).append( getLineSeparator() ); + if (withTags) { + buffer.append(getCommentStartTag()).append(getLineSeparator()); } - for ( String line : header.split( "\\r?\\n" ) ) - { - if ( isTrimHeaderLine() ) - { - StringBuilder lineBuffer = new StringBuilder(); - lineBuffer.append( getCommentLinePrefix() ); - lineBuffer.append( line ); - buffer.append( StringUtils.stripEnd( lineBuffer.toString(), null ) ); - } - else - { - buffer.append( getCommentLinePrefix() ); - buffer.append( line ); + for (String line : header.split("\\r?\\n")) { + if (isTrimHeaderLine()) { + StringBuilder lineBuffer = new StringBuilder(); + lineBuffer.append(getCommentLinePrefix()); + lineBuffer.append(line); + buffer.append(StringUtils.stripEnd(lineBuffer.toString(), null)); + } else { + buffer.append(getCommentLinePrefix()); + buffer.append(line); } - buffer.append( getLineSeparator() ); + buffer.append(getLineSeparator()); } - if ( withTags ) - { - buffer.append( getCommentEndTag() ).append( getLineSeparator() ); + if (withTags) { + buffer.append(getCommentEndTag()).append(getLineSeparator()); } return buffer.toString(); } @@ -464,39 +416,29 @@ public String boxComment( String header, boolean withTags ) /** * {@inheritDoc} */ - public String unboxComent( String header ) - { + public String unboxComent(String header) { StringBuilder buffer = new StringBuilder(); int prefixLength = getCommentLinePrefix().length(); - for ( String line : header.split( getLineSeparator() + "" ) ) - { - if ( StringUtils.isEmpty( line ) || line.contains( getCommentStartTag() ) - || line.contains( getCommentEndTag() ) ) - { + for (String line : header.split(getLineSeparator() + "")) { + if (StringUtils.isEmpty(line) || line.contains(getCommentStartTag()) || line.contains(getCommentEndTag())) { // not be unboxed, but just skipped continue; } - int index = line.indexOf( getCommentLinePrefix() ); - if ( index > -1 ) - { + int index = line.indexOf(getCommentLinePrefix()); + if (index > -1) { // remove comment prefix - line = line.substring( index + prefixLength ); - } - else - { + line = line.substring(index + prefixLength); + } else { String s = getCommentLinePrefix().trim(); - if ( line.startsWith( s ) ) - { - line = line.substring( s.length() ); - } - else - { + if (line.startsWith(s)) { + line = line.substring(s.length()); + } else { line = ""; } } - buffer.append( line ).append( getLineSeparator() ); + buffer.append(line).append(getLineSeparator()); } return buffer.toString(); } @@ -504,30 +446,25 @@ public String unboxComent( String header ) /** * {@inheritDoc} */ - public String boxProcessTag( String header ) - { + public String boxProcessTag(String header) { StringBuilder buffer = new StringBuilder(); - buffer.append( getProcessStartTag() ).append( getLineSeparator() ); - buffer.append( header.trim() ).append( getLineSeparator() ); - buffer.append( getProcessEndTag() ).append( getLineSeparator() ); + buffer.append(getProcessStartTag()).append(getLineSeparator()); + buffer.append(header.trim()).append(getLineSeparator()); + buffer.append(getProcessEndTag()).append(getLineSeparator()); return buffer.toString(); } /** * {@inheritDoc} */ - public String unboxProcessTag( String boxedHeader ) - { + public String unboxProcessTag(String boxedHeader) { StringBuilder buffer = new StringBuilder(); - for ( String line : boxedHeader.split( getLineSeparator() + "" ) ) - { - if ( StringUtils.isEmpty( line ) || line.contains( getProcessStartTag() ) - || line.contains( getProcessEndTag() ) ) - { + for (String line : boxedHeader.split(getLineSeparator() + "")) { + if (StringUtils.isEmpty(line) || line.contains(getProcessStartTag()) || line.contains(getProcessEndTag())) { // not be unboxed, but just skipped continue; } - buffer.append( line ).append( getLineSeparator() ); + buffer.append(line).append(getLineSeparator()); } return buffer.toString(); } @@ -535,41 +472,34 @@ public String unboxProcessTag( String boxedHeader ) /** * {@inheritDoc} */ - public boolean isDescriptionEquals( FileHeader header1, FileHeader header2 ) - { - return header1.getDescription().equals( header2.getDescription() ); + public boolean isDescriptionEquals(FileHeader header1, FileHeader header2) { + return header1.getDescription().equals(header2.getDescription()); } /** * {@inheritDoc} */ - public boolean isCopyrightEquals( FileHeader header1, FileHeader header2 ) - { - return header1.getCopyright().equals( header2.getCopyright() ); + public boolean isCopyrightEquals(FileHeader header1, FileHeader header2) { + return header1.getCopyright().equals(header2.getCopyright()); } /** * {@inheritDoc} */ - public boolean isLicenseEquals( FileHeader header1, FileHeader header2 ) - { - String license1 = removeSpaces( header1.getLicense() ); - String license2 = removeSpaces( header2.getLicense() ); - return license1.equals( license2 ); + public boolean isLicenseEquals(FileHeader header1, FileHeader header2) { + String license1 = removeSpaces(header1.getLicense()); + String license2 = removeSpaces(header2.getLicense()); + return license1.equals(license2); } - private static final Pattern REMOVE_SPACE_PATTERN = Pattern.compile( "(\\s+)" ); + private static final Pattern REMOVE_SPACE_PATTERN = Pattern.compile("(\\s+)"); - private String removeSpaces( String str ) - { - Matcher matcher = REMOVE_SPACE_PATTERN.matcher( str ); + private String removeSpaces(String str) { + Matcher matcher = REMOVE_SPACE_PATTERN.matcher(str); String result; - if ( matcher.find() ) - { - result = matcher.replaceAll( "" ); - } - else - { + if (matcher.find()) { + result = matcher.replaceAll(""); + } else { result = str; } return result; diff --git a/src/main/java/org/codehaus/mojo/license/header/transformer/AptFileHeaderTransformer.java b/src/main/java/org/codehaus/mojo/license/header/transformer/AptFileHeaderTransformer.java index c7655e51b..4514b92f5 100644 --- a/src/main/java/org/codehaus/mojo/license/header/transformer/AptFileHeaderTransformer.java +++ b/src/main/java/org/codehaus/mojo/license/header/transformer/AptFileHeaderTransformer.java @@ -33,23 +33,19 @@ */ @Named("apt") @Singleton -public class AptFileHeaderTransformer - extends AbstractFileHeaderTransformer -{ +public class AptFileHeaderTransformer extends AbstractFileHeaderTransformer { /** * Default constructor. */ - public AptFileHeaderTransformer() - { - super( "apt", "header transformer with apt comment style", "~~~", "~~~", "~~ " ); + public AptFileHeaderTransformer() { + super("apt", "header transformer with apt comment style", "~~~", "~~~", "~~ "); } /** * {@inheritDoc} */ - public String[] getDefaultAcceptedExtensions() - { - return new String[]{ "apt" }; + public String[] getDefaultAcceptedExtensions() { + return new String[] {"apt"}; } } diff --git a/src/main/java/org/codehaus/mojo/license/header/transformer/FileHeaderTransformer.java b/src/main/java/org/codehaus/mojo/license/header/transformer/FileHeaderTransformer.java index 8f3d9af69..003543a4f 100644 --- a/src/main/java/org/codehaus/mojo/license/header/transformer/FileHeaderTransformer.java +++ b/src/main/java/org/codehaus/mojo/license/header/transformer/FileHeaderTransformer.java @@ -44,8 +44,7 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public interface FileHeaderTransformer -{ +public interface FileHeaderTransformer { /** * default section delimiter. @@ -65,7 +64,7 @@ public interface FileHeaderTransformer /** * Line separator. */ - String LINE_SEPARATOR = System.getProperty( "line.separator" ); + String LINE_SEPARATOR = System.getProperty("line.separator"); /** * @return the name of the transformer @@ -155,7 +154,7 @@ public interface FileHeaderTransformer * @param content content of original file * @return the new full file content beginning with header */ - String addHeader( String header, String content ); + String addHeader(String header, String content); /** * Box the given {@code header} in a comment. @@ -164,7 +163,7 @@ public interface FileHeaderTransformer * @param withTags flag to add start and end comment tags. * @return the header content WITH comment boxing */ - String boxComment( String header, boolean withTags ); + String boxComment(String header, boolean withTags); /** * Unbox the given boxed {@code boxedHeader} to obtain the header content. @@ -172,7 +171,7 @@ public interface FileHeaderTransformer * @param boxedHeader the boxed header * @return the unboxed header. */ - String unboxComent( String boxedHeader ); + String unboxComent(String boxedHeader); /** * Box the given {@code header} between process tags. @@ -182,7 +181,7 @@ public interface FileHeaderTransformer * @see #getProcessStartTag() * @see #getProcessEndTag() */ - String boxProcessTag( String header ); + String boxProcessTag(String header); /** * Unbox the process tag on the given boxed {@code boxedHeader} to obtain @@ -193,7 +192,7 @@ public interface FileHeaderTransformer * @see #getProcessStartTag() * @see #getProcessEndTag() */ - String unboxProcessTag( String boxedHeader ); + String unboxProcessTag(String boxedHeader); /** * Build a {@link FileHeader} from an UNBOXED header content. @@ -201,7 +200,7 @@ public interface FileHeaderTransformer * @param header unboxed header content * @return The model of the header content */ - FileHeader toFileHeader( String header ); + FileHeader toFileHeader(String header); /** * Build a UNBOXED header content from the given {@code model}. @@ -209,7 +208,7 @@ public interface FileHeaderTransformer * @param model the model of the file header (can not be null) * @return the UNBOXED header content */ - String toString( FileHeader model ); + String toString(FileHeader model); /** * Build a fully boxed header content from the given {@code model}. @@ -217,7 +216,7 @@ public interface FileHeaderTransformer * @param model the model of the file header (can not be null) * @return the fully boxed header content */ - String toHeaderContent( FileHeader model ); + String toHeaderContent(FileHeader model); /** * Tests if the description of the two models are equals. @@ -226,7 +225,7 @@ public interface FileHeaderTransformer * @param header2 the second header * @return {@code true} if headers description are stricly the same */ - boolean isDescriptionEquals( FileHeader header1, FileHeader header2 ); + boolean isDescriptionEquals(FileHeader header1, FileHeader header2); /** * Tests if the copyright of the two models are equals. @@ -235,7 +234,7 @@ public interface FileHeaderTransformer * @param header2 the second header * @return {@code true} if headers copyright are stricly the same */ - boolean isCopyrightEquals( FileHeader header1, FileHeader header2 ); + boolean isCopyrightEquals(FileHeader header1, FileHeader header2); /** * Tests if the license of the two models are equals. @@ -244,21 +243,21 @@ public interface FileHeaderTransformer * @param header2 the second header * @return {@code true} if headers license are stricly the same (WITHOUT ANY space) */ - boolean isLicenseEquals( FileHeader header1, FileHeader header2 ); + boolean isLicenseEquals(FileHeader header1, FileHeader header2); /** * Changes the name of the transformer. * * @param name the new name of the transformer */ - void setName( String name ); + void setName(String name); /** * Chages the description of the transformer. * * @param description the new description of the transformer */ - void setDescription( String description ); + void setDescription(String description); /** * Sets the header section delimiter. @@ -267,56 +266,56 @@ public interface FileHeaderTransformer * * @param headerSectionDelimiter the new delimiter */ - void setSectionDelimiter( String headerSectionDelimiter ); + void setSectionDelimiter(String headerSectionDelimiter); /** * Changes the process start tag. * * @param tag the new start tag */ - void setProcessStartTag( String tag ); + void setProcessStartTag(String tag); /** * Changes the process end tag. * * @param tag the new endtag */ - void setProcessEndTag( String tag ); + void setProcessEndTag(String tag); /** * Changes the comment start tag. * * @param commentStartTag the new comment start tag */ - void setCommentStartTag( String commentStartTag ); + void setCommentStartTag(String commentStartTag); /** * Changes the comment end tag. * * @param commentEndTag the new comment end tag */ - void setCommentEndTag( String commentEndTag ); + void setCommentEndTag(String commentEndTag); /** * Changes the comment prefix line. * * @param commentLinePrefix the new comment prefix line */ - void setCommentLinePrefix( String commentLinePrefix ); + void setCommentLinePrefix(String commentLinePrefix); /** * Set flag if there should be an empty line after the header. * * @param emptyLine flag if there should be an empty line after the header */ - void setEmptyLineAfterHeader( boolean emptyLine ); + void setEmptyLineAfterHeader(boolean emptyLine); /** * Set flag if header line should be right trimmed when written. * * @param trimLine flag if header line should be right trimmed when written */ - void setTrimHeaderLine( boolean trimLine ); + void setTrimHeaderLine(boolean trimLine); - void setLineSeparator( String lineSeparator ); + void setLineSeparator(String lineSeparator); } diff --git a/src/main/java/org/codehaus/mojo/license/header/transformer/FreeMarkerFileHeaderTransformer.java b/src/main/java/org/codehaus/mojo/license/header/transformer/FreeMarkerFileHeaderTransformer.java index 5476d9bdb..5ef61bf77 100644 --- a/src/main/java/org/codehaus/mojo/license/header/transformer/FreeMarkerFileHeaderTransformer.java +++ b/src/main/java/org/codehaus/mojo/license/header/transformer/FreeMarkerFileHeaderTransformer.java @@ -33,23 +33,19 @@ */ @Named("ftl") @Singleton -public class FreeMarkerFileHeaderTransformer - extends AbstractFileHeaderTransformer -{ +public class FreeMarkerFileHeaderTransformer extends AbstractFileHeaderTransformer { /** * Default constructor. */ - public FreeMarkerFileHeaderTransformer() - { - super( "ftl", "header transformer with free marker comment style", "<#--", "-->", " " ); + public FreeMarkerFileHeaderTransformer() { + super("ftl", "header transformer with free marker comment style", "<#--", "-->", " "); } /** * {@inheritDoc} */ - public String[] getDefaultAcceptedExtensions() - { - return new String[]{ "ftl" }; + public String[] getDefaultAcceptedExtensions() { + return new String[] {"ftl"}; } } diff --git a/src/main/java/org/codehaus/mojo/license/header/transformer/HtmlFileHeaderTransformer.java b/src/main/java/org/codehaus/mojo/license/header/transformer/HtmlFileHeaderTransformer.java index 9b1908ee2..9b8e791f9 100644 --- a/src/main/java/org/codehaus/mojo/license/header/transformer/HtmlFileHeaderTransformer.java +++ b/src/main/java/org/codehaus/mojo/license/header/transformer/HtmlFileHeaderTransformer.java @@ -33,63 +33,53 @@ */ @Named("html") @Singleton -public class HtmlFileHeaderTransformer - extends AbstractFileHeaderTransformer -{ +public class HtmlFileHeaderTransformer extends AbstractFileHeaderTransformer { /** * Default constructor. */ - public HtmlFileHeaderTransformer() - { - super( "xml", "header transformer with html comment style", "", " " ); + public HtmlFileHeaderTransformer() { + super("xml", "header transformer with html comment style", "", " "); } /** * {@inheritDoc} */ - public String[] getDefaultAcceptedExtensions() - { - return new String[]{ "xhtml", "html", "htm" }; + public String[] getDefaultAcceptedExtensions() { + return new String[] {"xhtml", "html", "htm"}; } /** * {@inheritDoc} */ @Override - public String addHeader( String header, String content ) - { + public String addHeader(String header, String content) { String result; String prolog = null; - int startProlog = content.indexOf( " -1 ) - { + int startProlog = content.indexOf(" -1) { // prolog start was detected - int endProlog = content.indexOf( ">", startProlog ); + int endProlog = content.indexOf(">", startProlog); - if ( endProlog > -1 ) - { + if (endProlog > -1) { // prolog end was detected - prolog = content.substring( 0, endProlog + 1 ); + prolog = content.substring(0, endProlog + 1); } } - if ( prolog == null ) - { + if (prolog == null) { // no prolog detected - result = super.addHeader( header, content ); - } - else - { + result = super.addHeader(header, content); + } else { // prolog detected - content = content.substring( prolog.length() ); - result = super.addHeader( prolog + getLineSeparator() + header, content ); + content = content.substring(prolog.length()); + result = super.addHeader(prolog + getLineSeparator() + header, content); } return result; } diff --git a/src/main/java/org/codehaus/mojo/license/header/transformer/JavaFileHeaderTransformer.java b/src/main/java/org/codehaus/mojo/license/header/transformer/JavaFileHeaderTransformer.java index dd13e6f09..ca86b7550 100644 --- a/src/main/java/org/codehaus/mojo/license/header/transformer/JavaFileHeaderTransformer.java +++ b/src/main/java/org/codehaus/mojo/license/header/transformer/JavaFileHeaderTransformer.java @@ -33,9 +33,7 @@ */ @Named("java") @Singleton -public class JavaFileHeaderTransformer - extends AbstractFileHeaderTransformer -{ +public class JavaFileHeaderTransformer extends AbstractFileHeaderTransformer { /** * Flag to add the license header after the {@code package} statement. @@ -56,18 +54,16 @@ public class JavaFileHeaderTransformer /** * Default constructor. */ - public JavaFileHeaderTransformer() - { - super( "java", "header transformer with java comment style", "/*", " */", " * " ); + public JavaFileHeaderTransformer() { + super("java", "header transformer with java comment style", "/*", " */", " * "); } /** * {@inheritDoc} */ - public String[] getDefaultAcceptedExtensions() - { - return new String[]{ "java", "groovy", "css", "jccs", "cs", "as", "aj", "c", "h", "cpp", "js", "json", "ts", - "go", "kt" + public String[] getDefaultAcceptedExtensions() { + return new String[] { + "java", "groovy", "css", "jccs", "cs", "as", "aj", "c", "h", "cpp", "js", "json", "ts", "go", "kt" }; } @@ -77,8 +73,7 @@ public String[] getDefaultAcceptedExtensions() * @param addJavaLicenseAfterPackage the new value to set * @since 1.2 */ - public void setAddJavaLicenseAfterPackage( boolean addJavaLicenseAfterPackage ) - { + public void setAddJavaLicenseAfterPackage(boolean addJavaLicenseAfterPackage) { this.addJavaLicenseAfterPackage = addJavaLicenseAfterPackage; } @@ -88,14 +83,12 @@ public void setAddJavaLicenseAfterPackage( boolean addJavaLicenseAfterPackage ) * @param useNoReformatCommentStartTag the new value to set * @since 1.9 */ - public void setUseNoReformatCommentStartTag( boolean useNoReformatCommentStartTag ) - { + public void setUseNoReformatCommentStartTag(boolean useNoReformatCommentStartTag) { this.useNoReformatCommentStartTag = useNoReformatCommentStartTag; } @Override - public String getCommentStartTag() - { + public String getCommentStartTag() { return useNoReformatCommentStartTag ? "/*-" : super.getCommentStartTag(); } @@ -103,26 +96,22 @@ public String getCommentStartTag() * {@inheritDoc} */ @Override - public String addHeader( String header, String content ) - { + public String addHeader(String header, String content) { - if ( !addJavaLicenseAfterPackage ) - { - return super.addHeader( header, content ); + if (!addJavaLicenseAfterPackage) { + return super.addHeader(header, content); } String result; String prolog = null; - int startProlog = content.indexOf( "package" ); - if ( startProlog > -1 ) - { + int startProlog = content.indexOf("package"); + if (startProlog > -1) { // package was detected - int endProlog = content.indexOf( ";", startProlog ); + int endProlog = content.indexOf(";", startProlog); - if ( endProlog > -1 ) - { + if (endProlog > -1) { // prolog end was detected @@ -130,38 +119,30 @@ public String addHeader( String header, String content ) // Include existing end of line in prolog - if ( lastIndex < content.length() && content.charAt( lastIndex ) == '\r' ) - { - lastIndex++; + if (lastIndex < content.length() && content.charAt(lastIndex) == '\r') { + lastIndex++; } - if ( lastIndex < content.length() && content.charAt( lastIndex ) == '\n' ) - { - lastIndex++; + if (lastIndex < content.length() && content.charAt(lastIndex) == '\n') { + lastIndex++; } // the prolog includes the whole package definition - prolog = content.substring( 0, lastIndex ); - - + prolog = content.substring(0, lastIndex); } } - if ( prolog == null ) - { + if (prolog == null) { // no prolog detected - result = super.addHeader( header, content ); - } - else - { + result = super.addHeader(header, content); + } else { // prolog detected - content = content.substring( prolog.length() ); - result = super.addHeader( prolog + getLineSeparator() + header, content ); + content = content.substring(prolog.length()); + result = super.addHeader(prolog + getLineSeparator() + header, content); } return result; } - } diff --git a/src/main/java/org/codehaus/mojo/license/header/transformer/JspFileHeaderTransformer.java b/src/main/java/org/codehaus/mojo/license/header/transformer/JspFileHeaderTransformer.java index 4ff9e58d1..4f3b5e7b1 100644 --- a/src/main/java/org/codehaus/mojo/license/header/transformer/JspFileHeaderTransformer.java +++ b/src/main/java/org/codehaus/mojo/license/header/transformer/JspFileHeaderTransformer.java @@ -33,24 +33,19 @@ */ @Named("jsp") @Singleton -public class JspFileHeaderTransformer - extends AbstractFileHeaderTransformer -{ +public class JspFileHeaderTransformer extends AbstractFileHeaderTransformer { /** * Default constructor. */ - public JspFileHeaderTransformer() - { - super( "jsp", "header transformer with jsp comment style", "<%--", " --%>", " " ); + public JspFileHeaderTransformer() { + super("jsp", "header transformer with jsp comment style", "<%--", " --%>", " "); } /** * {@inheritDoc} */ - public String[] getDefaultAcceptedExtensions() - { - return new String[]{ "jsp", "jspx" }; + public String[] getDefaultAcceptedExtensions() { + return new String[] {"jsp", "jspx"}; } - } diff --git a/src/main/java/org/codehaus/mojo/license/header/transformer/MySqlFileHeaderTransformer.java b/src/main/java/org/codehaus/mojo/license/header/transformer/MySqlFileHeaderTransformer.java index 751d0fe35..0d1145975 100644 --- a/src/main/java/org/codehaus/mojo/license/header/transformer/MySqlFileHeaderTransformer.java +++ b/src/main/java/org/codehaus/mojo/license/header/transformer/MySqlFileHeaderTransformer.java @@ -36,24 +36,19 @@ */ @Named("mysql") @Singleton -public class MySqlFileHeaderTransformer - extends AbstractFileHeaderTransformer -{ +public class MySqlFileHeaderTransformer extends AbstractFileHeaderTransformer { /** * Default constructor. */ - public MySqlFileHeaderTransformer() - { - super( "mysql", "header transformer with mysql comment style", "-- -", "-- -", "-- " ); + public MySqlFileHeaderTransformer() { + super("mysql", "header transformer with mysql comment style", "-- -", "-- -", "-- "); } /** * {@inheritDoc} */ - public String[] getDefaultAcceptedExtensions() - { - return new String[]{ "mysql" }; + public String[] getDefaultAcceptedExtensions() { + return new String[] {"mysql"}; } } - diff --git a/src/main/java/org/codehaus/mojo/license/header/transformer/PhpFileHeaderTransformer.java b/src/main/java/org/codehaus/mojo/license/header/transformer/PhpFileHeaderTransformer.java index 7e5dec650..252e9aa35 100644 --- a/src/main/java/org/codehaus/mojo/license/header/transformer/PhpFileHeaderTransformer.java +++ b/src/main/java/org/codehaus/mojo/license/header/transformer/PhpFileHeaderTransformer.java @@ -34,24 +34,19 @@ */ @Named("php") @Singleton -public class PhpFileHeaderTransformer - extends AbstractFileHeaderTransformer -{ +public class PhpFileHeaderTransformer extends AbstractFileHeaderTransformer { /** * Default constructor. */ - public PhpFileHeaderTransformer() - { - super( "php", "header transformer with php comment style", "", " * " ); + public PhpFileHeaderTransformer() { + super("php", "header transformer with php comment style", "", " * "); } /** * {@inheritDoc} */ - public String[] getDefaultAcceptedExtensions() - { - return new String[]{ "php" }; + public String[] getDefaultAcceptedExtensions() { + return new String[] {"php"}; } - } diff --git a/src/main/java/org/codehaus/mojo/license/header/transformer/PropertiesFileHeaderTransformer.java b/src/main/java/org/codehaus/mojo/license/header/transformer/PropertiesFileHeaderTransformer.java index 54380c906..b5e8effa3 100644 --- a/src/main/java/org/codehaus/mojo/license/header/transformer/PropertiesFileHeaderTransformer.java +++ b/src/main/java/org/codehaus/mojo/license/header/transformer/PropertiesFileHeaderTransformer.java @@ -33,64 +33,54 @@ */ @Named("properties") @Singleton -public class PropertiesFileHeaderTransformer - extends AbstractFileHeaderTransformer -{ +public class PropertiesFileHeaderTransformer extends AbstractFileHeaderTransformer { /** * Default constructor. */ - public PropertiesFileHeaderTransformer() - { - super( "properties", "header transformer with properties file comment style", "###", "###", "# " ); + public PropertiesFileHeaderTransformer() { + super("properties", "header transformer with properties file comment style", "###", "###", "# "); } /** * {@inheritDoc} */ - public String[] getDefaultAcceptedExtensions() - { - return new String[]{ "properties", "sh", "py", "rb", "pl", "pm" }; + public String[] getDefaultAcceptedExtensions() { + return new String[] {"properties", "sh", "py", "rb", "pl", "pm"}; } /** * {@inheritDoc} */ @Override - public String addHeader( String header, String content ) - { + public String addHeader(String header, String content) { String result; String prolog = null; - int startProlog = content.indexOf( "#!" ); - if ( startProlog > -1 ) - { + int startProlog = content.indexOf("#!"); + if (startProlog > -1) { // shebang was detected - int endProlog = content.indexOf( '\n', startProlog ); + int endProlog = content.indexOf('\n', startProlog); - if ( endProlog > -1 ) - { + if (endProlog > -1) { // prolog end was detected - prolog = content.substring( 0, endProlog + 1 ); + prolog = content.substring(0, endProlog + 1); } } - if ( prolog == null ) - { + if (prolog == null) { // no shebang detected - result = super.addHeader( header, content ); - } - else - { + result = super.addHeader(header, content); + } else { // shebang detected - content = content.substring( prolog.length() ); - result = super.addHeader( prolog + getLineSeparator() + header, content ); + content = content.substring(prolog.length()); + result = super.addHeader(prolog + getLineSeparator() + header, content); } return result; } diff --git a/src/main/java/org/codehaus/mojo/license/header/transformer/RstFileHeaderTransformer.java b/src/main/java/org/codehaus/mojo/license/header/transformer/RstFileHeaderTransformer.java index 4457cf984..7a269fd75 100644 --- a/src/main/java/org/codehaus/mojo/license/header/transformer/RstFileHeaderTransformer.java +++ b/src/main/java/org/codehaus/mojo/license/header/transformer/RstFileHeaderTransformer.java @@ -33,23 +33,19 @@ */ @Named("rst") @Singleton -public class RstFileHeaderTransformer - extends AbstractFileHeaderTransformer -{ +public class RstFileHeaderTransformer extends AbstractFileHeaderTransformer { /** * Default constructor. */ - public RstFileHeaderTransformer() - { - super( "rst", "header transformer with rst comment style", ".. -", ".. -", ".. * " ); + public RstFileHeaderTransformer() { + super("rst", "header transformer with rst comment style", ".. -", ".. -", ".. * "); } /** * {@inheritDoc} */ - public String[] getDefaultAcceptedExtensions() - { - return new String[]{ "rst" }; + public String[] getDefaultAcceptedExtensions() { + return new String[] {"rst"}; } } diff --git a/src/main/java/org/codehaus/mojo/license/header/transformer/SqlFileHeaderTransformer.java b/src/main/java/org/codehaus/mojo/license/header/transformer/SqlFileHeaderTransformer.java index b56e9f949..74ce7a2b4 100644 --- a/src/main/java/org/codehaus/mojo/license/header/transformer/SqlFileHeaderTransformer.java +++ b/src/main/java/org/codehaus/mojo/license/header/transformer/SqlFileHeaderTransformer.java @@ -33,23 +33,19 @@ */ @Named("sql") @Singleton -public class SqlFileHeaderTransformer - extends AbstractFileHeaderTransformer -{ +public class SqlFileHeaderTransformer extends AbstractFileHeaderTransformer { /** * Default constructor. */ - public SqlFileHeaderTransformer() - { - super( "sql", "header transformer with sql comment style", "---", "---", "-- " ); + public SqlFileHeaderTransformer() { + super("sql", "header transformer with sql comment style", "---", "---", "-- "); } /** * {@inheritDoc} */ - public String[] getDefaultAcceptedExtensions() - { - return new String[]{ "sql" }; + public String[] getDefaultAcceptedExtensions() { + return new String[] {"sql"}; } } diff --git a/src/main/java/org/codehaus/mojo/license/header/transformer/XmlFileHeaderTransformer.java b/src/main/java/org/codehaus/mojo/license/header/transformer/XmlFileHeaderTransformer.java index 0bee8abd8..4f64effff 100644 --- a/src/main/java/org/codehaus/mojo/license/header/transformer/XmlFileHeaderTransformer.java +++ b/src/main/java/org/codehaus/mojo/license/header/transformer/XmlFileHeaderTransformer.java @@ -33,64 +33,53 @@ */ @Named("xml") @Singleton -public class XmlFileHeaderTransformer - extends AbstractFileHeaderTransformer -{ +public class XmlFileHeaderTransformer extends AbstractFileHeaderTransformer { /** * Default constructor. */ - public XmlFileHeaderTransformer() - { - super( "xml", "header transformer with xml comment style", "", " " ); + public XmlFileHeaderTransformer() { + super("xml", "header transformer with xml comment style", "", " "); } /** * {@inheritDoc} */ - public String[] getDefaultAcceptedExtensions() - { - return new String[]{ "pom", "xml", "mxlm", "dtd", "fml", "xsl", "jaxx", "kml", "gsp", - "tml", "svg" }; + public String[] getDefaultAcceptedExtensions() { + return new String[] {"pom", "xml", "mxlm", "dtd", "fml", "xsl", "jaxx", "kml", "gsp", "tml", "svg"}; } /** * {@inheritDoc} */ @Override - public String addHeader( String header, String content ) - { + public String addHeader(String header, String content) { String result; String prolog = null; - int startProlog = content.indexOf( " -1 ) - { + int startProlog = content.indexOf(" -1) { // prolog start was detected - int endProlog = content.indexOf( "?>", startProlog ); + int endProlog = content.indexOf("?>", startProlog); - if ( endProlog > -1 ) - { + if (endProlog > -1) { // prolog end was detected - prolog = content.substring( 0, endProlog + 2 ); + prolog = content.substring(0, endProlog + 2); } } - if ( prolog == null ) - { + if (prolog == null) { // no prolog detected - result = super.addHeader( header, content ); - } - else - { + result = super.addHeader(header, content); + } else { // prolog detected - content = content.substring( prolog.length() ); - result = super.addHeader( prolog + LINE_SEPARATOR + header, content ); + content = content.substring(prolog.length()); + result = super.addHeader(prolog + LINE_SEPARATOR + header, content); } return result; } diff --git a/src/main/java/org/codehaus/mojo/license/model/Copyright.java b/src/main/java/org/codehaus/mojo/license/model/Copyright.java index 9f57ea188..077cb43cd 100644 --- a/src/main/java/org/codehaus/mojo/license/model/Copyright.java +++ b/src/main/java/org/codehaus/mojo/license/model/Copyright.java @@ -33,8 +33,7 @@ * @author tchemit dev@tchemit.fr * @since 1.6 */ -public class Copyright -{ +public class Copyright { /** * Default copyright to string format. @@ -62,59 +61,52 @@ public class Copyright */ protected Integer lastYear; - public static Copyright newCopyright( String copyrightToStringFormat, - Integer inceptionYear, Integer lastYear, String holder ) - { + public static Copyright newCopyright( + String copyrightToStringFormat, Integer inceptionYear, Integer lastYear, String holder) { int firstYear = inceptionYear == null ? lastYear : inceptionYear; - if ( lastYear == null || firstYear >= lastYear ) - { + if (lastYear == null || firstYear >= lastYear) { lastYear = null; } - if ( copyrightToStringFormat == null ) - { - return newCopyright( DEFAULT_COPYRIGHT_TO_STRING_FORMAT, firstYear, lastYear, holder ); + if (copyrightToStringFormat == null) { + return newCopyright(DEFAULT_COPYRIGHT_TO_STRING_FORMAT, firstYear, lastYear, holder); } - Copyright result = new Copyright( copyrightToStringFormat, firstYear, lastYear, holder ); + Copyright result = new Copyright(copyrightToStringFormat, firstYear, lastYear, holder); return result; } - public static Copyright newCopyright( Integer inceptionYear, Integer lastYear, String holder ) - { - return newCopyright( DEFAULT_COPYRIGHT_TO_STRING_FORMAT, inceptionYear, lastYear, holder ); + public static Copyright newCopyright(Integer inceptionYear, Integer lastYear, String holder) { + return newCopyright(DEFAULT_COPYRIGHT_TO_STRING_FORMAT, inceptionYear, lastYear, holder); } - public static Copyright newCopyright( String copyrightToStringFormat, Integer inceptionYear, String holder ) - { + public static Copyright newCopyright(String copyrightToStringFormat, Integer inceptionYear, String holder) { Calendar cal = Calendar.getInstance(); - cal.setTime( new Date() ); - Integer lastYear = cal.get( Calendar.YEAR ); + cal.setTime(new Date()); + Integer lastYear = cal.get(Calendar.YEAR); - return newCopyright( copyrightToStringFormat, inceptionYear, lastYear, holder ); + return newCopyright(copyrightToStringFormat, inceptionYear, lastYear, holder); } - public static Copyright newCopyright( Integer inceptionYear, String holder ) - { + public static Copyright newCopyright(Integer inceptionYear, String holder) { Calendar cal = Calendar.getInstance(); - cal.setTime( new Date() ); - Integer lastYear = cal.get( Calendar.YEAR ); + cal.setTime(new Date()); + Integer lastYear = cal.get(Calendar.YEAR); - return newCopyright( inceptionYear, lastYear, holder ); + return newCopyright(inceptionYear, lastYear, holder); } - public Copyright() - { - } + public Copyright() {} - public Copyright( Copyright copyright ) - { - this( copyright.getCopyrightToStringFormat(), copyright.getFirstYear(), - copyright.getLastYear(), copyright.getHolder() ); + public Copyright(Copyright copyright) { + this( + copyright.getCopyrightToStringFormat(), + copyright.getFirstYear(), + copyright.getLastYear(), + copyright.getHolder()); } - public Copyright( String copyrightToStringFormat, int firstYear, Integer lastYear, String holder ) - { + public Copyright(String copyrightToStringFormat, int firstYear, Integer lastYear, String holder) { this.copyrightToStringFormat = copyrightToStringFormat; this.firstYear = firstYear; this.lastYear = lastYear; @@ -124,24 +116,21 @@ public Copyright( String copyrightToStringFormat, int firstYear, Integer lastYea /** * @return the copyright to string format */ - public String getCopyrightToStringFormat() - { + public String getCopyrightToStringFormat() { return copyrightToStringFormat; } /** * @return the copyright holder */ - public String getHolder() - { + public String getHolder() { return holder; } /** * @return the first year of the copyright */ - public Integer getFirstYear() - { + public Integer getFirstYear() { return firstYear; } @@ -149,8 +138,7 @@ public Integer getFirstYear() * @return the last year of the copyright (if copyright affects only one * year, can be equals to the {@link #getFirstYear()}). */ - public Integer getLastYear() - { + public Integer getLastYear() { return lastYear; } @@ -169,17 +157,13 @@ public Integer getLastYear() * * @return the String representation of the copyright year range. */ - public String getYears() - { + public String getYears() { String years; - if ( getLastYear() == null ) - { + if (getLastYear() == null) { // copyright on one year - years = String.valueOf( getFirstYear() ); - } - else - { + years = String.valueOf(getFirstYear()); + } else { // copyright on more than one year years = getFirstYear() + " - " + getLastYear(); @@ -202,36 +186,29 @@ public String getYears() * * @return the String representation of the copyright */ - public String getText() - { - String copyright = String.format( getCopyrightToStringFormat(), getYears(), getHolder() ); + public String getText() { + String copyright = String.format(getCopyrightToStringFormat(), getYears(), getHolder()); return copyright; } @Override - public boolean equals( Object o ) - { - if ( this == o ) - { + public boolean equals(Object o) { + if (this == o) { return true; } - if ( !( o instanceof Copyright ) ) - { + if (!(o instanceof Copyright)) { return false; } Copyright copyright = (Copyright) o; - if ( firstYear != copyright.firstYear ) - { + if (firstYear != copyright.firstYear) { return false; } - if ( holder != null ? !holder.equals( copyright.holder ) : copyright.holder != null ) - { + if (holder != null ? !holder.equals(copyright.holder) : copyright.holder != null) { return false; } - if ( lastYear != null ? !lastYear.equals( copyright.lastYear ) : copyright.lastYear != null ) - { + if (lastYear != null ? !lastYear.equals(copyright.lastYear) : copyright.lastYear != null) { return false; } @@ -239,17 +216,15 @@ public boolean equals( Object o ) } @Override - public int hashCode() - { + public int hashCode() { int result = holder != null ? holder.hashCode() : 0; result = 31 * result + firstYear; - result = 31 * result + ( lastYear != null ? lastYear.hashCode() : 0 ); + result = 31 * result + (lastYear != null ? lastYear.hashCode() : 0); return result; } @Override - public String toString() - { + public String toString() { return getText(); } } diff --git a/src/main/java/org/codehaus/mojo/license/model/License.java b/src/main/java/org/codehaus/mojo/license/model/License.java index 697167f7f..12169ce6e 100644 --- a/src/main/java/org/codehaus/mojo/license/model/License.java +++ b/src/main/java/org/codehaus/mojo/license/model/License.java @@ -22,25 +22,24 @@ * #L% */ -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import org.codehaus.mojo.license.utils.MojoHelper; -import org.codehaus.plexus.util.IOUtil; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.codehaus.mojo.license.utils.MojoHelper; +import org.codehaus.plexus.util.IOUtil; + /** * The model of a license. * * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class License -{ +public class License { public static final String LICENSE_HEADER_FILE = "header.txt"; @@ -73,112 +72,84 @@ public class License */ protected URL headerURL; - public License() - { - } + public License() {} - public String getName() - { + public String getName() { return name; } - public URL getLicenseURL() - { - if ( licenseURL == null ) - { - licenseURL = MojoHelper.getUrl( getBaseURL(), LICENSE_CONTENT_FILE ); + public URL getLicenseURL() { + if (licenseURL == null) { + licenseURL = MojoHelper.getUrl(getBaseURL(), LICENSE_CONTENT_FILE); } return licenseURL; } - public URL getHeaderURL() - { - if ( headerURL == null ) - { - headerURL = MojoHelper.getUrl( getBaseURL(), LICENSE_HEADER_FILE ); + public URL getHeaderURL() { + if (headerURL == null) { + headerURL = MojoHelper.getUrl(getBaseURL(), LICENSE_HEADER_FILE); } return headerURL; } - public String getDescription() - { + public String getDescription() { return description; } - public URL getBaseURL() - { + public URL getBaseURL() { return baseURL; } - public boolean isHeaderContentTemplateAware() - { - return getHeaderURL().toString().endsWith( TEMPLATE_SUFFIX ); + public boolean isHeaderContentTemplateAware() { + return getHeaderURL().toString().endsWith(TEMPLATE_SUFFIX); } - public boolean isLicenseContentTemplateAware() - { - return getLicenseURL().toString().endsWith( TEMPLATE_SUFFIX ); + public boolean isLicenseContentTemplateAware() { + return getLicenseURL().toString().endsWith(TEMPLATE_SUFFIX); } - public String getLicenseContent( String encoding ) - throws IOException - { - if ( baseURL == null ) - { - throw new IllegalStateException( "no baseURL defined, can not obtain license content in " + this ); + public String getLicenseContent(String encoding) throws IOException { + if (baseURL == null) { + throw new IllegalStateException("no baseURL defined, can not obtain license content in " + this); } - Reader r = new BufferedReader( new InputStreamReader( getLicenseURL().openStream(), encoding ) ); - try - { - return IOUtil.toString( r ); - } - finally - { + Reader r = new BufferedReader(new InputStreamReader(getLicenseURL().openStream(), encoding)); + try { + return IOUtil.toString(r); + } finally { r.close(); } } - public String getHeaderContent( String encoding ) - throws IOException - { - if ( baseURL == null ) - { - throw new IllegalStateException( "no baseURL defined, can not obtain header content in " + this ); - } - Reader r = new BufferedReader( new InputStreamReader( getHeaderURL().openStream(), encoding ) ); - try - { - return IOUtil.toString( r ); + public String getHeaderContent(String encoding) throws IOException { + if (baseURL == null) { + throw new IllegalStateException("no baseURL defined, can not obtain header content in " + this); } - finally - { + Reader r = new BufferedReader(new InputStreamReader(getHeaderURL().openStream(), encoding)); + try { + return IOUtil.toString(r); + } finally { r.close(); } } - public void setName( String name ) - { + public void setName(String name) { this.name = name; } - public void setDescription( String description ) - { + public void setDescription(String description) { this.description = description; } - public void setBaseURL( URL baseURL ) - { + public void setBaseURL(URL baseURL) { this.baseURL = baseURL; } - public void setLicenseURL( URL licenseURL ) - { + public void setLicenseURL(URL licenseURL) { this.licenseURL = licenseURL; } - public void setHeaderURL( URL headerURL ) - { + public void setHeaderURL(URL headerURL) { this.headerURL = headerURL; } @@ -186,13 +157,12 @@ public void setHeaderURL( URL headerURL ) * {@inheritDoc} */ @Override - public String toString() - { - ToStringBuilder builder = new ToStringBuilder( this, ToStringStyle.MULTI_LINE_STYLE ); - builder.append( "name", name ); - builder.append( "description", description ); - builder.append( "licenseURL", licenseURL ); - builder.append( "headerURL", headerURL ); + public String toString() { + ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE); + builder.append("name", name); + builder.append("description", description); + builder.append("licenseURL", licenseURL); + builder.append("headerURL", headerURL); return builder.toString(); } } diff --git a/src/main/java/org/codehaus/mojo/license/model/LicenseMap.java b/src/main/java/org/codehaus/mojo/license/model/LicenseMap.java index ca67f6ab0..db66a654e 100644 --- a/src/main/java/org/codehaus/mojo/license/model/LicenseMap.java +++ b/src/main/java/org/codehaus/mojo/license/model/LicenseMap.java @@ -22,9 +22,6 @@ * #L% */ -import org.apache.maven.project.MavenProject; -import org.codehaus.mojo.license.utils.MojoHelper; - import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -37,15 +34,16 @@ import java.util.TreeMap; import java.util.TreeSet; +import org.apache.maven.project.MavenProject; +import org.codehaus.mojo.license.utils.MojoHelper; + /** * Map of artifacts (stub in mavenproject) grouped by their license. * * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class LicenseMap - extends TreeMap> -{ +public class LicenseMap extends TreeMap> { private static final long serialVersionUID = 864199843545688069L; @@ -56,13 +54,11 @@ public class LicenseMap /** * Default contructor. */ - public LicenseMap() - { - this( MojoHelper.newMavenProjectComparator() ); + public LicenseMap() { + this(MojoHelper.newMavenProjectComparator()); } - public LicenseMap( Comparator projectComparator ) - { + public LicenseMap(Comparator projectComparator) { this.projectComparator = projectComparator; } @@ -73,19 +69,17 @@ public LicenseMap( Comparator projectComparator ) * @param value project to register in the license map * @return the set of projects using the given license */ - public SortedSet put( String key, MavenProject value ) - { + public SortedSet put(String key, MavenProject value) { // handle multiple values as a set to avoid duplicates - SortedSet valueList = get( key ); - if ( valueList == null ) - { + SortedSet valueList = get(key); + if (valueList == null) { - valueList = new TreeSet<>( projectComparator ); + valueList = new TreeSet<>(projectComparator); } - valueList.add( value ); - return put( key, valueList ); + valueList.add(value); + return put(key, valueList); } /** @@ -93,25 +87,21 @@ public SortedSet put( String key, MavenProject value ) * * @param licenseMap license map to put */ - public void putAll( LicenseMap licenseMap ) - { - for ( Map.Entry> entry : licenseMap.entrySet() ) - { + public void putAll(LicenseMap licenseMap) { + for (Map.Entry> entry : licenseMap.entrySet()) { String key = entry.getKey(); // handle multiple values as a set to avoid duplicates - SortedSet valueList = get( key ); - if ( valueList == null ) - { + SortedSet valueList = get(key); + if (valueList == null) { - valueList = new TreeSet<>( projectComparator ); + valueList = new TreeSet<>(projectComparator); } - valueList.addAll( entry.getValue() ); - put( key, valueList ); + valueList.addAll(entry.getValue()); + put(key, valueList); } - } /** @@ -120,41 +110,35 @@ public void putAll( LicenseMap licenseMap ) * * @return the generated dependencies map */ - public SortedMap toDependencyMap() - { - SortedMap> tmp = new TreeMap<>( projectComparator ); + public SortedMap toDependencyMap() { + SortedMap> tmp = new TreeMap<>(projectComparator); - for ( Map.Entry> entry : entrySet() ) - { + for (Map.Entry> entry : entrySet()) { String license = entry.getKey(); SortedSet set = entry.getValue(); - for ( MavenProject p : set ) - { - Set list = tmp.get( p ); - if ( list == null ) - { + for (MavenProject p : set) { + Set list = tmp.get(p); + if (list == null) { list = new HashSet<>(); - tmp.put( p, list ); + tmp.put(p, list); } - list.add( license ); + list.add(license); } } - SortedMap result = new TreeMap<>( projectComparator ); - for ( Map.Entry> entry : tmp.entrySet() ) - { - List value = new ArrayList<>( entry.getValue() ); - Collections.sort( value ); - result.put( entry.getKey(), value.toArray( new String[value.size()] ) ); + SortedMap result = new TreeMap<>(projectComparator); + for (Map.Entry> entry : tmp.entrySet()) { + List value = new ArrayList<>(entry.getValue()); + Collections.sort(value); + result.put(entry.getKey(), value.toArray(new String[value.size()])); } tmp.clear(); return result; } - public LicenseMap toLicenseMapOrderByName() - { - LicenseMap result = new LicenseMap( MojoHelper.newMavenProjectComparatorByName() ); - result.putAll( this ); + public LicenseMap toLicenseMapOrderByName() { + LicenseMap result = new LicenseMap(MojoHelper.newMavenProjectComparatorByName()); + result.putAll(this); return result; } @@ -163,25 +147,20 @@ public LicenseMap toLicenseMapOrderByName() * @param project * @return a List of license names that the given project was mapped to */ - public List removeProject( MavenProject project ) - { + public List removeProject(MavenProject project) { List removedFrom = new ArrayList<>(); - for ( Map.Entry> entry : entrySet() ) - { + for (Map.Entry> entry : entrySet()) { SortedSet projects = entry.getValue(); - for ( MavenProject mavenProject : projects ) - { - if ( project.equals( mavenProject ) ) - { - removedFrom.add( entry.getKey() ); + for (MavenProject mavenProject : projects) { + if (project.equals(mavenProject)) { + removedFrom.add(entry.getKey()); break; } } } - for ( String r : removedFrom ) - { - get( r ).remove( project ); + for (String r : removedFrom) { + get(r).remove(project); } return removedFrom; diff --git a/src/main/java/org/codehaus/mojo/license/model/LicenseRepository.java b/src/main/java/org/codehaus/mojo/license/model/LicenseRepository.java index 936cae508..0fc4676c5 100644 --- a/src/main/java/org/codehaus/mojo/license/model/LicenseRepository.java +++ b/src/main/java/org/codehaus/mojo/license/model/LicenseRepository.java @@ -22,11 +22,6 @@ * #L% */ -import org.apache.commons.lang3.StringUtils; -import org.codehaus.mojo.license.utils.MojoHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.IOException; import java.net.URL; import java.net.URLConnection; @@ -39,19 +34,22 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.lang3.StringUtils; +import org.codehaus.mojo.license.utils.MojoHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class LicenseRepository - implements Iterable -{ - private static final Logger LOG = LoggerFactory.getLogger( LicenseRepository.class ); +public class LicenseRepository implements Iterable { + private static final Logger LOG = LoggerFactory.getLogger(LicenseRepository.class); public static final String REPOSITORY_DEFINITION_FILE = "licenses.properties"; public static final Pattern LICENSE_DESCRIPTION_PATTERN = - Pattern.compile( "(.*)\\s*~~\\s*license\\s*:\\s*(.*)\\s*~~\\s*header\\s*:\\s*(.*)\\s*" ); + Pattern.compile("(.*)\\s*~~\\s*license\\s*:\\s*(.*)\\s*~~\\s*header\\s*:\\s*(.*)\\s*"); /** * the base url of the licenses repository. @@ -69,136 +67,111 @@ public class LicenseRepository */ protected boolean init; - public URL getBaseURL() - { + public URL getBaseURL() { return baseURL; } - public void setBaseURL( URL baseURL ) - { - checkNotInit( "setBaseURL" ); + public void setBaseURL(URL baseURL) { + checkNotInit("setBaseURL"); this.baseURL = baseURL; } - protected URL getDefinitionURL() - { - if ( baseURL == null || StringUtils.isEmpty( baseURL.toString() ) ) - { - throw new IllegalStateException( "no baseURL defined in " + this ); + protected URL getDefinitionURL() { + if (baseURL == null || StringUtils.isEmpty(baseURL.toString())) { + throw new IllegalStateException("no baseURL defined in " + this); } - URL definitionURL = MojoHelper.getUrl( getBaseURL(), REPOSITORY_DEFINITION_FILE ); + URL definitionURL = MojoHelper.getUrl(getBaseURL(), REPOSITORY_DEFINITION_FILE); return definitionURL; } - protected URL getLicenseBaseURL( String licenseName ) - { - URL licenseBaseURL = MojoHelper.getUrl( baseURL, licenseName ); + protected URL getLicenseBaseURL(String licenseName) { + URL licenseBaseURL = MojoHelper.getUrl(baseURL, licenseName); return licenseBaseURL; } - public void load() - throws IOException - { - checkNotInit( "load" ); - try - { + public void load() throws IOException { + checkNotInit("load"); + try { URL definitionURL = getDefinitionURL(); - if ( licenses != null ) - { + if (licenses != null) { licenses.clear(); - } - else - { + } else { licenses = new ArrayList<>(); } - if ( !checkExists( definitionURL ) ) - { + if (!checkExists(definitionURL)) { throw new IllegalArgumentException( - "no licenses.properties found with url [" + definitionURL + "] for resolver " + this ); + "no licenses.properties found with url [" + definitionURL + "] for resolver " + this); } Properties p = new Properties(); - p.load( definitionURL.openStream() ); + p.load(definitionURL.openStream()); - for ( Entry entry : p.entrySet() ) - { + for (Entry entry : p.entrySet()) { String licenseName = (String) entry.getKey(); licenseName = licenseName.trim().toLowerCase(); - URL licenseBaseURL = getLicenseBaseURL( licenseName ); + URL licenseBaseURL = getLicenseBaseURL(licenseName); License license = new License(); - license.setName( licenseName ); - license.setBaseURL( licenseBaseURL ); + license.setName(licenseName); + license.setBaseURL(licenseBaseURL); String licenseDescription = (String) entry.getValue(); - Matcher matcher = LICENSE_DESCRIPTION_PATTERN.matcher( licenseDescription ); + Matcher matcher = LICENSE_DESCRIPTION_PATTERN.matcher(licenseDescription); String licenseFile; String headerFile; - if ( matcher.matches() ) - { - licenseDescription = matcher.group( 1 ).trim(); - licenseFile = matcher.group( 2 ).trim(); - headerFile = matcher.group( 3 ).trim(); - } - else - { + if (matcher.matches()) { + licenseDescription = matcher.group(1).trim(); + licenseFile = matcher.group(2).trim(); + headerFile = matcher.group(3).trim(); + } else { licenseFile = License.LICENSE_CONTENT_FILE; headerFile = License.LICENSE_HEADER_FILE; } - URL licenseFileURL = getFileURL( license, licenseFile ); - license.setLicenseURL( licenseFileURL ); - URL headerFileURL = getFileURL( license, headerFile ); - license.setHeaderURL( headerFileURL ); + URL licenseFileURL = getFileURL(license, licenseFile); + license.setLicenseURL(licenseFileURL); + URL headerFileURL = getFileURL(license, headerFile); + license.setHeaderURL(headerFileURL); - license.setDescription( licenseDescription ); + license.setDescription(licenseDescription); - LOG.info( "register {}", license.getDescription() ); - LOG.debug( "{}", license ); - licenses.add( license ); + LOG.info("register {}", license.getDescription()); + LOG.debug("{}", license); + licenses.add(license); } - licenses = Collections.unmodifiableList( licenses ); - } - finally - { + licenses = Collections.unmodifiableList(licenses); + } finally { // mark repository as available init = true; } } - public String[] getLicenseNames() - { - checkInit( "getLicenseNames" ); - List result = new ArrayList<>( licenses.size() ); - for ( License license : this ) - { - result.add( license.getName() ); + public String[] getLicenseNames() { + checkInit("getLicenseNames"); + List result = new ArrayList<>(licenses.size()); + for (License license : this) { + result.add(license.getName()); } - return result.toArray( new String[result.size()] ); + return result.toArray(new String[result.size()]); } - public License[] getLicenses() - { - checkInit( "getLicenses" ); - return licenses.toArray( new License[licenses.size()] ); + public License[] getLicenses() { + checkInit("getLicenses"); + return licenses.toArray(new License[licenses.size()]); } - public License getLicense( String licenseName ) - { - checkInit( "getLicense" ); - if ( StringUtils.isEmpty( licenseName ) ) - { - throw new IllegalArgumentException( "licenceName can not be null, nor empty" ); + public License getLicense(String licenseName) { + checkInit("getLicense"); + if (StringUtils.isEmpty(licenseName)) { + throw new IllegalArgumentException("licenceName can not be null, nor empty"); } License license = null; - for ( License l : this ) - { - if ( licenseName.equals( l.getName() ) ) - { + for (License l : this) { + if (licenseName.equals(l.getName())) { // got it license = l; break; @@ -210,57 +183,43 @@ public License getLicense( String licenseName ) /** * {@inheritDoc} */ - public Iterator iterator() - { - checkInit( "iterator" ); + public Iterator iterator() { + checkInit("iterator"); return licenses.iterator(); } - protected boolean checkExists( URL url ) - throws IOException - { + protected boolean checkExists(URL url) throws IOException { URLConnection openConnection = url.openConnection(); return openConnection.getContentLength() > 0; } - protected void checkInit( String operation ) - { - if ( !init ) - { + protected void checkInit(String operation) { + if (!init) { throw new IllegalStateException( - "repository " + this + " was not init, operation [" + operation + "] not possible." ); + "repository " + this + " was not init, operation [" + operation + "] not possible."); } } - protected void checkNotInit( String operation ) - { - if ( init ) - { + protected void checkNotInit(String operation) { + if (init) { throw new IllegalStateException( - "repository " + this + "was init, operation [" + operation + "+] not possible." ); + "repository " + this + "was init, operation [" + operation + "+] not possible."); } } - protected URL getFileURL( License license, String filename ) - throws IOException - { + protected URL getFileURL(License license, String filename) throws IOException { URL licenseBaseURL = license.getBaseURL(); - URL result = MojoHelper.getUrl( licenseBaseURL, filename ); - if ( !checkExists( result ) ) - { + URL result = MojoHelper.getUrl(licenseBaseURL, filename); + if (!checkExists(result)) { // let's try with a .ftl suffix - URL resultWithFtlSuffix = MojoHelper.getUrl( licenseBaseURL, filename + License.TEMPLATE_SUFFIX ); + URL resultWithFtlSuffix = MojoHelper.getUrl(licenseBaseURL, filename + License.TEMPLATE_SUFFIX); - if ( checkExists( resultWithFtlSuffix ) ) - { + if (checkExists(resultWithFtlSuffix)) { result = resultWithFtlSuffix; - } - else - { - throw new IllegalArgumentException( - "Could not find license (" + license + ") content file at [" + result + "], nor at [" - + resultWithFtlSuffix + "] for resolver " + this ); + } else { + throw new IllegalArgumentException("Could not find license (" + license + ") content file at [" + result + + "], nor at [" + resultWithFtlSuffix + "] for resolver " + this); } } return result; diff --git a/src/main/java/org/codehaus/mojo/license/model/LicenseStore.java b/src/main/java/org/codehaus/mojo/license/model/LicenseStore.java index 294bde270..58af4066a 100644 --- a/src/main/java/org/codehaus/mojo/license/model/LicenseStore.java +++ b/src/main/java/org/codehaus/mojo/license/model/LicenseStore.java @@ -22,17 +22,17 @@ * #L% */ -import org.apache.commons.lang3.StringUtils; -import org.apache.maven.plugin.MojoExecutionException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.IOException; import java.net.URL; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import org.apache.commons.lang3.StringUtils; +import org.apache.maven.plugin.MojoExecutionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * The {@code LicenseStore} offers {@link License} coming from different {@link * LicenseRepository}. @@ -40,14 +40,12 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class LicenseStore - implements Iterable -{ +public class LicenseStore implements Iterable { /** * Logger. */ - private static final Logger LOG = LoggerFactory.getLogger( LicenseStore.class ); + private static final Logger LOG = LoggerFactory.getLogger(LicenseStore.class); /** * class-path directory where is the licenses repository. @@ -69,202 +67,152 @@ public class LicenseStore */ protected boolean init; - public static LicenseStore createLicenseStore( String... extraResolver ) - throws MojoExecutionException - { + public static LicenseStore createLicenseStore(String... extraResolver) throws MojoExecutionException { LicenseStore store; - try - { + try { store = new LicenseStore(); store.addJarRepository(); - if ( extraResolver != null ) - { - for ( String s : extraResolver ) - { - if ( StringUtils.isNotEmpty( s ) ) - { - LOG.info( "adding extra resolver {}", s ); - store.addRepository( s ); + if (extraResolver != null) { + for (String s : extraResolver) { + if (StringUtils.isNotEmpty(s)) { + LOG.info("adding extra resolver {}", s); + store.addRepository(s); } } } store.init(); - } - catch ( IllegalArgumentException ex ) - { - throw new MojoExecutionException( "could not obtain the license repository", ex ); - } - catch ( IOException ex ) - { - throw new MojoExecutionException( "could not obtain the license repository", ex ); + } catch (IllegalArgumentException ex) { + throw new MojoExecutionException("could not obtain the license repository", ex); + } catch (IOException ex) { + throw new MojoExecutionException("could not obtain the license repository", ex); } return store; } - public void init() - throws IOException - { - checkNotInit( "init" ); - try - { - if ( repositories == null ) - { + public void init() throws IOException { + checkNotInit("init"); + try { + if (repositories == null) { // adding the default class-path repository addJarRepository(); } - for ( LicenseRepository r : this ) - { + for (LicenseRepository r : this) { r.load(); } - } - finally - { + } finally { init = true; } } - public List getRepositories() - { + public List getRepositories() { return repositories; } - public String[] getLicenseNames() - { - checkInit( "getLicenseNames" ); + public String[] getLicenseNames() { + checkInit("getLicenseNames"); List result = new ArrayList<>(); - for ( LicenseRepository repository : this ) - { - for ( License license : repository ) - { - result.add( license.getName() ); + for (LicenseRepository repository : this) { + for (License license : repository) { + result.add(license.getName()); } } - return result.toArray( new String[result.size()] ); + return result.toArray(new String[result.size()]); } - public License[] getLicenses() - { - checkInit( "getLicenses" ); + public License[] getLicenses() { + checkInit("getLicenses"); List result = new ArrayList<>(); - if ( repositories != null ) - { - for ( LicenseRepository repository : this ) - { - for ( License license : repository ) - { - result.add( license ); + if (repositories != null) { + for (LicenseRepository repository : this) { + for (License license : repository) { + result.add(license); } } } - return result.toArray( new License[result.size()] ); + return result.toArray(new License[result.size()]); } - public License getLicense( String licenseName ) - { - checkInit( "getLicense" ); + public License getLicense(String licenseName) { + checkInit("getLicense"); Iterator itr = iterator(); License result = null; - while ( itr.hasNext() ) - { + while (itr.hasNext()) { LicenseRepository licenseRepository = itr.next(); - License license = licenseRepository.getLicense( licenseName ); - if ( license != null ) - { + License license = licenseRepository.getLicense(licenseName); + if (license != null) { result = license; break; } } - if ( result == null ) - { - LOG.debug( "could not find license named '{}'", licenseName ); + if (result == null) { + LOG.debug("could not find license named '{}'", licenseName); } return result; } - public void addRepository( String extraResolver ) - throws IOException - { + public void addRepository(String extraResolver) throws IOException { - if ( extraResolver.equals( CLASSPATH_PROTOCOL ) ) - { + if (extraResolver.equals(CLASSPATH_PROTOCOL)) { addRootPackageClassPathRepository(); - } - else if ( extraResolver.startsWith( CLASSPATH_PROTOCOL ) ) - { - extraResolver = extraResolver.substring( CLASSPATH_PROTOCOL.length() ); - LOG.info( "Using classpath extraresolver: {}", extraResolver ); - URL baseURL = getClass().getClassLoader().getResource( extraResolver ); - addRepository( baseURL ); - } - else - { - URL baseURL = new URL( extraResolver ); - addRepository( baseURL ); + } else if (extraResolver.startsWith(CLASSPATH_PROTOCOL)) { + extraResolver = extraResolver.substring(CLASSPATH_PROTOCOL.length()); + LOG.info("Using classpath extraresolver: {}", extraResolver); + URL baseURL = getClass().getClassLoader().getResource(extraResolver); + addRepository(baseURL); + } else { + URL baseURL = new URL(extraResolver); + addRepository(baseURL); } } - public void addRepository( URL baseURL ) - throws IOException - { - checkNotInit( "addRepository" ); + public void addRepository(URL baseURL) throws IOException { + checkNotInit("addRepository"); LicenseRepository repository = new LicenseRepository(); - repository.setBaseURL( baseURL ); - LOG.debug( "Adding a license repository {}", repository ); - addRepository( repository ); + repository.setBaseURL(baseURL); + LOG.debug("Adding a license repository {}", repository); + addRepository(repository); } - public void addJarRepository() - throws IOException - { - checkNotInit( "addJarRepository" ); - URL baseURL = getClass().getResource( JAR_LICENSE_REPOSITORY ); + public void addJarRepository() throws IOException { + checkNotInit("addJarRepository"); + URL baseURL = getClass().getResource(JAR_LICENSE_REPOSITORY); LicenseRepository repository = new LicenseRepository(); - repository.setBaseURL( baseURL ); - LOG.debug( "Adding a jar license repository {}", repository ); - addRepository( repository ); + repository.setBaseURL(baseURL); + LOG.debug("Adding a jar license repository {}", repository); + addRepository(repository); } - public void addRootPackageClassPathRepository() - throws IOException - { - checkNotInit( "addRootPackageClassPathRepository" ); - LOG.debug( "Adding a no package class path license repository " ); - addRepository( new RootPackageClassPathLicenseRepository() ); + public void addRootPackageClassPathRepository() throws IOException { + checkNotInit("addRootPackageClassPathRepository"); + LOG.debug("Adding a no package class path license repository "); + addRepository(new RootPackageClassPathLicenseRepository()); } /** * {@inheritDoc} */ - public Iterator iterator() - { + public Iterator iterator() { return getRepositories().iterator(); } - protected void addRepository( LicenseRepository repository ) - { - checkNotInit( "addRepository" ); - if ( repositories == null ) - { + protected void addRepository(LicenseRepository repository) { + checkNotInit("addRepository"); + if (repositories == null) { repositories = new ArrayList<>(); - } - LOG.info( "Adding a license repository {}", repository.getBaseURL() ); - repositories.add( repository ); + LOG.info("Adding a license repository {}", repository.getBaseURL()); + repositories.add(repository); } - protected void checkInit( String operation ) - { - if ( !init ) - { - throw new IllegalStateException( "store was not init, operation [" + operation + "] not possible." ); + protected void checkInit(String operation) { + if (!init) { + throw new IllegalStateException("store was not init, operation [" + operation + "] not possible."); } } - protected void checkNotInit( String operation ) - { - if ( init ) - { - throw new IllegalStateException( "store was init, operation [" + operation + "+] not possible." ); + protected void checkNotInit(String operation) { + if (init) { + throw new IllegalStateException("store was init, operation [" + operation + "+] not possible."); } } } diff --git a/src/main/java/org/codehaus/mojo/license/model/RootPackageClassPathLicenseRepository.java b/src/main/java/org/codehaus/mojo/license/model/RootPackageClassPathLicenseRepository.java index 2c76e5006..878103c7f 100644 --- a/src/main/java/org/codehaus/mojo/license/model/RootPackageClassPathLicenseRepository.java +++ b/src/main/java/org/codehaus/mojo/license/model/RootPackageClassPathLicenseRepository.java @@ -31,20 +31,15 @@ * @author Tony Chemit - dev@tchemit.fr * @since 1.9 */ -public class RootPackageClassPathLicenseRepository - extends LicenseRepository -{ +public class RootPackageClassPathLicenseRepository extends LicenseRepository { @Override - protected URL getDefinitionURL() - { - return getClass().getClassLoader().getResource( REPOSITORY_DEFINITION_FILE ); + protected URL getDefinitionURL() { + return getClass().getClassLoader().getResource(REPOSITORY_DEFINITION_FILE); } @Override - protected URL getLicenseBaseURL( String licenseName ) - { - return getClass().getClassLoader().getResource( licenseName ); + protected URL getLicenseBaseURL(String licenseName) { + return getClass().getClassLoader().getResource(licenseName); } - } diff --git a/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseInfo.java b/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseInfo.java index e633db3c8..f8ed6e5f4 100644 --- a/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseInfo.java +++ b/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseInfo.java @@ -38,8 +38,7 @@ * @author Peter Palaga * @since 1.18 */ -public class SpdxLicenseInfo -{ +public class SpdxLicenseInfo { private final String reference; private final boolean isDeprecatedLicenseId; @@ -58,16 +57,21 @@ public class SpdxLicenseInfo private final Attachments attachments; - public static Builder builder() - { + public static Builder builder() { return new Builder(); } // CHECKSTYLE_OFF: ParameterNumber - public SpdxLicenseInfo( String reference, boolean isDeprecatedLicenseId, boolean isFsfLibre, String detailsUrl, - String name, String licenseId, List seeAlso, - boolean isOsiApproved, Attachments attachments ) - { + public SpdxLicenseInfo( + String reference, + boolean isDeprecatedLicenseId, + boolean isFsfLibre, + String detailsUrl, + String name, + String licenseId, + List seeAlso, + boolean isOsiApproved, + Attachments attachments) { super(); this.reference = reference; this.isDeprecatedLicenseId = isDeprecatedLicenseId; @@ -80,51 +84,42 @@ public SpdxLicenseInfo( String reference, boolean isDeprecatedLicenseId, boolean this.attachments = attachments; } - public boolean isFsfLibre() - { + public boolean isFsfLibre() { return isFsfLibre; } - public String getReference() - { + public String getReference() { return reference; } - public boolean isDeprecatedLicenseId() - { + public boolean isDeprecatedLicenseId() { return isDeprecatedLicenseId; } - public String getDetailsUrl() - { + public String getDetailsUrl() { return detailsUrl; } - public String getName() - { + public String getName() { return name; } - public String getLicenseId() - { + public String getLicenseId() { return licenseId; } - public List getSeeAlso() - { + public List getSeeAlso() { return seeAlso; } - public boolean isOsiApproved() - { + public boolean isOsiApproved() { return isOsiApproved; } /** * @return the {@link Attachments} - i.e. the data that does not come directly from spdx.org */ - public Attachments getAttachments() - { + public Attachments getAttachments() { return attachments; } @@ -135,12 +130,10 @@ public Attachments getAttachments() * * @since 1.18 */ - public static class Attachments - { + public static class Attachments { private final Map urlInfos; - Attachments( Map urlInfos ) - { + Attachments(Map urlInfos) { super(); this.urlInfos = urlInfos; } @@ -148,8 +141,7 @@ public static class Attachments /** * @return a {@link Map} from URLs to {@link UrlInfo}s */ - public Map getUrlInfos() - { + public Map getUrlInfos() { return urlInfos; } @@ -158,8 +150,7 @@ public Map getUrlInfos() * * @since 1.18 */ - public static class UrlInfo - { + public static class UrlInfo { private final String sha1; private final String mimeType; @@ -168,8 +159,7 @@ public static class UrlInfo private final boolean sanitized; - public UrlInfo( String sha1, String mimeType, boolean stable, boolean sanitized ) - { + public UrlInfo(String sha1, String mimeType, boolean stable, boolean sanitized) { super(); this.sha1 = sha1; this.mimeType = mimeType; @@ -183,26 +173,22 @@ public UrlInfo( String sha1, String mimeType, boolean stable, boolean sanitized * {@link SpdxLicenseListData} and (2) for some sites it is set manually based on their historical * behavior. */ - public boolean isStable() - { + public boolean isStable() { return stable; } /** * @return the checksum computed after applying sanitizers at {@link SpdxLicenseListData} generation time. */ - public String getSha1() - { + public String getSha1() { return sha1; } - public String getMimeType() - { + public String getMimeType() { return mimeType; } - public boolean isSanitized() - { + public boolean isSanitized() { return sanitized; } } @@ -213,8 +199,7 @@ public boolean isSanitized() * * @since 1.18 */ - public static class Builder - { + public static class Builder { private Boolean isDeprecatedLicenseId; @@ -234,82 +219,78 @@ public static class Builder private Map urlInfos = new LinkedHashMap<>(); - public Builder isDeprecatedLicenseId( boolean isDeprecatedLicenseId ) - { + public Builder isDeprecatedLicenseId(boolean isDeprecatedLicenseId) { this.isDeprecatedLicenseId = isDeprecatedLicenseId; return this; } - public Builder isFsfLibre( boolean isFsfLibre ) - { + public Builder isFsfLibre(boolean isFsfLibre) { this.isFsfLibre = isFsfLibre; return this; } - public Builder detailsUrl( String detailsUrl ) - { + public Builder detailsUrl(String detailsUrl) { this.detailsUrl = detailsUrl; return this; } - public Builder reference( String reference ) - { + public Builder reference(String reference) { this.reference = reference; return this; } - public Builder name( String name ) - { + public Builder name(String name) { this.name = name; return this; } - public Builder licenseId( String licenseId ) - { + public Builder licenseId(String licenseId) { this.licenseId = licenseId; return this; } - public Builder seeAlso( String seeAlso ) - { - this.seeAlso.add( seeAlso ); + public Builder seeAlso(String seeAlso) { + this.seeAlso.add(seeAlso); return this; } - public Builder urlInfo( String url, String sha1, String mimeType, boolean stable, boolean sanitized ) - { - this.urlInfos.put( url, new UrlInfo( sha1, mimeType, stable, sanitized ) ); + public Builder urlInfo(String url, String sha1, String mimeType, boolean stable, boolean sanitized) { + this.urlInfos.put(url, new UrlInfo(sha1, mimeType, stable, sanitized)); return this; } - public Builder isOsiApproved( boolean isOsiApproved ) - { + public Builder isOsiApproved(boolean isOsiApproved) { this.isOsiApproved = isOsiApproved; return this; } - public SpdxLicenseInfo build() - { - Objects.requireNonNull( isDeprecatedLicenseId, "isDeprecatedLicenseId" ); - Objects.requireNonNull( detailsUrl, "detailsUrl" ); - Objects.requireNonNull( reference, "reference" ); - Objects.requireNonNull( name, "name" ); - Objects.requireNonNull( licenseId, "licenseId" ); - Objects.requireNonNull( isOsiApproved, "isOsiApproved" ); - if ( seeAlso.isEmpty() ) - { - throw new IllegalStateException( "seeAlso cannot be empty" ); + public SpdxLicenseInfo build() { + Objects.requireNonNull(isDeprecatedLicenseId, "isDeprecatedLicenseId"); + Objects.requireNonNull(detailsUrl, "detailsUrl"); + Objects.requireNonNull(reference, "reference"); + Objects.requireNonNull(name, "name"); + Objects.requireNonNull(licenseId, "licenseId"); + Objects.requireNonNull(isOsiApproved, "isOsiApproved"); + if (seeAlso.isEmpty()) { + throw new IllegalStateException("seeAlso cannot be empty"); } - final List sa = Collections.unmodifiableList( seeAlso ); + final List sa = Collections.unmodifiableList(seeAlso); seeAlso = null; - final Map uis = Collections.unmodifiableMap( urlInfos ); + final Map uis = Collections.unmodifiableMap(urlInfos); urlInfos = null; - return new SpdxLicenseInfo( reference, isDeprecatedLicenseId, isFsfLibre, detailsUrl, name, - licenseId, sa, isOsiApproved, new Attachments( uis ) ); + return new SpdxLicenseInfo( + reference, + isDeprecatedLicenseId, + isFsfLibre, + detailsUrl, + name, + licenseId, + sa, + isOsiApproved, + new Attachments(uis)); } - } } diff --git a/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseList.java b/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseList.java index d450057f9..2f13af840 100644 --- a/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseList.java +++ b/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseList.java @@ -40,20 +40,15 @@ * @author Peter Palaga * @since 1.18 */ -public class SpdxLicenseList -{ +public class SpdxLicenseList { private static volatile SpdxLicenseList latest; private static final Object LOCK = new Object(); - public static SpdxLicenseList getLatest() - { - if ( latest == null ) - { - synchronized ( LOCK ) - { - if ( latest == null ) - { + public static SpdxLicenseList getLatest() { + if (latest == null) { + synchronized (LOCK) { + if (latest == null) { latest = SpdxLicenseListData.createList(); } } @@ -69,14 +64,15 @@ public static SpdxLicenseList getLatest() private final Attachments attachments; - public static Builder builder() - { + public static Builder builder() { return new Builder(); } - SpdxLicenseList( String licenseListVersion, Map licenses, String releaseDate, - Attachments attachments ) - { + SpdxLicenseList( + String licenseListVersion, + Map licenses, + String releaseDate, + Attachments attachments) { super(); this.licenseListVersion = licenseListVersion; this.licenses = licenses; @@ -84,26 +80,22 @@ public static Builder builder() this.attachments = attachments; } - public String getLicenseListVersion() - { + public String getLicenseListVersion() { return licenseListVersion; } /** * @return an unmodifiable {@link Map} from license IDs to {@link SpdxLicenseInfo}. */ - public Map getLicenses() - { + public Map getLicenses() { return licenses; } - public String getReleaseDate() - { + public String getReleaseDate() { return releaseDate; } - public Attachments getAttachments() - { + public Attachments getAttachments() { return attachments; } @@ -111,83 +103,75 @@ public Attachments getAttachments() * * @since 1.20 */ - public static class Attachments - { + public static class Attachments { private final Map contentSanitizers; private final Map urlReplacements; - Attachments( Map contentSanitizers, Map urlReplacements ) - { + Attachments(Map contentSanitizers, Map urlReplacements) { super(); this.contentSanitizers = contentSanitizers; this.urlReplacements = urlReplacements; } - public Map getContentSanitizers() - { + public Map getContentSanitizers() { return contentSanitizers; } - public Map getUrlReplacements() - { + public Map getUrlReplacements() { return urlReplacements; } /** * @since 1.20 */ - public static class UrlReplacement - { - public static UrlReplacement compile( String id, String urlPattern, String replacement ) - { - Objects.requireNonNull( id, "id" ); - Objects.requireNonNull( urlPattern, "urlPattern" ); + public static class UrlReplacement { + public static UrlReplacement compile(String id, String urlPattern, String replacement) { + Objects.requireNonNull(id, "id"); + Objects.requireNonNull(urlPattern, "urlPattern"); replacement = replacement == null ? "" : replacement; - return new UrlReplacement( id, Pattern.compile( urlPattern, Pattern.CASE_INSENSITIVE ), replacement ); + return new UrlReplacement(id, Pattern.compile(urlPattern, Pattern.CASE_INSENSITIVE), replacement); } + private final String id; private final Pattern urlPattern; private final String replacement; - public UrlReplacement( String id, Pattern urlPattern, String replacement ) - { + + public UrlReplacement(String id, Pattern urlPattern, String replacement) { super(); this.id = id; this.urlPattern = urlPattern; this.replacement = replacement; } - public String getId() - { + + public String getId() { return id; } - public Pattern getUrlPattern() - { + + public Pattern getUrlPattern() { return urlPattern; } - public String getReplacement() - { + + public String getReplacement() { return replacement; } - } /** * @since 1.20 */ - public static class ContentSanitizer - { - public static ContentSanitizer compile( String id, String urlPattern, String contentPattern, - String contentReplacement ) - { - Objects.requireNonNull( id, "id" ); - Objects.requireNonNull( urlPattern, "urlPattern" ); - Objects.requireNonNull( contentPattern, "contentPattern" ); + public static class ContentSanitizer { + public static ContentSanitizer compile( + String id, String urlPattern, String contentPattern, String contentReplacement) { + Objects.requireNonNull(id, "id"); + Objects.requireNonNull(urlPattern, "urlPattern"); + Objects.requireNonNull(contentPattern, "contentPattern"); contentReplacement = contentReplacement == null ? "" : contentReplacement; - contentReplacement = StringEscapeUtils.unescapeJava( contentReplacement ); - return new ContentSanitizer( id, - Pattern.compile( urlPattern, Pattern.CASE_INSENSITIVE ), - Pattern.compile( contentPattern, - Pattern.CASE_INSENSITIVE ), - contentReplacement ); + contentReplacement = StringEscapeUtils.unescapeJava(contentReplacement); + return new ContentSanitizer( + id, + Pattern.compile(urlPattern, Pattern.CASE_INSENSITIVE), + Pattern.compile(contentPattern, Pattern.CASE_INSENSITIVE), + contentReplacement); } private final String id; @@ -195,50 +179,42 @@ public static ContentSanitizer compile( String id, String urlPattern, String con private final Pattern contentPattern; private final String contentReplacement; - public ContentSanitizer( String id, Pattern urlPattern, Pattern contentPattern, String contentReplacement ) - { + public ContentSanitizer(String id, Pattern urlPattern, Pattern contentPattern, String contentReplacement) { super(); - Objects.requireNonNull( id, "id" ); - Objects.requireNonNull( urlPattern, "urlPattern" ); - Objects.requireNonNull( contentPattern, "contentPattern" ); - Objects.requireNonNull( contentReplacement, "contentReplacement" ); + Objects.requireNonNull(id, "id"); + Objects.requireNonNull(urlPattern, "urlPattern"); + Objects.requireNonNull(contentPattern, "contentPattern"); + Objects.requireNonNull(contentReplacement, "contentReplacement"); this.id = id; this.urlPattern = urlPattern; this.contentPattern = contentPattern; this.contentReplacement = contentReplacement; } - public boolean applies( String url ) - { - return urlPattern.matcher( url ).matches(); + public boolean applies(String url) { + return urlPattern.matcher(url).matches(); } - public String sanitize( String content ) - { - if ( content == null ) - { + public String sanitize(String content) { + if (content == null) { return null; } - return contentPattern.matcher( content ).replaceAll( contentReplacement ); + return contentPattern.matcher(content).replaceAll(contentReplacement); } - public String getId() - { + public String getId() { return id; } - public Pattern getUrlPattern() - { + public Pattern getUrlPattern() { return urlPattern; } - public Pattern getContentPattern() - { + public Pattern getContentPattern() { return contentPattern; } - public String getContentReplacement() - { + public String getContentReplacement() { return contentReplacement; } } @@ -249,8 +225,7 @@ public String getContentReplacement() * * @since 1.18 */ - public static class Builder - { + public static class Builder { private String licenseListVersion; private String releaseDate; @@ -260,56 +235,49 @@ public static class Builder private Map contentSanitizers = new TreeMap<>(); private Map urlReplacements = new TreeMap<>(); - public SpdxLicenseList build() - { - Objects.requireNonNull( licenseListVersion, "isDeprecatedLicenseId" ); - Objects.requireNonNull( releaseDate, "detailsUrl" ); - if ( licenses.isEmpty() ) - { - throw new IllegalStateException( "licenses cannot be empty" ); + public SpdxLicenseList build() { + Objects.requireNonNull(licenseListVersion, "isDeprecatedLicenseId"); + Objects.requireNonNull(releaseDate, "detailsUrl"); + if (licenses.isEmpty()) { + throw new IllegalStateException("licenses cannot be empty"); } - final Map lics = Collections.unmodifiableMap( licenses ); + final Map lics = Collections.unmodifiableMap(licenses); this.licenses = null; - final Map sanitizers = Collections.unmodifiableMap( contentSanitizers ); + final Map sanitizers = Collections.unmodifiableMap(contentSanitizers); this.contentSanitizers = null; - final Map replacements = Collections.unmodifiableMap( urlReplacements ); + final Map replacements = Collections.unmodifiableMap(urlReplacements); this.urlReplacements = null; - return new SpdxLicenseList( licenseListVersion, lics, releaseDate, - new Attachments( sanitizers, replacements ) ); + return new SpdxLicenseList( + licenseListVersion, lics, releaseDate, new Attachments(sanitizers, replacements)); } - public Builder licenseListVersion( String licenseListVersion ) - { + public Builder licenseListVersion(String licenseListVersion) { this.licenseListVersion = licenseListVersion; return this; } - public Builder releaseDate( String releaseDate ) - { + public Builder releaseDate(String releaseDate) { this.releaseDate = releaseDate; return this; } - public Builder license( SpdxLicenseInfo license ) - { - this.licenses.put( license.getLicenseId(), license ); + public Builder license(SpdxLicenseInfo license) { + this.licenses.put(license.getLicenseId(), license); return this; } - public Builder contentSanitizer( String id, String urlPattern, String contentPattern, - String contentReplacement ) - { - this.contentSanitizers.put( id, ContentSanitizer.compile( id, urlPattern, contentPattern, - contentReplacement ) ); + public Builder contentSanitizer( + String id, String urlPattern, String contentPattern, String contentReplacement) { + this.contentSanitizers.put( + id, ContentSanitizer.compile(id, urlPattern, contentPattern, contentReplacement)); return this; } - public Builder urlReplacement( String id, String urlPattern, String replacement ) - { - this.urlReplacements.put( id, UrlReplacement.compile( id, urlPattern, replacement ) ); + public Builder urlReplacement(String id, String urlPattern, String replacement) { + this.urlReplacements.put(id, UrlReplacement.compile(id, urlPattern, replacement)); return this; } } diff --git a/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseListData.java b/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseListData.java index f066a8cf9..8ee4717db 100644 --- a/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseListData.java +++ b/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseListData.java @@ -27,6695 +27,15020 @@ * * https://raw.githubusercontent.com/spdx/license-list-data/v3.5/json/licenses.json */ -class SpdxLicenseListData -{ +class SpdxLicenseListData { - static SpdxLicenseList createList() - { + static SpdxLicenseList createList() { final SpdxLicenseList.Builder builder = SpdxLicenseList.builder(); - builder.licenseListVersion( "3.5" ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./0BSD.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/0BSD.json" ) - .name( "BSD Zero Clause License" ) - .licenseId( "0BSD" ) - .seeAlso( "http://landley.net/toybox/license.html" ) - - .urlInfo( "http://landley.net/toybox/license.html", "4b6f12065895f739dd7c82cb587520bdfa967a30", "text/html", true, false ) - .urlInfo( "http://www.landley.net/toybox/license.html", "4b6f12065895f739dd7c82cb587520bdfa967a30", "text/html", true, false ) - .urlInfo( "https://landley.net/toybox/license.html", "4b6f12065895f739dd7c82cb587520bdfa967a30", "text/html", true, false ) - .urlInfo( "https://www.landley.net/toybox/license.html", "4b6f12065895f739dd7c82cb587520bdfa967a30", "text/html", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AAL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/AAL.json" ) - .name( "Attribution Assurance License" ) - .licenseId( "AAL" ) - .seeAlso( "https://opensource.org/licenses/attribution" ) - - .urlInfo( "http://opensource.org/licenses/attribution", "3d2f40f1c2ba730a6448dcc327fc9720ee6017c3", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/attribution", "3d2f40f1c2ba730a6448dcc327fc9720ee6017c3", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/attribution", "3d2f40f1c2ba730a6448dcc327fc9720ee6017c3", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/attribution", "3d2f40f1c2ba730a6448dcc327fc9720ee6017c3", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./ADSL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/ADSL.json" ) - .name( "Amazon Digital Services License" ) - .licenseId( "ADSL" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/AmazonDigitalServicesLicense" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/AmazonDigitalServicesLicense", "bee57e8bbf4f0b6a69b18fedd1829cd886d327e4", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/AmazonDigitalServicesLicense", "bee57e8bbf4f0b6a69b18fedd1829cd886d327e4", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/AmazonDigitalServicesLicense", "bee57e8bbf4f0b6a69b18fedd1829cd886d327e4", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/AmazonDigitalServicesLicense", "bee57e8bbf4f0b6a69b18fedd1829cd886d327e4", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AFL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/AFL-1.1.json" ) - .name( "Academic Free License v1.1" ) - .licenseId( "AFL-1.1" ) - .seeAlso( "http://opensource.linux-mirror.org/licenses/afl-1.1.txt" ) - .seeAlso( "http://wayback.archive.org/web/20021004124254/http://www.opensource.org/licenses/academic.php" ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AFL-1.2.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/AFL-1.2.json" ) - .name( "Academic Free License v1.2" ) - .licenseId( "AFL-1.2" ) - .seeAlso( "http://opensource.linux-mirror.org/licenses/afl-1.2.txt" ) - .seeAlso( "http://wayback.archive.org/web/20021204204652/http://www.opensource.org/licenses/academic.php" ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AFL-2.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/AFL-2.0.json" ) - .name( "Academic Free License v2.0" ) - .licenseId( "AFL-2.0" ) - .seeAlso( "http://wayback.archive.org/web/20060924134533/http://www.opensource.org/licenses/afl-2.0.txt" ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AFL-2.1.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/AFL-2.1.json" ) - .name( "Academic Free License v2.1" ) - .licenseId( "AFL-2.1" ) - .seeAlso( "http://opensource.linux-mirror.org/licenses/afl-2.1.txt" ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AFL-3.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/AFL-3.0.json" ) - .name( "Academic Free License v3.0" ) - .licenseId( "AFL-3.0" ) - .seeAlso( "http://www.rosenlaw.com/AFL3.0.htm" ) - .seeAlso( "https://opensource.org/licenses/afl-3.0" ) - - .urlInfo( "http://opensource.org/licenses/afl-3.0", "50b7352f72a53c100508fb0e04d96ebbe8e47391", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/afl-3.0", "50b7352f72a53c100508fb0e04d96ebbe8e47391", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/afl-3.0", "50b7352f72a53c100508fb0e04d96ebbe8e47391", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/afl-3.0", "50b7352f72a53c100508fb0e04d96ebbe8e47391", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AGPL-1.0.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/AGPL-1.0.json" ) - .name( "Affero General Public License v1.0" ) - .licenseId( "AGPL-1.0" ) - .seeAlso( "http://www.affero.org/oagpl.html" ) - - .urlInfo( "http://affero.org/oagpl.html", "0ba5dd35099f6315cfdca991c0ebab4bc629dd14", "text/html", true, false ) - .urlInfo( "http://www.affero.org/oagpl.html", "0ba5dd35099f6315cfdca991c0ebab4bc629dd14", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AGPL-1.0-only.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/AGPL-1.0-only.json" ) - .name( "Affero General Public License v1.0 only" ) - .licenseId( "AGPL-1.0-only" ) - .seeAlso( "http://www.affero.org/oagpl.html" ) - - .urlInfo( "http://affero.org/oagpl.html", "0ba5dd35099f6315cfdca991c0ebab4bc629dd14", "text/html", true, false ) - .urlInfo( "http://www.affero.org/oagpl.html", "0ba5dd35099f6315cfdca991c0ebab4bc629dd14", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AGPL-1.0-or-later.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/AGPL-1.0-or-later.json" ) - .name( "Affero General Public License v1.0 or later" ) - .licenseId( "AGPL-1.0-or-later" ) - .seeAlso( "http://www.affero.org/oagpl.html" ) - - .urlInfo( "http://affero.org/oagpl.html", "0ba5dd35099f6315cfdca991c0ebab4bc629dd14", "text/html", true, false ) - .urlInfo( "http://www.affero.org/oagpl.html", "0ba5dd35099f6315cfdca991c0ebab4bc629dd14", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AGPL-3.0.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/AGPL-3.0.json" ) - .name( "GNU Affero General Public License v3.0" ) - .licenseId( "AGPL-3.0" ) - .seeAlso( "https://www.gnu.org/licenses/agpl.txt" ) - .seeAlso( "https://opensource.org/licenses/AGPL-3.0" ) - - .urlInfo( "http://gnu.org/licenses/agpl.txt", "4c665f87b5dc2e7d26279c4b48968d085e1ace32", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/agpl.txt", "4c665f87b5dc2e7d26279c4b48968d085e1ace32", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/agpl.txt", "4c665f87b5dc2e7d26279c4b48968d085e1ace32", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/agpl.txt", "4c665f87b5dc2e7d26279c4b48968d085e1ace32", "text/plain", true, false ) - .urlInfo( "http://opensource.org/licenses/AGPL-3.0", "be48d9bfd989e9e77f96dd28c7ccf601ed50f381", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/AGPL-3.0", "be48d9bfd989e9e77f96dd28c7ccf601ed50f381", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/AGPL-3.0", "be48d9bfd989e9e77f96dd28c7ccf601ed50f381", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/AGPL-3.0", "be48d9bfd989e9e77f96dd28c7ccf601ed50f381", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AGPL-3.0-only.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/AGPL-3.0-only.json" ) - .name( "GNU Affero General Public License v3.0 only" ) - .licenseId( "AGPL-3.0-only" ) - .seeAlso( "https://www.gnu.org/licenses/agpl.txt" ) - .seeAlso( "https://opensource.org/licenses/AGPL-3.0" ) - - .urlInfo( "http://gnu.org/licenses/agpl.txt", "4c665f87b5dc2e7d26279c4b48968d085e1ace32", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/agpl.txt", "4c665f87b5dc2e7d26279c4b48968d085e1ace32", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/agpl.txt", "4c665f87b5dc2e7d26279c4b48968d085e1ace32", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/agpl.txt", "4c665f87b5dc2e7d26279c4b48968d085e1ace32", "text/plain", true, false ) - .urlInfo( "http://opensource.org/licenses/AGPL-3.0", "be48d9bfd989e9e77f96dd28c7ccf601ed50f381", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/AGPL-3.0", "be48d9bfd989e9e77f96dd28c7ccf601ed50f381", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/AGPL-3.0", "be48d9bfd989e9e77f96dd28c7ccf601ed50f381", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/AGPL-3.0", "be48d9bfd989e9e77f96dd28c7ccf601ed50f381", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AGPL-3.0-or-later.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/AGPL-3.0-or-later.json" ) - .name( "GNU Affero General Public License v3.0 or later" ) - .licenseId( "AGPL-3.0-or-later" ) - .seeAlso( "https://www.gnu.org/licenses/agpl.txt" ) - .seeAlso( "https://opensource.org/licenses/AGPL-3.0" ) - - .urlInfo( "http://gnu.org/licenses/agpl.txt", "4c665f87b5dc2e7d26279c4b48968d085e1ace32", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/agpl.txt", "4c665f87b5dc2e7d26279c4b48968d085e1ace32", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/agpl.txt", "4c665f87b5dc2e7d26279c4b48968d085e1ace32", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/agpl.txt", "4c665f87b5dc2e7d26279c4b48968d085e1ace32", "text/plain", true, false ) - .urlInfo( "http://opensource.org/licenses/AGPL-3.0", "be48d9bfd989e9e77f96dd28c7ccf601ed50f381", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/AGPL-3.0", "be48d9bfd989e9e77f96dd28c7ccf601ed50f381", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/AGPL-3.0", "be48d9bfd989e9e77f96dd28c7ccf601ed50f381", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/AGPL-3.0", "be48d9bfd989e9e77f96dd28c7ccf601ed50f381", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AMDPLPA.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/AMDPLPA.json" ) - .name( "AMD's plpa_map.c License" ) - .licenseId( "AMDPLPA" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/AMD_plpa_map_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/AMD_plpa_map_License", "cb0052100768dc7e52a3da34da946b34a3259b66", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/AMD_plpa_map_License", "cb0052100768dc7e52a3da34da946b34a3259b66", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/AMD_plpa_map_License", "cb0052100768dc7e52a3da34da946b34a3259b66", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/AMD_plpa_map_License", "cb0052100768dc7e52a3da34da946b34a3259b66", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AML.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/AML.json" ) - .name( "Apple MIT License" ) - .licenseId( "AML" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Apple_MIT_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Apple_MIT_License", "c55e94054fba1dc49f41ff120388fb2c64554027", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Apple_MIT_License", "c55e94054fba1dc49f41ff120388fb2c64554027", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Apple_MIT_License", "c55e94054fba1dc49f41ff120388fb2c64554027", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Apple_MIT_License", "c55e94054fba1dc49f41ff120388fb2c64554027", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./AMPAS.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/AMPAS.json" ) - .name( "Academy of Motion Picture Arts and Sciences BSD" ) - .licenseId( "AMPAS" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/BSD#AMPASBSD" ) - - .urlInfo( "https://fedoraproject.org/wiki/Licensing/BSD#AMPASBSD", null, null, false, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./ANTLR-PD.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/ANTLR-PD.json" ) - .name( "ANTLR Software Rights Notice" ) - .licenseId( "ANTLR-PD" ) - .seeAlso( "http://www.antlr2.org/license.html" ) - - .urlInfo( "http://antlr2.org/license.html", "ff217bee0b3bec01a758737818bacb25dfbd6afe", "text/html", true, false ) - .urlInfo( "http://www.antlr2.org/license.html", "ff217bee0b3bec01a758737818bacb25dfbd6afe", "text/html", true, false ) - .urlInfo( "https://www.antlr2.org/license.html", "ff217bee0b3bec01a758737818bacb25dfbd6afe", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./APAFML.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/APAFML.json" ) - .name( "Adobe Postscript AFM License" ) - .licenseId( "APAFML" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/AdobePostscriptAFM" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/AdobePostscriptAFM", "81ba32695de3c956d9890528ed12599b7eb1a250", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/AdobePostscriptAFM", "81ba32695de3c956d9890528ed12599b7eb1a250", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/AdobePostscriptAFM", "81ba32695de3c956d9890528ed12599b7eb1a250", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/AdobePostscriptAFM", "81ba32695de3c956d9890528ed12599b7eb1a250", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./APL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/APL-1.0.json" ) - .name( "Adaptive Public License 1.0" ) - .licenseId( "APL-1.0" ) - .seeAlso( "https://opensource.org/licenses/APL-1.0" ) - - .urlInfo( "http://opensource.org/licenses/APL-1.0", "4f473ae5e894bb26652a7511fb8c3b13da0362e7", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/APL-1.0", "4f473ae5e894bb26652a7511fb8c3b13da0362e7", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/APL-1.0", "4f473ae5e894bb26652a7511fb8c3b13da0362e7", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/APL-1.0", "4f473ae5e894bb26652a7511fb8c3b13da0362e7", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./APSL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/APSL-1.0.json" ) - .name( "Apple Public Source License 1.0" ) - .licenseId( "APSL-1.0" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Apple_Public_Source_License_1.0" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Apple_Public_Source_License_1.0", "540db8bb93326a868af04c0bcd2a7d36de1d56e4", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Apple_Public_Source_License_1.0", "540db8bb93326a868af04c0bcd2a7d36de1d56e4", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Apple_Public_Source_License_1.0", "540db8bb93326a868af04c0bcd2a7d36de1d56e4", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Apple_Public_Source_License_1.0", "540db8bb93326a868af04c0bcd2a7d36de1d56e4", "text/html", true, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./APSL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/APSL-1.1.json" ) - .name( "Apple Public Source License 1.1" ) - .licenseId( "APSL-1.1" ) - .seeAlso( "http://www.opensource.apple.com/source/IOSerialFamily/IOSerialFamily-7/APPLE_LICENSE" ) - - .urlInfo( "http://www.opensource.apple.com/source/IOSerialFamily/IOSerialFamily-7/APPLE_LICENSE", "ee2b2438e398cfe8568a1826ff18fff4aff2b3a7", "text/plain", true, false ) - .urlInfo( "https://opensource.apple.com/source/IOSerialFamily/IOSerialFamily-7/APPLE_LICENSE", "ee2b2438e398cfe8568a1826ff18fff4aff2b3a7", "text/plain", true, false ) - .urlInfo( "https://www.opensource.apple.com/source/IOSerialFamily/IOSerialFamily-7/APPLE_LICENSE", "ee2b2438e398cfe8568a1826ff18fff4aff2b3a7", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./APSL-1.2.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/APSL-1.2.json" ) - .name( "Apple Public Source License 1.2" ) - .licenseId( "APSL-1.2" ) - .seeAlso( "http://www.samurajdata.se/opensource/mirror/licenses/apsl.php" ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./APSL-2.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/APSL-2.0.json" ) - .name( "Apple Public Source License 2.0" ) - .licenseId( "APSL-2.0" ) - .seeAlso( "http://www.opensource.apple.com/license/apsl/" ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Abstyles.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Abstyles.json" ) - .name( "Abstyles License" ) - .licenseId( "Abstyles" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Abstyles" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Abstyles", "c00b5519a8f317ed8aa53589c1d8445c3ef844ac", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Abstyles", "c00b5519a8f317ed8aa53589c1d8445c3ef844ac", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Abstyles", "c00b5519a8f317ed8aa53589c1d8445c3ef844ac", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Abstyles", "c00b5519a8f317ed8aa53589c1d8445c3ef844ac", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Adobe-2006.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Adobe-2006.json" ) - .name( "Adobe Systems Incorporated Source Code License Agreement" ) - .licenseId( "Adobe-2006" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/AdobeLicense" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/AdobeLicense", "2d1b5e03b12bcf28be788a3863fdf8f8fcf2dfba", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/AdobeLicense", "2d1b5e03b12bcf28be788a3863fdf8f8fcf2dfba", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/AdobeLicense", "2d1b5e03b12bcf28be788a3863fdf8f8fcf2dfba", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/AdobeLicense", "2d1b5e03b12bcf28be788a3863fdf8f8fcf2dfba", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Adobe-Glyph.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Adobe-Glyph.json" ) - .name( "Adobe Glyph List License" ) - .licenseId( "Adobe-Glyph" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Afmparse.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Afmparse.json" ) - .name( "Afmparse License" ) - .licenseId( "Afmparse" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Afmparse" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Afmparse", "f24d79e15fc8608636d2dbc15095444a25f63192", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Afmparse", "f24d79e15fc8608636d2dbc15095444a25f63192", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Afmparse", "f24d79e15fc8608636d2dbc15095444a25f63192", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Afmparse", "f24d79e15fc8608636d2dbc15095444a25f63192", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Aladdin.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Aladdin.json" ) - .name( "Aladdin Free Public License" ) - .licenseId( "Aladdin" ) - .seeAlso( "http://pages.cs.wisc.edu/~ghost/doc/AFPL/6.01/Public.htm" ) - - .urlInfo( "http://pages.cs.wisc.edu/~ghost/doc/AFPL/6.01/Public.htm", "c38fdbb75a01231de6a9d8315fbdd2a4f897b0ee", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Apache-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Apache-1.0.json" ) - .name( "Apache License 1.0" ) - .licenseId( "Apache-1.0" ) - .seeAlso( "http://www.apache.org/licenses/LICENSE-1.0" ) - - .urlInfo( "http://apache.org/licenses/LICENSE-1.0", "07bcce2cb78c8cb063a5cd93ef19cf645e724462", "text/plain", true, false ) - .urlInfo( "http://apache.org/licenses/LICENSE-1.0.txt", "07bcce2cb78c8cb063a5cd93ef19cf645e724462", "text/plain", true, false ) - .urlInfo( "http://www.apache.org/licenses/LICENSE-1.0", "07bcce2cb78c8cb063a5cd93ef19cf645e724462", "text/plain", true, false ) - .urlInfo( "http://www.apache.org/licenses/LICENSE-1.0.txt", "07bcce2cb78c8cb063a5cd93ef19cf645e724462", "text/plain", true, false ) - .urlInfo( "https://apache.org/licenses/LICENSE-1.0", "07bcce2cb78c8cb063a5cd93ef19cf645e724462", "text/plain", true, false ) - .urlInfo( "https://apache.org/licenses/LICENSE-1.0.txt", "07bcce2cb78c8cb063a5cd93ef19cf645e724462", "text/plain", true, false ) - .urlInfo( "https://www.apache.org/licenses/LICENSE-1.0", "07bcce2cb78c8cb063a5cd93ef19cf645e724462", "text/plain", true, false ) - .urlInfo( "https://www.apache.org/licenses/LICENSE-1.0.txt", "07bcce2cb78c8cb063a5cd93ef19cf645e724462", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Apache-1.1.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Apache-1.1.json" ) - .name( "Apache License 1.1" ) - .licenseId( "Apache-1.1" ) - .seeAlso( "http://apache.org/licenses/LICENSE-1.1" ) - .seeAlso( "https://opensource.org/licenses/Apache-1.1" ) - - .urlInfo( "http://apache.org/licenses/LICENSE-1.1", "9bb549e965aa70ab30dbd2949a773f49099ae629", "text/plain", true, false ) - .urlInfo( "http://apache.org/licenses/LICENSE-1.1.txt", "9bb549e965aa70ab30dbd2949a773f49099ae629", "text/plain", true, false ) - .urlInfo( "http://www.apache.org/licenses/LICENSE-1.1", "9bb549e965aa70ab30dbd2949a773f49099ae629", "text/plain", true, false ) - .urlInfo( "http://www.apache.org/licenses/LICENSE-1.1.txt", "9bb549e965aa70ab30dbd2949a773f49099ae629", "text/plain", true, false ) - .urlInfo( "https://apache.org/licenses/LICENSE-1.1", "9bb549e965aa70ab30dbd2949a773f49099ae629", "text/plain", true, false ) - .urlInfo( "https://apache.org/licenses/LICENSE-1.1.txt", "9bb549e965aa70ab30dbd2949a773f49099ae629", "text/plain", true, false ) - .urlInfo( "https://www.apache.org/licenses/LICENSE-1.1", "9bb549e965aa70ab30dbd2949a773f49099ae629", "text/plain", true, false ) - .urlInfo( "https://www.apache.org/licenses/LICENSE-1.1.txt", "9bb549e965aa70ab30dbd2949a773f49099ae629", "text/plain", true, false ) - .urlInfo( "http://opensource.org/licenses/Apache-1.1", "18606c49f9b34512c4e45f05975259c137be5c56", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Apache-1.1", "18606c49f9b34512c4e45f05975259c137be5c56", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Apache-1.1", "18606c49f9b34512c4e45f05975259c137be5c56", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Apache-1.1", "18606c49f9b34512c4e45f05975259c137be5c56", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Apache-2.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Apache-2.0.json" ) - .name( "Apache License 2.0" ) - .licenseId( "Apache-2.0" ) - .seeAlso( "http://www.apache.org/licenses/LICENSE-2.0" ) - .seeAlso( "https://opensource.org/licenses/Apache-2.0" ) - - .urlInfo( "http://apache.org/licenses/LICENSE-2.0", "2b8b815229aa8a61e483fb4ba0588b8b6c491890", "text/plain", true, false ) - .urlInfo( "http://apache.org/licenses/LICENSE-2.0.txt", "2b8b815229aa8a61e483fb4ba0588b8b6c491890", "text/plain", true, false ) - .urlInfo( "http://www.apache.org/licenses/LICENSE-2.0", "2b8b815229aa8a61e483fb4ba0588b8b6c491890", "text/plain", true, false ) - .urlInfo( "http://www.apache.org/licenses/LICENSE-2.0.txt", "2b8b815229aa8a61e483fb4ba0588b8b6c491890", "text/plain", true, false ) - .urlInfo( "https://apache.org/licenses/LICENSE-2.0", "2b8b815229aa8a61e483fb4ba0588b8b6c491890", "text/plain", true, false ) - .urlInfo( "https://apache.org/licenses/LICENSE-2.0.txt", "2b8b815229aa8a61e483fb4ba0588b8b6c491890", "text/plain", true, false ) - .urlInfo( "https://www.apache.org/licenses/LICENSE-2.0", "2b8b815229aa8a61e483fb4ba0588b8b6c491890", "text/plain", true, false ) - .urlInfo( "https://www.apache.org/licenses/LICENSE-2.0.txt", "2b8b815229aa8a61e483fb4ba0588b8b6c491890", "text/plain", true, false ) - .urlInfo( "http://opensource.org/licenses/Apache-2.0", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "http://opensource.org/licenses/apache2.0", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "http://opensource.org/licenses/apache2.0.html", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "http://opensource.org/licenses/apache2.0.php", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Apache-2.0", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/apache2.0", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/apache2.0.html", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/apache2.0.php", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Apache-2.0", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/apache2.0", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/apache2.0.html", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/apache2.0.php", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Apache-2.0", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/apache2.0", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/apache2.0.html", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/apache2.0.php", "efbdca62537c501650377fe25a4b03e166d8c3b2", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Artistic-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Artistic-1.0.json" ) - .name( "Artistic License 1.0" ) - .licenseId( "Artistic-1.0" ) - .seeAlso( "https://opensource.org/licenses/Artistic-1.0" ) - - .urlInfo( "http://opensource.org/licenses/Artistic-1.0", "65a6ca3a3a8d078cea781fbf4e21e71d022426f0", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Artistic-1.0", "65a6ca3a3a8d078cea781fbf4e21e71d022426f0", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Artistic-1.0", "65a6ca3a3a8d078cea781fbf4e21e71d022426f0", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Artistic-1.0", "65a6ca3a3a8d078cea781fbf4e21e71d022426f0", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Artistic-1.0-Perl.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Artistic-1.0-Perl.json" ) - .name( "Artistic License 1.0 (Perl)" ) - .licenseId( "Artistic-1.0-Perl" ) - .seeAlso( "http://dev.perl.org/licenses/artistic.html" ) - - .urlInfo( "http://dev.perl.org/licenses/artistic.html", "10aab5372b3fde865b62d3c0047f824f17c49a8d", "text/html", true, false ) - .urlInfo( "https://dev.perl.org/licenses/artistic.html", "10aab5372b3fde865b62d3c0047f824f17c49a8d", "text/html", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Artistic-1.0-cl8.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Artistic-1.0-cl8.json" ) - .name( "Artistic License 1.0 w/clause 8" ) - .licenseId( "Artistic-1.0-cl8" ) - .seeAlso( "https://opensource.org/licenses/Artistic-1.0" ) - - .urlInfo( "http://opensource.org/licenses/Artistic-1.0", "65a6ca3a3a8d078cea781fbf4e21e71d022426f0", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Artistic-1.0", "65a6ca3a3a8d078cea781fbf4e21e71d022426f0", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Artistic-1.0", "65a6ca3a3a8d078cea781fbf4e21e71d022426f0", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Artistic-1.0", "65a6ca3a3a8d078cea781fbf4e21e71d022426f0", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Artistic-2.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Artistic-2.0.json" ) - .name( "Artistic License 2.0" ) - .licenseId( "Artistic-2.0" ) - .seeAlso( "http://www.perlfoundation.org/artistic_license_2_0" ) - .seeAlso( "https://opensource.org/licenses/artistic-license-2.0" ) - - .urlInfo( "http://perlfoundation.org/artistic_license_2_0", "2aa74311fcf75af8005e37705f49552b9010a2db", "text/html", true, false ) - .urlInfo( "http://www.perlfoundation.org/artistic_license_2_0", "2aa74311fcf75af8005e37705f49552b9010a2db", "text/html", true, false ) - .urlInfo( "https://perlfoundation.org/artistic_license_2_0", "2aa74311fcf75af8005e37705f49552b9010a2db", "text/html", true, false ) - .urlInfo( "https://www.perlfoundation.org/artistic_license_2_0", "2aa74311fcf75af8005e37705f49552b9010a2db", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/artistic-license-2.0", "29e7bfae77279c8d36f6fb64c5b500dc3ee174b4", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/artistic-license-2.0", "29e7bfae77279c8d36f6fb64c5b500dc3ee174b4", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/artistic-license-2.0", "29e7bfae77279c8d36f6fb64c5b500dc3ee174b4", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/artistic-license-2.0", "29e7bfae77279c8d36f6fb64c5b500dc3ee174b4", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-1-Clause.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/BSD-1-Clause.json" ) - .name( "BSD 1-Clause License" ) - .licenseId( "BSD-1-Clause" ) - .seeAlso( "https://svnweb.freebsd.org/base/head/include/ifaddrs.h?revision=326823" ) - - .urlInfo( "http://svnweb.freebsd.org/base/head/include/ifaddrs.h?revision=326823", "0c025021376b31ef1c4920f5ae3428d3eeb1fa50", "text/plain", true, false ) - .urlInfo( "https://svnweb.freebsd.org/base/head/include/ifaddrs.h?revision=326823", "0c025021376b31ef1c4920f5ae3428d3eeb1fa50", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-2-Clause.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/BSD-2-Clause.json" ) - .name( "BSD 2-Clause \"Simplified\" License" ) - .licenseId( "BSD-2-Clause" ) - .seeAlso( "https://opensource.org/licenses/BSD-2-Clause" ) - - .urlInfo( "http://opensource.org/licenses/BSD-2-Clause", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "http://opensource.org/licenses/bsd-license", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "http://opensource.org/licenses/bsd-license.html", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "http://opensource.org/licenses/bsd-license.php", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/BSD-2-Clause", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/bsd-license", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/bsd-license.html", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/bsd-license.php", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/BSD-2-Clause", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/bsd-license", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/bsd-license.html", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/bsd-license.php", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/BSD-2-Clause", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/bsd-license", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/bsd-license.html", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/bsd-license.php", "3691ecd9ecce87fd6b145a4de2d5aa63130ab3c9", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-2-Clause-FreeBSD.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/BSD-2-Clause-FreeBSD.json" ) - .name( "BSD 2-Clause FreeBSD License" ) - .licenseId( "BSD-2-Clause-FreeBSD" ) - .seeAlso( "http://www.freebsd.org/copyright/freebsd-license.html" ) - - .urlInfo( "http://freebsd.org/copyright/freebsd-license.html", "3af3bbf5ed5334001ee30e7d2b81be1b043db629", "text/html", true, false ) - .urlInfo( "http://www.freebsd.org/copyright/freebsd-license.html", "3af3bbf5ed5334001ee30e7d2b81be1b043db629", "text/html", true, false ) - .urlInfo( "https://freebsd.org/copyright/freebsd-license.html", "3af3bbf5ed5334001ee30e7d2b81be1b043db629", "text/html", true, false ) - .urlInfo( "https://www.freebsd.org/copyright/freebsd-license.html", "3af3bbf5ed5334001ee30e7d2b81be1b043db629", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-2-Clause-NetBSD.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/BSD-2-Clause-NetBSD.json" ) - .name( "BSD 2-Clause NetBSD License" ) - .licenseId( "BSD-2-Clause-NetBSD" ) - .seeAlso( "http://www.netbsd.org/about/redistribution.html#default" ) - - .urlInfo( "http://netbsd.org/about/redistribution.html#default", "d1a528d65fffa3a4ac8bf9e30305b2b405007e46", "text/html", true, false ) - .urlInfo( "http://www.netbsd.org/about/redistribution.html#default", "d1a528d65fffa3a4ac8bf9e30305b2b405007e46", "text/html", true, false ) - .urlInfo( "https://netbsd.org/about/redistribution.html#default", "d1a528d65fffa3a4ac8bf9e30305b2b405007e46", "text/html", true, false ) - .urlInfo( "https://www.netbsd.org/about/redistribution.html#default", "d1a528d65fffa3a4ac8bf9e30305b2b405007e46", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-2-Clause-Patent.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/BSD-2-Clause-Patent.json" ) - .name( "BSD-2-Clause Plus Patent License" ) - .licenseId( "BSD-2-Clause-Patent" ) - .seeAlso( "https://opensource.org/licenses/BSDplusPatent" ) - - .urlInfo( "http://opensource.org/licenses/BSDplusPatent", "8a77f299f28986a93af128d28ce8292fa00a207b", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/BSDplusPatent", "8a77f299f28986a93af128d28ce8292fa00a207b", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/BSDplusPatent", "8a77f299f28986a93af128d28ce8292fa00a207b", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/BSDplusPatent", "8a77f299f28986a93af128d28ce8292fa00a207b", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-3-Clause.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/BSD-3-Clause.json" ) - .name( "BSD 3-Clause \"New\" or \"Revised\" License" ) - .licenseId( "BSD-3-Clause" ) - .seeAlso( "https://opensource.org/licenses/BSD-3-Clause" ) - - .urlInfo( "http://opensource.org/licenses/BSD-3-Clause", "b9a0fe3005500a72151d223684b818dd73bf3078", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/BSD-3-Clause", "b9a0fe3005500a72151d223684b818dd73bf3078", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/BSD-3-Clause", "b9a0fe3005500a72151d223684b818dd73bf3078", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/BSD-3-Clause", "b9a0fe3005500a72151d223684b818dd73bf3078", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-3-Clause-Attribution.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/BSD-3-Clause-Attribution.json" ) - .name( "BSD with attribution" ) - .licenseId( "BSD-3-Clause-Attribution" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/BSD_with_Attribution" ) - - .urlInfo( "https://fedoraproject.org/wiki/Licensing/BSD_with_Attribution", null, null, false, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-3-Clause-Clear.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/BSD-3-Clause-Clear.json" ) - .name( "BSD 3-Clause Clear License" ) - .licenseId( "BSD-3-Clause-Clear" ) - .seeAlso( "http://labs.metacarta.com/license-explanation.html#license" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-3-Clause-LBNL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/BSD-3-Clause-LBNL.json" ) - .name( "Lawrence Berkeley National Labs BSD variant license" ) - .licenseId( "BSD-3-Clause-LBNL" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/LBNLBSD" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/LBNLBSD", "f107ca803195f4824e3bac77bc3d2ed75b16bee3", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/LBNLBSD", "f107ca803195f4824e3bac77bc3d2ed75b16bee3", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/LBNLBSD", "f107ca803195f4824e3bac77bc3d2ed75b16bee3", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/LBNLBSD", "f107ca803195f4824e3bac77bc3d2ed75b16bee3", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-3-Clause-No-Nuclear-License.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/BSD-3-Clause-No-Nuclear-License.json" ) - .name( "BSD 3-Clause No Nuclear License" ) - .licenseId( "BSD-3-Clause-No-Nuclear-License" ) - .seeAlso( "http://download.oracle.com/otn-pub/java/licenses/bsd.txt?AuthParam=1467140197_43d516ce1776bd08a58235a7785be1cc" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-3-Clause-No-Nuclear-License-2014.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/BSD-3-Clause-No-Nuclear-License-2014.json" ) - .name( "BSD 3-Clause No Nuclear License 2014" ) - .licenseId( "BSD-3-Clause-No-Nuclear-License-2014" ) - .seeAlso( "https://java.net/projects/javaeetutorial/pages/BerkeleyLicense" ) - - .urlInfo( "http://java.net/projects/javaeetutorial/pages/BerkeleyLicense", "75c018e5b34ba1adce64325cc1250a7689814c27", "text/html", true, false ) - .urlInfo( "https://java.net/projects/javaeetutorial/pages/BerkeleyLicense", "75c018e5b34ba1adce64325cc1250a7689814c27", "text/html", true, false ) - .urlInfo( "https://www.java.net/projects/javaeetutorial/pages/BerkeleyLicense", "75c018e5b34ba1adce64325cc1250a7689814c27", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-3-Clause-No-Nuclear-Warranty.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/BSD-3-Clause-No-Nuclear-Warranty.json" ) - .name( "BSD 3-Clause No Nuclear Warranty" ) - .licenseId( "BSD-3-Clause-No-Nuclear-Warranty" ) - .seeAlso( "https://jogamp.org/git/?p=gluegen.git;a=blob_plain;f=LICENSE.txt" ) - - .urlInfo( "http://jogamp.org/git/?p=gluegen.git;a=blob_plain;f=LICENSE.txt", "f4a50b594d0dca2c631d5e803b971713e1b8aad2", "text/plain", true, false ) - .urlInfo( "http://www.jogamp.org/git/?p=gluegen.git;a=blob_plain;f=LICENSE.txt", "f4a50b594d0dca2c631d5e803b971713e1b8aad2", "text/plain", true, false ) - .urlInfo( "https://jogamp.org/git/?p=gluegen.git;a=blob_plain;f=LICENSE.txt", "f4a50b594d0dca2c631d5e803b971713e1b8aad2", "text/plain", true, false ) - .urlInfo( "https://www.jogamp.org/git/?p=gluegen.git;a=blob_plain;f=LICENSE.txt", "f4a50b594d0dca2c631d5e803b971713e1b8aad2", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-4-Clause.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/BSD-4-Clause.json" ) - .name( "BSD 4-Clause \"Original\" or \"Old\" License" ) - .licenseId( "BSD-4-Clause" ) - .seeAlso( "http://directory.fsf.org/wiki/License:BSD_4Clause" ) - - .urlInfo( "http://directory.fsf.org/wiki/License:BSD_4Clause", "0b20ca3cc475ced7071f8f137d5fb8c0020bbed3", "text/html", true, true ) - .urlInfo( "https://directory.fsf.org/wiki/License:BSD_4Clause", "0b20ca3cc475ced7071f8f137d5fb8c0020bbed3", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-4-Clause-UC.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/BSD-4-Clause-UC.json" ) - .name( "BSD-4-Clause (University of California-Specific)" ) - .licenseId( "BSD-4-Clause-UC" ) - .seeAlso( "http://www.freebsd.org/copyright/license.html" ) - - .urlInfo( "http://freebsd.org/copyright/license.html", "8c53ff4279202ca631c5538b0ba316d6bc95e1e3", "text/html", true, false ) - .urlInfo( "http://www.freebsd.org/copyright/license.html", "8c53ff4279202ca631c5538b0ba316d6bc95e1e3", "text/html", true, false ) - .urlInfo( "https://freebsd.org/copyright/license.html", "8c53ff4279202ca631c5538b0ba316d6bc95e1e3", "text/html", true, false ) - .urlInfo( "https://www.freebsd.org/copyright/license.html", "8c53ff4279202ca631c5538b0ba316d6bc95e1e3", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-Protection.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/BSD-Protection.json" ) - .name( "BSD Protection License" ) - .licenseId( "BSD-Protection" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/BSD_Protection_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/BSD_Protection_License", "b8e72b3aa43ded00f63d78806ebf14c72cd62302", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/BSD_Protection_License", "b8e72b3aa43ded00f63d78806ebf14c72cd62302", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/BSD_Protection_License", "b8e72b3aa43ded00f63d78806ebf14c72cd62302", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/BSD_Protection_License", "b8e72b3aa43ded00f63d78806ebf14c72cd62302", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSD-Source-Code.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/BSD-Source-Code.json" ) - .name( "BSD Source Code Attribution" ) - .licenseId( "BSD-Source-Code" ) - .seeAlso( "https://github.com/robbiehanson/CocoaHTTPServer/blob/master/LICENSE.txt" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BSL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/BSL-1.0.json" ) - .name( "Boost Software License 1.0" ) - .licenseId( "BSL-1.0" ) - .seeAlso( "http://www.boost.org/LICENSE_1_0.txt" ) - .seeAlso( "https://opensource.org/licenses/BSL-1.0" ) - - .urlInfo( "http://boost.org/LICENSE_1_0.txt", "3cba29011be2b9d59f6204d6fa0a386b1b2dbd90", "text/plain", true, false ) - .urlInfo( "http://www.boost.org/LICENSE_1_0.txt", "3cba29011be2b9d59f6204d6fa0a386b1b2dbd90", "text/plain", true, false ) - .urlInfo( "https://boost.org/LICENSE_1_0.txt", "3cba29011be2b9d59f6204d6fa0a386b1b2dbd90", "text/plain", true, false ) - .urlInfo( "https://www.boost.org/LICENSE_1_0.txt", "3cba29011be2b9d59f6204d6fa0a386b1b2dbd90", "text/plain", true, false ) - .urlInfo( "http://opensource.org/licenses/BSL-1.0", "ee439b84bb4b077bee9a4f9998c9a8b67858b3c5", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/BSL-1.0", "ee439b84bb4b077bee9a4f9998c9a8b67858b3c5", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/BSL-1.0", "ee439b84bb4b077bee9a4f9998c9a8b67858b3c5", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/BSL-1.0", "ee439b84bb4b077bee9a4f9998c9a8b67858b3c5", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Bahyph.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Bahyph.json" ) - .name( "Bahyph License" ) - .licenseId( "Bahyph" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Bahyph" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Bahyph", "575b493b013b9d8e0bb3f19462f00ee4704f9d6d", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Bahyph", "575b493b013b9d8e0bb3f19462f00ee4704f9d6d", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Bahyph", "575b493b013b9d8e0bb3f19462f00ee4704f9d6d", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Bahyph", "575b493b013b9d8e0bb3f19462f00ee4704f9d6d", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Barr.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Barr.json" ) - .name( "Barr License" ) - .licenseId( "Barr" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Barr" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Barr", "8c941d32a6ff7d840410ca8fa5fee3bacd8d9946", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Barr", "8c941d32a6ff7d840410ca8fa5fee3bacd8d9946", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Barr", "8c941d32a6ff7d840410ca8fa5fee3bacd8d9946", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Barr", "8c941d32a6ff7d840410ca8fa5fee3bacd8d9946", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Beerware.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Beerware.json" ) - .name( "Beerware License" ) - .licenseId( "Beerware" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Beerware" ) - .seeAlso( "https://people.freebsd.org/~phk/" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Beerware", "4616e61ccf6f11e80210f8434eb2e5a44775dc67", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Beerware", "4616e61ccf6f11e80210f8434eb2e5a44775dc67", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Beerware", "4616e61ccf6f11e80210f8434eb2e5a44775dc67", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Beerware", "4616e61ccf6f11e80210f8434eb2e5a44775dc67", "text/html", true, true ) - .urlInfo( "http://people.freebsd.org/~phk/", "8941cb77388e1fc73ec5a714ae571103c101b4fd", "text/html", true, false ) - .urlInfo( "https://people.freebsd.org/~phk/", "8941cb77388e1fc73ec5a714ae571103c101b4fd", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BitTorrent-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/BitTorrent-1.0.json" ) - .name( "BitTorrent Open Source License v1.0" ) - .licenseId( "BitTorrent-1.0" ) - .seeAlso( "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/licenses/BitTorrent?r1=1.1&r2=1.1.1.1&diff_format=s" ) - - .urlInfo( "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/licenses/BitTorrent?r1=1.1&r2=1.1.1.1&diff_format=s", "9612e12cd880c1e835561e8a7557c2d1016a99bd", "text/html", true, false ) - .urlInfo( "https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/licenses/BitTorrent?r1=1.1&r2=1.1.1.1&diff_format=s", "9612e12cd880c1e835561e8a7557c2d1016a99bd", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./BitTorrent-1.1.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/BitTorrent-1.1.json" ) - .name( "BitTorrent Open Source License v1.1" ) - .licenseId( "BitTorrent-1.1" ) - .seeAlso( "http://directory.fsf.org/wiki/License:BitTorrentOSL1.1" ) - - .urlInfo( "http://directory.fsf.org/wiki/License:BitTorrentOSL1.1", "043ac5c3dc68984134f1209dd565165a4076047e", "text/html", true, true ) - .urlInfo( "https://directory.fsf.org/wiki/License:BitTorrentOSL1.1", "043ac5c3dc68984134f1209dd565165a4076047e", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Borceux.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Borceux.json" ) - .name( "Borceux license" ) - .licenseId( "Borceux" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Borceux" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Borceux", "b7222363c4ffc3706a2b79a372452594da1e967b", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Borceux", "b7222363c4ffc3706a2b79a372452594da1e967b", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CATOSL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CATOSL-1.1.json" ) - .name( "Computer Associates Trusted Open Source License 1.1" ) - .licenseId( "CATOSL-1.1" ) - .seeAlso( "https://opensource.org/licenses/CATOSL-1.1" ) - - .urlInfo( "http://opensource.org/licenses/CATOSL-1.1", "ac48daa5f1d287b7676eaf5c23c2fd19e8ddd2a9", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/CATOSL-1.1", "ac48daa5f1d287b7676eaf5c23c2fd19e8ddd2a9", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/CATOSL-1.1", "ac48daa5f1d287b7676eaf5c23c2fd19e8ddd2a9", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/CATOSL-1.1", "ac48daa5f1d287b7676eaf5c23c2fd19e8ddd2a9", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-1.0.json" ) - .name( "Creative Commons Attribution 1.0 Generic" ) - .licenseId( "CC-BY-1.0" ) - .seeAlso( "https://creativecommons.org/licenses/by/1.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by/1.0/legalcode", "1c63388d25afec934d6c52e6e6500a4354e4b361", "text/html", true, false ) - .urlInfo( "http://www.creativecommons.org/licenses/by/1.0/legalcode", "1c63388d25afec934d6c52e6e6500a4354e4b361", "text/html", true, false ) - .urlInfo( "https://creativecommons.org/licenses/by/1.0/legalcode", "1c63388d25afec934d6c52e6e6500a4354e4b361", "text/html", true, false ) - .urlInfo( "https://www.creativecommons.org/licenses/by/1.0/legalcode", "1c63388d25afec934d6c52e6e6500a4354e4b361", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-2.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-2.0.json" ) - .name( "Creative Commons Attribution 2.0 Generic" ) - .licenseId( "CC-BY-2.0" ) - .seeAlso( "https://creativecommons.org/licenses/by/2.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by/2.0/legalcode", "ed79ebf5fd886cbf0ec52bcda4f4c714c489805e", "text/html", true, false ) - .urlInfo( "http://www.creativecommons.org/licenses/by/2.0/legalcode", "ed79ebf5fd886cbf0ec52bcda4f4c714c489805e", "text/html", true, false ) - .urlInfo( "https://creativecommons.org/licenses/by/2.0/legalcode", "ed79ebf5fd886cbf0ec52bcda4f4c714c489805e", "text/html", true, false ) - .urlInfo( "https://www.creativecommons.org/licenses/by/2.0/legalcode", "ed79ebf5fd886cbf0ec52bcda4f4c714c489805e", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-2.5.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-2.5.json" ) - .name( "Creative Commons Attribution 2.5 Generic" ) - .licenseId( "CC-BY-2.5" ) - .seeAlso( "https://creativecommons.org/licenses/by/2.5/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by/2.5/legalcode", "a3f15d06f44729420d7ab2d87ca9bee7cf2820fe", "text/html", true, false ) - .urlInfo( "http://www.creativecommons.org/licenses/by/2.5/legalcode", "a3f15d06f44729420d7ab2d87ca9bee7cf2820fe", "text/html", true, false ) - .urlInfo( "https://creativecommons.org/licenses/by/2.5/legalcode", "a3f15d06f44729420d7ab2d87ca9bee7cf2820fe", "text/html", true, false ) - .urlInfo( "https://www.creativecommons.org/licenses/by/2.5/legalcode", "a3f15d06f44729420d7ab2d87ca9bee7cf2820fe", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-3.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-3.0.json" ) - .name( "Creative Commons Attribution 3.0 Unported" ) - .licenseId( "CC-BY-3.0" ) - .seeAlso( "https://creativecommons.org/licenses/by/3.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by/3.0/legalcode", "e835a69859b9fc6d35961a58e0e9b32e1d2dff5e", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by/3.0/legalcode", "e835a69859b9fc6d35961a58e0e9b32e1d2dff5e", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by/3.0/legalcode", "e835a69859b9fc6d35961a58e0e9b32e1d2dff5e", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by/3.0/legalcode", "e835a69859b9fc6d35961a58e0e9b32e1d2dff5e", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-4.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-4.0.json" ) - .name( "Creative Commons Attribution 4.0 International" ) - .licenseId( "CC-BY-4.0" ) - .seeAlso( "https://creativecommons.org/licenses/by/4.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by/4.0/legalcode", "ed63d6dc37abf705c1435e481ff840c3279c6afe", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by/4.0/legalcode", "ed63d6dc37abf705c1435e481ff840c3279c6afe", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by/4.0/legalcode", "ed63d6dc37abf705c1435e481ff840c3279c6afe", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by/4.0/legalcode", "ed63d6dc37abf705c1435e481ff840c3279c6afe", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-1.0.json" ) - .name( "Creative Commons Attribution Non Commercial 1.0 Generic" ) - .licenseId( "CC-BY-NC-1.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nc/1.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nc/1.0/legalcode", "f1023e8a24e3a8c5b8029e9518c19bd70d231815", "text/html", true, false ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nc/1.0/legalcode", "f1023e8a24e3a8c5b8029e9518c19bd70d231815", "text/html", true, false ) - .urlInfo( "https://creativecommons.org/licenses/by-nc/1.0/legalcode", "f1023e8a24e3a8c5b8029e9518c19bd70d231815", "text/html", true, false ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nc/1.0/legalcode", "f1023e8a24e3a8c5b8029e9518c19bd70d231815", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-2.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-2.0.json" ) - .name( "Creative Commons Attribution Non Commercial 2.0 Generic" ) - .licenseId( "CC-BY-NC-2.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nc/2.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nc/2.0/legalcode", "35bfa32370d94a02d195222e876d48fe5e2bd58c", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nc/2.0/legalcode", "35bfa32370d94a02d195222e876d48fe5e2bd58c", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nc/2.0/legalcode", "35bfa32370d94a02d195222e876d48fe5e2bd58c", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nc/2.0/legalcode", "35bfa32370d94a02d195222e876d48fe5e2bd58c", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-2.5.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-2.5.json" ) - .name( "Creative Commons Attribution Non Commercial 2.5 Generic" ) - .licenseId( "CC-BY-NC-2.5" ) - .seeAlso( "https://creativecommons.org/licenses/by-nc/2.5/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nc/2.5/legalcode", "88ae72783ef4d55eb5eac0256fb9cbefee9d10cd", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nc/2.5/legalcode", "88ae72783ef4d55eb5eac0256fb9cbefee9d10cd", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nc/2.5/legalcode", "88ae72783ef4d55eb5eac0256fb9cbefee9d10cd", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nc/2.5/legalcode", "88ae72783ef4d55eb5eac0256fb9cbefee9d10cd", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-3.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-3.0.json" ) - .name( "Creative Commons Attribution Non Commercial 3.0 Unported" ) - .licenseId( "CC-BY-NC-3.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nc/3.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nc/3.0/legalcode", "7da12f32b86edbafa37e0e1ce8072271a5b99a33", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nc/3.0/legalcode", "7da12f32b86edbafa37e0e1ce8072271a5b99a33", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nc/3.0/legalcode", "7da12f32b86edbafa37e0e1ce8072271a5b99a33", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nc/3.0/legalcode", "7da12f32b86edbafa37e0e1ce8072271a5b99a33", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-4.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-4.0.json" ) - .name( "Creative Commons Attribution Non Commercial 4.0 International" ) - .licenseId( "CC-BY-NC-4.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nc/4.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nc/4.0/legalcode", "44476cc5b9fcb74dd435a2d01a429d74dedca620", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nc/4.0/legalcode", "44476cc5b9fcb74dd435a2d01a429d74dedca620", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nc/4.0/legalcode", "44476cc5b9fcb74dd435a2d01a429d74dedca620", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nc/4.0/legalcode", "44476cc5b9fcb74dd435a2d01a429d74dedca620", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-ND-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-ND-1.0.json" ) - .name( "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic" ) - .licenseId( "CC-BY-NC-ND-1.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nd-nc/1.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nd-nc/1.0/legalcode", "b5dc8b5bce982bdb19ed4d29cd898017c34acd6e", "text/html", true, false ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nd-nc/1.0/legalcode", "b5dc8b5bce982bdb19ed4d29cd898017c34acd6e", "text/html", true, false ) - .urlInfo( "https://creativecommons.org/licenses/by-nd-nc/1.0/legalcode", "b5dc8b5bce982bdb19ed4d29cd898017c34acd6e", "text/html", true, false ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nd-nc/1.0/legalcode", "b5dc8b5bce982bdb19ed4d29cd898017c34acd6e", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-ND-2.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-ND-2.0.json" ) - .name( "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic" ) - .licenseId( "CC-BY-NC-ND-2.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nc-nd/2.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nc-nd/2.0/legalcode", "83b8df6fd3e783805bb2ecbc2e435b66697d0e21", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nc-nd/2.0/legalcode", "83b8df6fd3e783805bb2ecbc2e435b66697d0e21", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nc-nd/2.0/legalcode", "83b8df6fd3e783805bb2ecbc2e435b66697d0e21", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nc-nd/2.0/legalcode", "83b8df6fd3e783805bb2ecbc2e435b66697d0e21", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-ND-2.5.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-ND-2.5.json" ) - .name( "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic" ) - .licenseId( "CC-BY-NC-ND-2.5" ) - .seeAlso( "https://creativecommons.org/licenses/by-nc-nd/2.5/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nc-nd/2.5/legalcode", "a24c08f634f31bf44e54167e1c7516fa693d7b16", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nc-nd/2.5/legalcode", "a24c08f634f31bf44e54167e1c7516fa693d7b16", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nc-nd/2.5/legalcode", "a24c08f634f31bf44e54167e1c7516fa693d7b16", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nc-nd/2.5/legalcode", "a24c08f634f31bf44e54167e1c7516fa693d7b16", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-ND-3.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-ND-3.0.json" ) - .name( "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported" ) - .licenseId( "CC-BY-NC-ND-3.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nc-nd/3.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nc-nd/3.0/legalcode", "905faafd2a41dcae56893ded471ce0ea6ff19122", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nc-nd/3.0/legalcode", "905faafd2a41dcae56893ded471ce0ea6ff19122", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nc-nd/3.0/legalcode", "905faafd2a41dcae56893ded471ce0ea6ff19122", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nc-nd/3.0/legalcode", "905faafd2a41dcae56893ded471ce0ea6ff19122", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-ND-4.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-ND-4.0.json" ) - .name( "Creative Commons Attribution Non Commercial No Derivatives 4.0 International" ) - .licenseId( "CC-BY-NC-ND-4.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nc-nd/4.0/legalcode", "8386ae9787526c0e4c8c5d8c404167635a73799b", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nc-nd/4.0/legalcode", "8386ae9787526c0e4c8c5d8c404167635a73799b", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode", "8386ae9787526c0e4c8c5d8c404167635a73799b", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nc-nd/4.0/legalcode", "8386ae9787526c0e4c8c5d8c404167635a73799b", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-SA-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-SA-1.0.json" ) - .name( "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic" ) - .licenseId( "CC-BY-NC-SA-1.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nc-sa/1.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nc-sa/1.0/legalcode", "9c80e0343324f4db3bba0b878100bccca73340fa", "text/html", true, false ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nc-sa/1.0/legalcode", "9c80e0343324f4db3bba0b878100bccca73340fa", "text/html", true, false ) - .urlInfo( "https://creativecommons.org/licenses/by-nc-sa/1.0/legalcode", "9c80e0343324f4db3bba0b878100bccca73340fa", "text/html", true, false ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nc-sa/1.0/legalcode", "9c80e0343324f4db3bba0b878100bccca73340fa", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-SA-2.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-SA-2.0.json" ) - .name( "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic" ) - .licenseId( "CC-BY-NC-SA-2.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nc-sa/2.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode", "9181e9056085ef74e0ba49016fc1a4cb7612ba6d", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nc-sa/2.0/legalcode", "9181e9056085ef74e0ba49016fc1a4cb7612ba6d", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nc-sa/2.0/legalcode", "9181e9056085ef74e0ba49016fc1a4cb7612ba6d", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nc-sa/2.0/legalcode", "9181e9056085ef74e0ba49016fc1a4cb7612ba6d", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-SA-2.5.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-SA-2.5.json" ) - .name( "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic" ) - .licenseId( "CC-BY-NC-SA-2.5" ) - .seeAlso( "https://creativecommons.org/licenses/by-nc-sa/2.5/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nc-sa/2.5/legalcode", "4c4f5e5f2b0810f94da50c9847b7507d04019850", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nc-sa/2.5/legalcode", "4c4f5e5f2b0810f94da50c9847b7507d04019850", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nc-sa/2.5/legalcode", "4c4f5e5f2b0810f94da50c9847b7507d04019850", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nc-sa/2.5/legalcode", "4c4f5e5f2b0810f94da50c9847b7507d04019850", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-SA-3.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-SA-3.0.json" ) - .name( "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported" ) - .licenseId( "CC-BY-NC-SA-3.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nc-sa/3.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode", "236903de80ec689d31a25a290e28127ec7ed5d35", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nc-sa/3.0/legalcode", "236903de80ec689d31a25a290e28127ec7ed5d35", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nc-sa/3.0/legalcode", "236903de80ec689d31a25a290e28127ec7ed5d35", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nc-sa/3.0/legalcode", "236903de80ec689d31a25a290e28127ec7ed5d35", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-NC-SA-4.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-NC-SA-4.0.json" ) - .name( "Creative Commons Attribution Non Commercial Share Alike 4.0 International" ) - .licenseId( "CC-BY-NC-SA-4.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nc-sa/4.0/legalcode", "d44a48e6b76e70dc0b07c108001ff32ab8e049ca", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nc-sa/4.0/legalcode", "d44a48e6b76e70dc0b07c108001ff32ab8e049ca", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode", "d44a48e6b76e70dc0b07c108001ff32ab8e049ca", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nc-sa/4.0/legalcode", "d44a48e6b76e70dc0b07c108001ff32ab8e049ca", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-ND-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-ND-1.0.json" ) - .name( "Creative Commons Attribution No Derivatives 1.0 Generic" ) - .licenseId( "CC-BY-ND-1.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nd/1.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nd/1.0/legalcode", "f42d2af0c110f153bc2dc0e807525485a281ecc4", "text/html", true, false ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nd/1.0/legalcode", "f42d2af0c110f153bc2dc0e807525485a281ecc4", "text/html", true, false ) - .urlInfo( "https://creativecommons.org/licenses/by-nd/1.0/legalcode", "f42d2af0c110f153bc2dc0e807525485a281ecc4", "text/html", true, false ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nd/1.0/legalcode", "f42d2af0c110f153bc2dc0e807525485a281ecc4", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-ND-2.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-ND-2.0.json" ) - .name( "Creative Commons Attribution No Derivatives 2.0 Generic" ) - .licenseId( "CC-BY-ND-2.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nd/2.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nd/2.0/legalcode", "7efbd82e4f5c5d776b4719ed088932749783b3aa", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nd/2.0/legalcode", "7efbd82e4f5c5d776b4719ed088932749783b3aa", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nd/2.0/legalcode", "7efbd82e4f5c5d776b4719ed088932749783b3aa", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nd/2.0/legalcode", "7efbd82e4f5c5d776b4719ed088932749783b3aa", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-ND-2.5.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-ND-2.5.json" ) - .name( "Creative Commons Attribution No Derivatives 2.5 Generic" ) - .licenseId( "CC-BY-ND-2.5" ) - .seeAlso( "https://creativecommons.org/licenses/by-nd/2.5/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nd/2.5/legalcode", "3afdf363d0504cb517c1bc081804631e24e830f6", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nd/2.5/legalcode", "3afdf363d0504cb517c1bc081804631e24e830f6", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nd/2.5/legalcode", "3afdf363d0504cb517c1bc081804631e24e830f6", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nd/2.5/legalcode", "3afdf363d0504cb517c1bc081804631e24e830f6", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-ND-3.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-ND-3.0.json" ) - .name( "Creative Commons Attribution No Derivatives 3.0 Unported" ) - .licenseId( "CC-BY-ND-3.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nd/3.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nd/3.0/legalcode", "8d14e944cf055939e6904348c44c6694fcca7b83", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nd/3.0/legalcode", "8d14e944cf055939e6904348c44c6694fcca7b83", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nd/3.0/legalcode", "8d14e944cf055939e6904348c44c6694fcca7b83", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nd/3.0/legalcode", "8d14e944cf055939e6904348c44c6694fcca7b83", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-ND-4.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-ND-4.0.json" ) - .name( "Creative Commons Attribution No Derivatives 4.0 International" ) - .licenseId( "CC-BY-ND-4.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-nd/4.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-nd/4.0/legalcode", "2de28c0e56f9df3efba0478521b9954863ee7725", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-nd/4.0/legalcode", "2de28c0e56f9df3efba0478521b9954863ee7725", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-nd/4.0/legalcode", "2de28c0e56f9df3efba0478521b9954863ee7725", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-nd/4.0/legalcode", "2de28c0e56f9df3efba0478521b9954863ee7725", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-SA-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-SA-1.0.json" ) - .name( "Creative Commons Attribution Share Alike 1.0 Generic" ) - .licenseId( "CC-BY-SA-1.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-sa/1.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-sa/1.0/legalcode", "8748536485ffd39b12479949c42bbd0545e71f93", "text/html", true, false ) - .urlInfo( "http://www.creativecommons.org/licenses/by-sa/1.0/legalcode", "8748536485ffd39b12479949c42bbd0545e71f93", "text/html", true, false ) - .urlInfo( "https://creativecommons.org/licenses/by-sa/1.0/legalcode", "8748536485ffd39b12479949c42bbd0545e71f93", "text/html", true, false ) - .urlInfo( "https://www.creativecommons.org/licenses/by-sa/1.0/legalcode", "8748536485ffd39b12479949c42bbd0545e71f93", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-SA-2.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-SA-2.0.json" ) - .name( "Creative Commons Attribution Share Alike 2.0 Generic" ) - .licenseId( "CC-BY-SA-2.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-sa/2.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-sa/2.0/legalcode", "a6604d95391331067a17b697dc5f5571899119a2", "text/html", true, false ) - .urlInfo( "http://www.creativecommons.org/licenses/by-sa/2.0/legalcode", "a6604d95391331067a17b697dc5f5571899119a2", "text/html", true, false ) - .urlInfo( "https://creativecommons.org/licenses/by-sa/2.0/legalcode", "a6604d95391331067a17b697dc5f5571899119a2", "text/html", true, false ) - .urlInfo( "https://www.creativecommons.org/licenses/by-sa/2.0/legalcode", "a6604d95391331067a17b697dc5f5571899119a2", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-SA-2.5.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-SA-2.5.json" ) - .name( "Creative Commons Attribution Share Alike 2.5 Generic" ) - .licenseId( "CC-BY-SA-2.5" ) - .seeAlso( "https://creativecommons.org/licenses/by-sa/2.5/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-sa/2.5/legalcode", "4ed0178a9b2d773ffc849c18f5884c277d2a4e86", "text/html", true, false ) - .urlInfo( "http://www.creativecommons.org/licenses/by-sa/2.5/legalcode", "4ed0178a9b2d773ffc849c18f5884c277d2a4e86", "text/html", true, false ) - .urlInfo( "https://creativecommons.org/licenses/by-sa/2.5/legalcode", "4ed0178a9b2d773ffc849c18f5884c277d2a4e86", "text/html", true, false ) - .urlInfo( "https://www.creativecommons.org/licenses/by-sa/2.5/legalcode", "4ed0178a9b2d773ffc849c18f5884c277d2a4e86", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-SA-3.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-SA-3.0.json" ) - .name( "Creative Commons Attribution Share Alike 3.0 Unported" ) - .licenseId( "CC-BY-SA-3.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-sa/3.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-sa/3.0/legalcode", "d0ac1cd99deeca8d3241f0cb1035b653cc947358", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/licenses/by-sa/3.0/legalcode", "d0ac1cd99deeca8d3241f0cb1035b653cc947358", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-sa/3.0/legalcode", "d0ac1cd99deeca8d3241f0cb1035b653cc947358", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-sa/3.0/legalcode", "d0ac1cd99deeca8d3241f0cb1035b653cc947358", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC-BY-SA-4.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/CC-BY-SA-4.0.json" ) - .name( "Creative Commons Attribution Share Alike 4.0 International" ) - .licenseId( "CC-BY-SA-4.0" ) - .seeAlso( "https://creativecommons.org/licenses/by-sa/4.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/licenses/by-sa/4.0/legalcode", "2db7dade1d369cc2e1298a2d6d7c47410819682d", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/licenses/by-sa/4.0/legalcode", "2db7dade1d369cc2e1298a2d6d7c47410819682d", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/licenses/by-sa/4.0/legalcode", "2db7dade1d369cc2e1298a2d6d7c47410819682d", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CC0-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/CC0-1.0.json" ) - .name( "Creative Commons Zero v1.0 Universal" ) - .licenseId( "CC0-1.0" ) - .seeAlso( "https://creativecommons.org/publicdomain/zero/1.0/legalcode" ) - - .urlInfo( "http://creativecommons.org/publicdomain/zero/1.0/legalcode", "21ad4b5a341800e1ece53b5fd9d7bd7b89692fbc", "text/html", true, true ) - .urlInfo( "http://www.creativecommons.org/publicdomain/zero/1.0/legalcode", "21ad4b5a341800e1ece53b5fd9d7bd7b89692fbc", "text/html", true, true ) - .urlInfo( "https://creativecommons.org/publicdomain/zero/1.0/legalcode", "21ad4b5a341800e1ece53b5fd9d7bd7b89692fbc", "text/html", true, true ) - .urlInfo( "https://www.creativecommons.org/publicdomain/zero/1.0/legalcode", "21ad4b5a341800e1ece53b5fd9d7bd7b89692fbc", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CDDL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/CDDL-1.0.json" ) - .name( "Common Development and Distribution License 1.0" ) - .licenseId( "CDDL-1.0" ) - .seeAlso( "https://opensource.org/licenses/cddl1" ) - - .urlInfo( "http://opensource.org/licenses/cddl1", "58bf0d7faa358fc2d7eb132448544100c4330264", "text/html", false, true ) - .urlInfo( "http://opensource.org/licenses/cddl1.html", "58bf0d7faa358fc2d7eb132448544100c4330264", "text/html", false, true ) - .urlInfo( "http://opensource.org/licenses/cddl1.php", "58bf0d7faa358fc2d7eb132448544100c4330264", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/cddl1", "58bf0d7faa358fc2d7eb132448544100c4330264", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/cddl1.html", "58bf0d7faa358fc2d7eb132448544100c4330264", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/cddl1.php", "58bf0d7faa358fc2d7eb132448544100c4330264", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/cddl1", "58bf0d7faa358fc2d7eb132448544100c4330264", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/cddl1.html", "58bf0d7faa358fc2d7eb132448544100c4330264", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/cddl1.php", "58bf0d7faa358fc2d7eb132448544100c4330264", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/cddl1", "58bf0d7faa358fc2d7eb132448544100c4330264", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/cddl1.html", "58bf0d7faa358fc2d7eb132448544100c4330264", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/cddl1.php", "58bf0d7faa358fc2d7eb132448544100c4330264", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CDDL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CDDL-1.1.json" ) - .name( "Common Development and Distribution License 1.1" ) - .licenseId( "CDDL-1.1" ) - .seeAlso( "http://glassfish.java.net/public/CDDL+GPL_1_1.html" ) - .seeAlso( "https://javaee.github.io/glassfish/LICENSE" ) - - .urlInfo( "http://glassfish.java.net/public/CDDL+GPL_1_1.html", "047abb20f37c1629c82db23d99783e41207c2564", "text/html", true, false ) - .urlInfo( "https://glassfish.java.net/public/CDDL+GPL_1_1.html", "047abb20f37c1629c82db23d99783e41207c2564", "text/html", true, false ) - .urlInfo( "http://javaee.github.io/glassfish/LICENSE", "09e401981fad6a8cbeea3173b9ea9c4a2c95610a", "text/html", true, false ) - .urlInfo( "https://javaee.github.io/glassfish/LICENSE", "09e401981fad6a8cbeea3173b9ea9c4a2c95610a", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CDLA-Permissive-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CDLA-Permissive-1.0.json" ) - .name( "Community Data License Agreement Permissive 1.0" ) - .licenseId( "CDLA-Permissive-1.0" ) - .seeAlso( "https://cdla.io/permissive-1-0" ) - - .urlInfo( "https://cdla.io/permissive-1-0", null, null, false, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CDLA-Sharing-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CDLA-Sharing-1.0.json" ) - .name( "Community Data License Agreement Sharing 1.0" ) - .licenseId( "CDLA-Sharing-1.0" ) - .seeAlso( "https://cdla.io/sharing-1-0" ) - - .urlInfo( "https://cdla.io/sharing-1-0", null, null, false, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CECILL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CECILL-1.0.json" ) - .name( "CeCILL Free Software License Agreement v1.0" ) - .licenseId( "CECILL-1.0" ) - .seeAlso( "http://www.cecill.info/licences/Licence_CeCILL_V1-fr.html" ) - - .urlInfo( "http://cecill.info/licences/Licence_CeCILL_V1-fr.html", "f17da26e34780330205e0fccdda4f2804f58de0f", "text/html", true, false ) - .urlInfo( "http://www.cecill.info/licences/Licence_CeCILL_V1-fr.html", "f17da26e34780330205e0fccdda4f2804f58de0f", "text/html", true, false ) - .urlInfo( "https://cecill.info/licences/Licence_CeCILL_V1-fr.html", "f17da26e34780330205e0fccdda4f2804f58de0f", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CECILL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CECILL-1.1.json" ) - .name( "CeCILL Free Software License Agreement v1.1" ) - .licenseId( "CECILL-1.1" ) - .seeAlso( "http://www.cecill.info/licences/Licence_CeCILL_V1.1-US.html" ) - - .urlInfo( "http://cecill.info/licences/Licence_CeCILL_V1.1-US.html", "aa6f3f6ec2ddea7c007f2a03c7388ce5b828e0d0", "text/html", true, false ) - .urlInfo( "http://www.cecill.info/licences/Licence_CeCILL_V1.1-US.html", "aa6f3f6ec2ddea7c007f2a03c7388ce5b828e0d0", "text/html", true, false ) - .urlInfo( "https://cecill.info/licences/Licence_CeCILL_V1.1-US.html", "aa6f3f6ec2ddea7c007f2a03c7388ce5b828e0d0", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CECILL-2.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/CECILL-2.0.json" ) - .name( "CeCILL Free Software License Agreement v2.0" ) - .licenseId( "CECILL-2.0" ) - .seeAlso( "http://www.cecill.info/licences/Licence_CeCILL_V2-en.html" ) - - .urlInfo( "http://cecill.info/licences/Licence_CeCILL_V2-en.html", "93a69271faa4f031dc2ccde64140cb7743ab9e3e", "text/html", true, false ) - .urlInfo( "http://www.cecill.info/licences/Licence_CeCILL_V2-en.html", "93a69271faa4f031dc2ccde64140cb7743ab9e3e", "text/html", true, false ) - .urlInfo( "https://cecill.info/licences/Licence_CeCILL_V2-en.html", "93a69271faa4f031dc2ccde64140cb7743ab9e3e", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CECILL-2.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CECILL-2.1.json" ) - .name( "CeCILL Free Software License Agreement v2.1" ) - .licenseId( "CECILL-2.1" ) - .seeAlso( "http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.html" ) - - .urlInfo( "http://cecill.info/licences/Licence_CeCILL_V2.1-en.html", "929cdbfd392146302d80a5d50b320c7912edd4e9", "text/html", true, false ) - .urlInfo( "http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.html", "929cdbfd392146302d80a5d50b320c7912edd4e9", "text/html", true, false ) - .urlInfo( "https://cecill.info/licences/Licence_CeCILL_V2.1-en.html", "929cdbfd392146302d80a5d50b320c7912edd4e9", "text/html", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CECILL-B.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/CECILL-B.json" ) - .name( "CeCILL-B Free Software License Agreement" ) - .licenseId( "CECILL-B" ) - .seeAlso( "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html" ) - - .urlInfo( "http://cecill.info/licences/Licence_CeCILL-B_V1-en.html", "886d89c8a46947091e395d6adeed081df0f04846", "text/html", true, false ) - .urlInfo( "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html", "886d89c8a46947091e395d6adeed081df0f04846", "text/html", true, false ) - .urlInfo( "https://cecill.info/licences/Licence_CeCILL-B_V1-en.html", "886d89c8a46947091e395d6adeed081df0f04846", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CECILL-C.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/CECILL-C.json" ) - .name( "CeCILL-C Free Software License Agreement" ) - .licenseId( "CECILL-C" ) - .seeAlso( "http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.html" ) - - .urlInfo( "http://cecill.info/licences/Licence_CeCILL-C_V1-en.html", "273cc1c96fa23a8211f27876ed4b7f7b8e4285fd", "text/html", true, false ) - .urlInfo( "http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.html", "273cc1c96fa23a8211f27876ed4b7f7b8e4285fd", "text/html", true, false ) - .urlInfo( "https://cecill.info/licences/Licence_CeCILL-C_V1-en.html", "273cc1c96fa23a8211f27876ed4b7f7b8e4285fd", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CERN-OHL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CERN-OHL-1.1.json" ) - .name( "CERN Open Hardware License v1.1" ) - .licenseId( "CERN-OHL-1.1" ) - .seeAlso( "https://www.ohwr.org/project/licenses/wikis/cern-ohl-v1.1" ) - - .urlInfo( "https://www.ohwr.org/project/licenses/wikis/cern-ohl-v1.1", "a3a47f2aeda2a93024b9b05f6b8d0c0b63dfd177", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CERN-OHL-1.2.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CERN-OHL-1.2.json" ) - .name( "CERN Open Hardware Licence v1.2" ) - .licenseId( "CERN-OHL-1.2" ) - .seeAlso( "https://www.ohwr.org/project/licenses/wikis/cern-ohl-v1.2" ) - - .urlInfo( "https://www.ohwr.org/project/licenses/wikis/cern-ohl-v1.2", "ffa0b932fbebef003c8b498bce218e287a506686", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CNRI-Jython.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CNRI-Jython.json" ) - .name( "CNRI Jython License" ) - .licenseId( "CNRI-Jython" ) - .seeAlso( "http://www.jython.org/license.html" ) - - .urlInfo( "http://jython.org/license.html", "810432eb0f42ead5997cbaed87dd8f8db0125319", "text/html", true, false ) - .urlInfo( "http://www.jython.org/license.html", "810432eb0f42ead5997cbaed87dd8f8db0125319", "text/html", true, false ) - .urlInfo( "https://jython.org/license.html", "810432eb0f42ead5997cbaed87dd8f8db0125319", "text/html", true, false ) - .urlInfo( "https://www.jython.org/license.html", "810432eb0f42ead5997cbaed87dd8f8db0125319", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CNRI-Python.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CNRI-Python.json" ) - .name( "CNRI Python License" ) - .licenseId( "CNRI-Python" ) - .seeAlso( "https://opensource.org/licenses/CNRI-Python" ) - - .urlInfo( "http://opensource.org/licenses/CNRI-Python", "35687aea838758505b7b1b8944efa0f4b1313298", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/CNRI-Python", "35687aea838758505b7b1b8944efa0f4b1313298", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/CNRI-Python", "35687aea838758505b7b1b8944efa0f4b1313298", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/CNRI-Python", "35687aea838758505b7b1b8944efa0f4b1313298", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CNRI-Python-GPL-Compatible.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CNRI-Python-GPL-Compatible.json" ) - .name( "CNRI Python Open Source GPL Compatible License Agreement" ) - .licenseId( "CNRI-Python-GPL-Compatible" ) - .seeAlso( "http://www.python.org/download/releases/1.6.1/download_win/" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CPAL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/CPAL-1.0.json" ) - .name( "Common Public Attribution License 1.0" ) - .licenseId( "CPAL-1.0" ) - .seeAlso( "https://opensource.org/licenses/CPAL-1.0" ) - - .urlInfo( "http://opensource.org/licenses/CPAL-1.0", "55783ad397acffef2f88373534f669319f2c542b", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/CPAL-1.0", "55783ad397acffef2f88373534f669319f2c542b", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/CPAL-1.0", "55783ad397acffef2f88373534f669319f2c542b", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/CPAL-1.0", "55783ad397acffef2f88373534f669319f2c542b", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/CPL-1.0.json" ) - .name( "Common Public License 1.0" ) - .licenseId( "CPL-1.0" ) - .seeAlso( "https://opensource.org/licenses/CPL-1.0" ) - - .urlInfo( "http://opensource.org/licenses/CPL-1.0", "8a873c13bfa2848f82a9161aee2f63ea4a667799", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/CPL-1.0", "8a873c13bfa2848f82a9161aee2f63ea4a667799", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/CPL-1.0", "8a873c13bfa2848f82a9161aee2f63ea4a667799", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/CPL-1.0", "8a873c13bfa2848f82a9161aee2f63ea4a667799", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CPOL-1.02.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CPOL-1.02.json" ) - .name( "Code Project Open License 1.02" ) - .licenseId( "CPOL-1.02" ) - .seeAlso( "http://www.codeproject.com/info/cpol10.aspx" ) - - .urlInfo( "http://www.codeproject.com/info/cpol10.aspx", null, null, false, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CUA-OPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CUA-OPL-1.0.json" ) - .name( "CUA Office Public License v1.0" ) - .licenseId( "CUA-OPL-1.0" ) - .seeAlso( "https://opensource.org/licenses/CUA-OPL-1.0" ) - - .urlInfo( "http://opensource.org/licenses/CUA-OPL-1.0", "f74b77618705e3081b04500f34a2ad046efb6554", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/CUA-OPL-1.0", "f74b77618705e3081b04500f34a2ad046efb6554", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/CUA-OPL-1.0", "f74b77618705e3081b04500f34a2ad046efb6554", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/CUA-OPL-1.0", "f74b77618705e3081b04500f34a2ad046efb6554", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Caldera.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Caldera.json" ) - .name( "Caldera License" ) - .licenseId( "Caldera" ) - .seeAlso( "http://www.lemis.com/grog/UNIX/ancient-source-all.pdf" ) - - .urlInfo( "http://lemis.com/grog/UNIX/ancient-source-all.pdf", "81d30f492d00e2f5b2be3750bd99e2feb4f0ca33", "application/pdf", true, false ) - .urlInfo( "http://www.lemis.com/grog/UNIX/ancient-source-all.pdf", "81d30f492d00e2f5b2be3750bd99e2feb4f0ca33", "application/pdf", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./ClArtistic.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/ClArtistic.json" ) - .name( "Clarified Artistic License" ) - .licenseId( "ClArtistic" ) - .seeAlso( "http://gianluca.dellavedova.org/2011/01/03/clarified-artistic-license/" ) - .seeAlso( "http://www.ncftp.com/ncftp/doc/LICENSE.txt" ) - - .urlInfo( "http://gianluca.dellavedova.org/2011/01/03/clarified-artistic-license/", null, null, false, true ) - .urlInfo( "http://ncftp.com/ncftp/doc/LICENSE.txt", "f2c53f7a93b26c7f4d0589c907b31df168cea88f", "text/plain", true, false ) - .urlInfo( "http://www.ncftp.com/ncftp/doc/LICENSE.txt", "f2c53f7a93b26c7f4d0589c907b31df168cea88f", "text/plain", true, false ) - .urlInfo( "https://ncftp.com/ncftp/doc/LICENSE.txt", "f2c53f7a93b26c7f4d0589c907b31df168cea88f", "text/plain", true, false ) - .urlInfo( "https://www.ncftp.com/ncftp/doc/LICENSE.txt", "f2c53f7a93b26c7f4d0589c907b31df168cea88f", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Condor-1.1.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Condor-1.1.json" ) - .name( "Condor Public License v1.1" ) - .licenseId( "Condor-1.1" ) - .seeAlso( "http://research.cs.wisc.edu/condor/license.html#condor" ) - .seeAlso( "http://web.archive.org/web/20111123062036/http://research.cs.wisc.edu/condor/license.html#condor" ) - - .urlInfo( "http://research.cs.wisc.edu/condor/license.html#condor", "a4ed29ffd7cc6114ebff053853c3ae196a4c0366", "text/html", true, false ) - .urlInfo( "https://research.cs.wisc.edu/condor/license.html#condor", "a4ed29ffd7cc6114ebff053853c3ae196a4c0366", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Crossword.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Crossword.json" ) - .name( "Crossword License" ) - .licenseId( "Crossword" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Crossword" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Crossword", "dca84c1772142dac70966243518b1c7be48f6fe6", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Crossword", "dca84c1772142dac70966243518b1c7be48f6fe6", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Crossword", "dca84c1772142dac70966243518b1c7be48f6fe6", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Crossword", "dca84c1772142dac70966243518b1c7be48f6fe6", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./CrystalStacker.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/CrystalStacker.json" ) - .name( "CrystalStacker License" ) - .licenseId( "CrystalStacker" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing:CrystalStacker?rd=Licensing/CrystalStacker" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing:CrystalStacker?rd=Licensing/CrystalStacker", "35336ec539fe0a1ce6e050f62dcaf4dbf9b9c381", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing:CrystalStacker?rd=Licensing/CrystalStacker", "35336ec539fe0a1ce6e050f62dcaf4dbf9b9c381", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing:CrystalStacker?rd=Licensing/CrystalStacker", "35336ec539fe0a1ce6e050f62dcaf4dbf9b9c381", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing:CrystalStacker?rd=Licensing/CrystalStacker", "35336ec539fe0a1ce6e050f62dcaf4dbf9b9c381", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Cube.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Cube.json" ) - .name( "Cube License" ) - .licenseId( "Cube" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Cube" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Cube", "8624af85fc9a43bb2e4096f5049e4cd11b03fc3c", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Cube", "8624af85fc9a43bb2e4096f5049e4cd11b03fc3c", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Cube", "8624af85fc9a43bb2e4096f5049e4cd11b03fc3c", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Cube", "8624af85fc9a43bb2e4096f5049e4cd11b03fc3c", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./D-FSL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/D-FSL-1.0.json" ) - .name( "Deutsche Freie Software Lizenz" ) - .licenseId( "D-FSL-1.0" ) - .seeAlso( "http://www.dipp.nrw.de/d-fsl/lizenzen/" ) - .seeAlso( "http://www.dipp.nrw.de/d-fsl/index_html/lizenzen/de/D-FSL-1_0_de.txt" ) - .seeAlso( "http://www.dipp.nrw.de/d-fsl/index_html/lizenzen/en/D-FSL-1_0_en.txt" ) - .seeAlso( "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl" ) - .seeAlso( "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/deutsche-freie-software-lizenz" ) - .seeAlso( "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/german-free-software-license" ) - .seeAlso( "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/D-FSL-1_0_de.txt/at_download/file" ) - .seeAlso( "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/D-FSL-1_0_en.txt/at_download/file" ) - - .urlInfo( "http://hbz-nrw.de/produkte/open-access/lizenzen/dfsl", "a4b5f7f7d4bba587e24aea5554695dfc48f9fcd6", "text/html", true, false ) - .urlInfo( "http://www.dipp.nrw.de/d-fsl/index_html/lizenzen/de/D-FSL-1_0_de.txt", "a4b5f7f7d4bba587e24aea5554695dfc48f9fcd6", "text/html", true, false ) - .urlInfo( "http://www.dipp.nrw.de/d-fsl/index_html/lizenzen/en/D-FSL-1_0_en.txt", "a4b5f7f7d4bba587e24aea5554695dfc48f9fcd6", "text/html", true, false ) - .urlInfo( "http://www.dipp.nrw.de/d-fsl/lizenzen/", "a4b5f7f7d4bba587e24aea5554695dfc48f9fcd6", "text/html", true, false ) - .urlInfo( "http://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl", "a4b5f7f7d4bba587e24aea5554695dfc48f9fcd6", "text/html", true, false ) - .urlInfo( "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl", "a4b5f7f7d4bba587e24aea5554695dfc48f9fcd6", "text/html", true, false ) - .urlInfo( "http://hbz-nrw.de/produkte/open-access/lizenzen/dfsl/deutsche-freie-software-lizenz", "728fc7525ea38a81b9a50ddd3d929dc514b642c8", "text/html", true, false ) - .urlInfo( "http://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/deutsche-freie-software-lizenz", "728fc7525ea38a81b9a50ddd3d929dc514b642c8", "text/html", true, false ) - .urlInfo( "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/deutsche-freie-software-lizenz", "728fc7525ea38a81b9a50ddd3d929dc514b642c8", "text/html", true, false ) - .urlInfo( "http://hbz-nrw.de/produkte/open-access/lizenzen/dfsl/german-free-software-license", "96713f02fd64b9a8899c8608afd2803d3632f16f", "text/html", true, false ) - .urlInfo( "http://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/german-free-software-license", "96713f02fd64b9a8899c8608afd2803d3632f16f", "text/html", true, false ) - .urlInfo( "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/german-free-software-license", "96713f02fd64b9a8899c8608afd2803d3632f16f", "text/html", true, false ) - .urlInfo( "http://hbz-nrw.de/produkte/open-access/lizenzen/dfsl/D-FSL-1_0_de.txt/at_download/file", "030d427e3f2b5cae1bdc081839495e2226898a95", "text/plain", true, false ) - .urlInfo( "http://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/D-FSL-1_0_de.txt/at_download/file", "030d427e3f2b5cae1bdc081839495e2226898a95", "text/plain", true, false ) - .urlInfo( "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/D-FSL-1_0_de.txt/at_download/file", "030d427e3f2b5cae1bdc081839495e2226898a95", "text/plain", true, false ) - .urlInfo( "http://hbz-nrw.de/produkte/open-access/lizenzen/dfsl/D-FSL-1_0_en.txt/at_download/file", "e234377676a736aec560548b260c3d645f1adc40", "text/plain", true, false ) - .urlInfo( "http://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/D-FSL-1_0_en.txt/at_download/file", "e234377676a736aec560548b260c3d645f1adc40", "text/plain", true, false ) - .urlInfo( "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/D-FSL-1_0_en.txt/at_download/file", "e234377676a736aec560548b260c3d645f1adc40", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./DOC.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/DOC.json" ) - .name( "DOC License" ) - .licenseId( "DOC" ) - .seeAlso( "http://www.cs.wustl.edu/~schmidt/ACE-copying.html" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./DSDP.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/DSDP.json" ) - .name( "DSDP License" ) - .licenseId( "DSDP" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/DSDP" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/DSDP", "1a57976934ec53669f9159b8b3fd753ffec072b5", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/DSDP", "1a57976934ec53669f9159b8b3fd753ffec072b5", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/DSDP", "1a57976934ec53669f9159b8b3fd753ffec072b5", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/DSDP", "1a57976934ec53669f9159b8b3fd753ffec072b5", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Dotseqn.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Dotseqn.json" ) - .name( "Dotseqn License" ) - .licenseId( "Dotseqn" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Dotseqn" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Dotseqn", "78273d480140c6c3b631e44ed444bdd85c69162a", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Dotseqn", "78273d480140c6c3b631e44ed444bdd85c69162a", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Dotseqn", "78273d480140c6c3b631e44ed444bdd85c69162a", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Dotseqn", "78273d480140c6c3b631e44ed444bdd85c69162a", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./ECL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/ECL-1.0.json" ) - .name( "Educational Community License v1.0" ) - .licenseId( "ECL-1.0" ) - .seeAlso( "https://opensource.org/licenses/ECL-1.0" ) - - .urlInfo( "http://opensource.org/licenses/ECL-1.0", "756d4f76316b94432bec61f253c229c79e1f0bed", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/ECL-1.0", "756d4f76316b94432bec61f253c229c79e1f0bed", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/ECL-1.0", "756d4f76316b94432bec61f253c229c79e1f0bed", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/ECL-1.0", "756d4f76316b94432bec61f253c229c79e1f0bed", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./ECL-2.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/ECL-2.0.json" ) - .name( "Educational Community License v2.0" ) - .licenseId( "ECL-2.0" ) - .seeAlso( "https://opensource.org/licenses/ECL-2.0" ) - - .urlInfo( "http://opensource.org/licenses/ECL-2.0", "423315e17ae0141c404a9400d8bb996940f1ca56", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/ECL-2.0", "423315e17ae0141c404a9400d8bb996940f1ca56", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/ECL-2.0", "423315e17ae0141c404a9400d8bb996940f1ca56", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/ECL-2.0", "423315e17ae0141c404a9400d8bb996940f1ca56", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./EFL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/EFL-1.0.json" ) - .name( "Eiffel Forum License v1.0" ) - .licenseId( "EFL-1.0" ) - .seeAlso( "http://www.eiffel-nice.org/license/forum.txt" ) - .seeAlso( "https://opensource.org/licenses/EFL-1.0" ) - - .urlInfo( "http://eiffel-nice.org/license/forum.txt", "0187bf4669b68a88a606fcc56026d42f6130a3b5", "text/plain", true, false ) - .urlInfo( "http://www.eiffel-nice.org/license/forum.txt", "0187bf4669b68a88a606fcc56026d42f6130a3b5", "text/plain", true, false ) - .urlInfo( "http://opensource.org/licenses/EFL-1.0", "aa8f11ea9d769a219fdd28e97c798887cc646217", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/EFL-1.0", "aa8f11ea9d769a219fdd28e97c798887cc646217", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/EFL-1.0", "aa8f11ea9d769a219fdd28e97c798887cc646217", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/EFL-1.0", "aa8f11ea9d769a219fdd28e97c798887cc646217", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./EFL-2.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/EFL-2.0.json" ) - .name( "Eiffel Forum License v2.0" ) - .licenseId( "EFL-2.0" ) - .seeAlso( "http://www.eiffel-nice.org/license/eiffel-forum-license-2.html" ) - .seeAlso( "https://opensource.org/licenses/EFL-2.0" ) - - .urlInfo( "http://eiffel-nice.org/license/eiffel-forum-license-2.html", "11a3b6c48679ec916eee3ffbd2378355738cfc46", "text/html", true, false ) - .urlInfo( "http://www.eiffel-nice.org/license/eiffel-forum-license-2.html", "11a3b6c48679ec916eee3ffbd2378355738cfc46", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/EFL-2.0", "c450a027fbe94e77932301d11a0bf8013372551b", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/EFL-2.0", "c450a027fbe94e77932301d11a0bf8013372551b", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/EFL-2.0", "c450a027fbe94e77932301d11a0bf8013372551b", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/EFL-2.0", "c450a027fbe94e77932301d11a0bf8013372551b", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./EPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/EPL-1.0.json" ) - .name( "Eclipse Public License 1.0" ) - .licenseId( "EPL-1.0" ) - .seeAlso( "http://www.eclipse.org/legal/epl-v10.html" ) - .seeAlso( "https://opensource.org/licenses/EPL-1.0" ) - - .urlInfo( "http://eclipse.org/legal/epl-v10.html", "35666c54f2406125707e63edab12f2914d85ca76", "text/html", true, false ) - .urlInfo( "http://www.eclipse.org/legal/epl-v10.html", "35666c54f2406125707e63edab12f2914d85ca76", "text/html", true, false ) - .urlInfo( "https://eclipse.org/legal/epl-v10.html", "35666c54f2406125707e63edab12f2914d85ca76", "text/html", true, false ) - .urlInfo( "https://www.eclipse.org/legal/epl-v10.html", "35666c54f2406125707e63edab12f2914d85ca76", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/EPL-1.0", "9a1b3f8639976267d5bf4da33be618fd572a2771", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/EPL-1.0", "9a1b3f8639976267d5bf4da33be618fd572a2771", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/EPL-1.0", "9a1b3f8639976267d5bf4da33be618fd572a2771", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/EPL-1.0", "9a1b3f8639976267d5bf4da33be618fd572a2771", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./EPL-2.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/EPL-2.0.json" ) - .name( "Eclipse Public License 2.0" ) - .licenseId( "EPL-2.0" ) - .seeAlso( "https://www.eclipse.org/legal/epl-2.0" ) - .seeAlso( "https://www.opensource.org/licenses/EPL-2.0" ) - - .urlInfo( "https://eclipse.org/legal/epl-2.0", "a197dfd57211db1b0f035a87e4c5b5c9e459cfec", "text/html", true, false ) - .urlInfo( "https://www.eclipse.org/legal/epl-2.0", "a197dfd57211db1b0f035a87e4c5b5c9e459cfec", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/EPL-2.0", "fc5019e6631d9a8e913dccee572b11c8ac4f4404", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/EPL-2.0", "fc5019e6631d9a8e913dccee572b11c8ac4f4404", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/EPL-2.0", "fc5019e6631d9a8e913dccee572b11c8ac4f4404", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/EPL-2.0", "fc5019e6631d9a8e913dccee572b11c8ac4f4404", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./EUDatagrid.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/EUDatagrid.json" ) - .name( "EU DataGrid Software License" ) - .licenseId( "EUDatagrid" ) - .seeAlso( "http://eu-datagrid.web.cern.ch/eu-datagrid/license.html" ) - .seeAlso( "https://opensource.org/licenses/EUDatagrid" ) - - .urlInfo( "http://eu-datagrid.web.cern.ch/eu-datagrid/license.html", "9ecab31e2f1f0e909e262d933486bef5066ca386", "text/html", true, true ) - .urlInfo( "https://eu-datagrid.web.cern.ch/eu-datagrid/license.html", "9ecab31e2f1f0e909e262d933486bef5066ca386", "text/html", true, true ) - .urlInfo( "http://opensource.org/licenses/EUDatagrid", "b530e1a24462b7256bcc6e08f92e504afd23f0fd", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/EUDatagrid", "b530e1a24462b7256bcc6e08f92e504afd23f0fd", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/EUDatagrid", "b530e1a24462b7256bcc6e08f92e504afd23f0fd", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/EUDatagrid", "b530e1a24462b7256bcc6e08f92e504afd23f0fd", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./EUPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/EUPL-1.0.json" ) - .name( "European Union Public License 1.0" ) - .licenseId( "EUPL-1.0" ) - .seeAlso( "http://ec.europa.eu/idabc/en/document/7330.html" ) - .seeAlso( "http://ec.europa.eu/idabc/servlets/Doc027f.pdf?id=31096" ) - - .urlInfo( "http://ec.europa.eu/idabc/en/document/7330.html", "0d18bb9db4a45ad4cffefcc150ae07ce0bef9bd1", "text/html", true, false ) - .urlInfo( "http://www.ec.europa.eu/idabc/en/document/7330.html", "0d18bb9db4a45ad4cffefcc150ae07ce0bef9bd1", "text/html", true, false ) - .urlInfo( "http://ec.europa.eu/idabc/servlets/Doc027f.pdf?id=31096", "b5ce3f58aeb32c9d3f4d1d59d4c8a5579d1f345a", "application/pdf", true, false ) - .urlInfo( "http://www.ec.europa.eu/idabc/servlets/Doc027f.pdf?id=31096", "b5ce3f58aeb32c9d3f4d1d59d4c8a5579d1f345a", "application/pdf", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./EUPL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/EUPL-1.1.json" ) - .name( "European Union Public License 1.1" ) - .licenseId( "EUPL-1.1" ) - .seeAlso( "https://joinup.ec.europa.eu/software/page/eupl/licence-eupl" ) - .seeAlso( "https://joinup.ec.europa.eu/sites/default/files/custom-page/attachment/eupl1.1.-licence-en_0.pdf" ) - .seeAlso( "https://opensource.org/licenses/EUPL-1.1" ) - - .urlInfo( "http://joinup.ec.europa.eu/page/eupl-text-11-12", "7121a05d5b7059a019e008a85e1568b1c6f707de", "text/html", true, false ) - .urlInfo( "http://joinup.ec.europa.eu/software/page/eupl/licence-eupl", "7121a05d5b7059a019e008a85e1568b1c6f707de", "text/html", true, false ) - .urlInfo( "https://joinup.ec.europa.eu/page/eupl-text-11-12", "7121a05d5b7059a019e008a85e1568b1c6f707de", "text/html", true, false ) - .urlInfo( "https://joinup.ec.europa.eu/software/page/eupl/licence-eupl", "7121a05d5b7059a019e008a85e1568b1c6f707de", "text/html", true, false ) - .urlInfo( "http://joinup.ec.europa.eu/sites/default/files/custom-page/attachment/eupl1.1.-licence-en_0.pdf", "b91481f1edd91d5fca56ccf4065b63c3269ac6fb", "application/pdf", true, false ) - .urlInfo( "https://joinup.ec.europa.eu/sites/default/files/custom-page/attachment/eupl1.1.-licence-en_0.pdf", "b91481f1edd91d5fca56ccf4065b63c3269ac6fb", "application/pdf", true, false ) - .urlInfo( "http://opensource.org/licenses/EUPL-1.1", "a4f2685aac64b4442e5e2a22a2a8ce6ab638262e", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/EUPL-1.1", "a4f2685aac64b4442e5e2a22a2a8ce6ab638262e", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/EUPL-1.1", "a4f2685aac64b4442e5e2a22a2a8ce6ab638262e", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/EUPL-1.1", "a4f2685aac64b4442e5e2a22a2a8ce6ab638262e", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./EUPL-1.2.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/EUPL-1.2.json" ) - .name( "European Union Public License 1.2" ) - .licenseId( "EUPL-1.2" ) - .seeAlso( "https://joinup.ec.europa.eu/page/eupl-text-11-12" ) - .seeAlso( "https://joinup.ec.europa.eu/sites/default/files/custom-page/attachment/eupl_v1.2_en.pdf" ) - .seeAlso( "https://joinup.ec.europa.eu/sites/default/files/inline-files/EUPL%20v1_2%20EN(1).txt" ) - .seeAlso( "http://eur-lex.europa.eu/legal-content/EN/TXT/HTML/?uri=CELEX:32017D0863" ) - .seeAlso( "https://opensource.org/licenses/EUPL-1.1" ) - - .urlInfo( "http://joinup.ec.europa.eu/page/eupl-text-11-12", "7121a05d5b7059a019e008a85e1568b1c6f707de", "text/html", true, false ) - .urlInfo( "http://joinup.ec.europa.eu/software/page/eupl/licence-eupl", "7121a05d5b7059a019e008a85e1568b1c6f707de", "text/html", true, false ) - .urlInfo( "https://joinup.ec.europa.eu/page/eupl-text-11-12", "7121a05d5b7059a019e008a85e1568b1c6f707de", "text/html", true, false ) - .urlInfo( "https://joinup.ec.europa.eu/software/page/eupl/licence-eupl", "7121a05d5b7059a019e008a85e1568b1c6f707de", "text/html", true, false ) - .urlInfo( "http://joinup.ec.europa.eu/sites/default/files/custom-page/attachment/eupl_v1.2_en.pdf", "e512a96949c79498ad1a59d6553ddf694ef44666", "application/pdf", true, false ) - .urlInfo( "https://joinup.ec.europa.eu/sites/default/files/custom-page/attachment/eupl_v1.2_en.pdf", "e512a96949c79498ad1a59d6553ddf694ef44666", "application/pdf", true, false ) - .urlInfo( "http://joinup.ec.europa.eu/sites/default/files/inline-files/EUPL%20v1_2%20EN(1).txt", "0ecda5d95dd354eaad18d0e72f6560e70fc78f74", "text/plain", true, false ) - .urlInfo( "https://joinup.ec.europa.eu/sites/default/files/inline-files/EUPL%20v1_2%20EN(1).txt", "0ecda5d95dd354eaad18d0e72f6560e70fc78f74", "text/plain", true, false ) - .urlInfo( "http://eur-lex.europa.eu/legal-content/EN/TXT/HTML/?uri=CELEX:32017D0863", "56d6faabaf70c78c28c825bf74fb82aaa82972ba", "text/html", true, false ) - .urlInfo( "http://www.eur-lex.europa.eu/legal-content/EN/TXT/HTML/?uri=CELEX:32017D0863", "56d6faabaf70c78c28c825bf74fb82aaa82972ba", "text/html", true, false ) - .urlInfo( "https://eur-lex.europa.eu/legal-content/EN/TXT/HTML/?uri=CELEX:32017D0863", "56d6faabaf70c78c28c825bf74fb82aaa82972ba", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/EUPL-1.1", "a4f2685aac64b4442e5e2a22a2a8ce6ab638262e", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/EUPL-1.1", "a4f2685aac64b4442e5e2a22a2a8ce6ab638262e", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/EUPL-1.1", "a4f2685aac64b4442e5e2a22a2a8ce6ab638262e", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/EUPL-1.1", "a4f2685aac64b4442e5e2a22a2a8ce6ab638262e", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Entessa.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Entessa.json" ) - .name( "Entessa Public License v1.0" ) - .licenseId( "Entessa" ) - .seeAlso( "https://opensource.org/licenses/Entessa" ) - - .urlInfo( "http://opensource.org/licenses/Entessa", "e0983f23de64af5f557bc25607b292e0de15e1d8", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Entessa", "e0983f23de64af5f557bc25607b292e0de15e1d8", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Entessa", "e0983f23de64af5f557bc25607b292e0de15e1d8", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Entessa", "e0983f23de64af5f557bc25607b292e0de15e1d8", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./ErlPL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/ErlPL-1.1.json" ) - .name( "Erlang Public License v1.1" ) - .licenseId( "ErlPL-1.1" ) - .seeAlso( "http://www.erlang.org/EPLICENSE" ) - - .urlInfo( "http://erlang.org/EPLICENSE", "4f3186bd48be9b2cd3bc12bc7a4c9cba6d1ecf59", "text/plain", true, false ) - .urlInfo( "http://www.erlang.org/EPLICENSE", "4f3186bd48be9b2cd3bc12bc7a4c9cba6d1ecf59", "text/plain", true, false ) - .urlInfo( "https://www.erlang.org/EPLICENSE", "4f3186bd48be9b2cd3bc12bc7a4c9cba6d1ecf59", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Eurosym.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Eurosym.json" ) - .name( "Eurosym License" ) - .licenseId( "Eurosym" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Eurosym" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Eurosym", "27605ac5de8d1c17474be6a466ee6ecaaa2cd7a5", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Eurosym", "27605ac5de8d1c17474be6a466ee6ecaaa2cd7a5", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Eurosym", "27605ac5de8d1c17474be6a466ee6ecaaa2cd7a5", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Eurosym", "27605ac5de8d1c17474be6a466ee6ecaaa2cd7a5", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./FSFAP.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/FSFAP.json" ) - .name( "FSF All Permissive License" ) - .licenseId( "FSFAP" ) - .seeAlso( "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html" ) - - .urlInfo( "http://gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html", "9b08601db9e28dc8d20c9f7fb1ab07c9f802446c", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html", "9b08601db9e28dc8d20c9f7fb1ab07c9f802446c", "text/html", true, false ) - .urlInfo( "https://gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html", "9b08601db9e28dc8d20c9f7fb1ab07c9f802446c", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html", "9b08601db9e28dc8d20c9f7fb1ab07c9f802446c", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./FSFUL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/FSFUL.json" ) - .name( "FSF Unlimited License" ) - .licenseId( "FSFUL" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/FSF_Unlimited_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/FSF_Unlimited_License", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/FSF_Unlimited_License#License_Retention_Variant", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/FSF_Unlimited_License", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/FSF_Unlimited_License#License_Retention_Variant", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/FSF_Unlimited_License", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/FSF_Unlimited_License#License_Retention_Variant", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/FSF_Unlimited_License", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/FSF_Unlimited_License#License_Retention_Variant", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./FSFULLR.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/FSFULLR.json" ) - .name( "FSF Unlimited License (with License Retention)" ) - .licenseId( "FSFULLR" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/FSF_Unlimited_License#License_Retention_Variant" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/FSF_Unlimited_License", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/FSF_Unlimited_License#License_Retention_Variant", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/FSF_Unlimited_License", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/FSF_Unlimited_License#License_Retention_Variant", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/FSF_Unlimited_License", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/FSF_Unlimited_License#License_Retention_Variant", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/FSF_Unlimited_License", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/FSF_Unlimited_License#License_Retention_Variant", "92d6360f648278de21e329ae8bc5b9b8288c86c3", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./FTL.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/FTL.json" ) - .name( "Freetype Project License" ) - .licenseId( "FTL" ) - .seeAlso( "http://freetype.fis.uniroma2.it/FTL.TXT" ) - .seeAlso( "http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/FTL.TXT" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Fair.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Fair.json" ) - .name( "Fair License" ) - .licenseId( "Fair" ) - .seeAlso( "http://fairlicense.org/" ) - .seeAlso( "https://opensource.org/licenses/Fair" ) - - .urlInfo( "http://fairlicense.org/", "f458d76f7b9e27fdf2d9e407c504f8142d6e1037", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/Fair", "c2db99c6033406b81b84635a6af07ea7e1f5aa17", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Fair", "c2db99c6033406b81b84635a6af07ea7e1f5aa17", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Fair", "c2db99c6033406b81b84635a6af07ea7e1f5aa17", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Fair", "c2db99c6033406b81b84635a6af07ea7e1f5aa17", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Frameworx-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Frameworx-1.0.json" ) - .name( "Frameworx Open License 1.0" ) - .licenseId( "Frameworx-1.0" ) - .seeAlso( "https://opensource.org/licenses/Frameworx-1.0" ) - - .urlInfo( "http://opensource.org/licenses/Frameworx-1.0", "4a1b6fe365763d63b5eb537c1de24145399222bd", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Frameworx-1.0", "4a1b6fe365763d63b5eb537c1de24145399222bd", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Frameworx-1.0", "4a1b6fe365763d63b5eb537c1de24145399222bd", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Frameworx-1.0", "4a1b6fe365763d63b5eb537c1de24145399222bd", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./FreeImage.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/FreeImage.json" ) - .name( "FreeImage Public License v1.0" ) - .licenseId( "FreeImage" ) - .seeAlso( "http://freeimage.sourceforge.net/freeimage-license.txt" ) - - .urlInfo( "http://freeimage.sourceforge.net/freeimage-license.txt", "0ca251a586f81fb996e02f5391eff7c20f914fa6", "text/plain", true, false ) - .urlInfo( "http://www.freeimage.sourceforge.net/freeimage-license.txt", "0ca251a586f81fb996e02f5391eff7c20f914fa6", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GFDL-1.1.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GFDL-1.1.json" ) - .name( "GNU Free Documentation License v1.1" ) - .licenseId( "GFDL-1.1" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/fdl-1.1.txt", "7205ad2e7451e9c4a518d105d5144987cdaf9bfa", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/fdl-1.1.txt", "7205ad2e7451e9c4a518d105d5144987cdaf9bfa", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/fdl-1.1.txt", "7205ad2e7451e9c4a518d105d5144987cdaf9bfa", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt", "7205ad2e7451e9c4a518d105d5144987cdaf9bfa", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GFDL-1.1-only.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GFDL-1.1-only.json" ) - .name( "GNU Free Documentation License v1.1 only" ) - .licenseId( "GFDL-1.1-only" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/fdl-1.1.txt", "7205ad2e7451e9c4a518d105d5144987cdaf9bfa", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/fdl-1.1.txt", "7205ad2e7451e9c4a518d105d5144987cdaf9bfa", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/fdl-1.1.txt", "7205ad2e7451e9c4a518d105d5144987cdaf9bfa", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt", "7205ad2e7451e9c4a518d105d5144987cdaf9bfa", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GFDL-1.1-or-later.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GFDL-1.1-or-later.json" ) - .name( "GNU Free Documentation License v1.1 or later" ) - .licenseId( "GFDL-1.1-or-later" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/fdl-1.1.txt", "7205ad2e7451e9c4a518d105d5144987cdaf9bfa", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/fdl-1.1.txt", "7205ad2e7451e9c4a518d105d5144987cdaf9bfa", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/fdl-1.1.txt", "7205ad2e7451e9c4a518d105d5144987cdaf9bfa", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt", "7205ad2e7451e9c4a518d105d5144987cdaf9bfa", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GFDL-1.2.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GFDL-1.2.json" ) - .name( "GNU Free Documentation License v1.2" ) - .licenseId( "GFDL-1.2" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/fdl-1.2.txt" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/fdl-1.2.txt", "e436bc68467a0ad3edc01af3189fa4aa04af9302", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/fdl-1.2.txt", "e436bc68467a0ad3edc01af3189fa4aa04af9302", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/fdl-1.2.txt", "e436bc68467a0ad3edc01af3189fa4aa04af9302", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/fdl-1.2.txt", "e436bc68467a0ad3edc01af3189fa4aa04af9302", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GFDL-1.2-only.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GFDL-1.2-only.json" ) - .name( "GNU Free Documentation License v1.2 only" ) - .licenseId( "GFDL-1.2-only" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/fdl-1.2.txt" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/fdl-1.2.txt", "e436bc68467a0ad3edc01af3189fa4aa04af9302", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/fdl-1.2.txt", "e436bc68467a0ad3edc01af3189fa4aa04af9302", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/fdl-1.2.txt", "e436bc68467a0ad3edc01af3189fa4aa04af9302", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/fdl-1.2.txt", "e436bc68467a0ad3edc01af3189fa4aa04af9302", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GFDL-1.2-or-later.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GFDL-1.2-or-later.json" ) - .name( "GNU Free Documentation License v1.2 or later" ) - .licenseId( "GFDL-1.2-or-later" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/fdl-1.2.txt" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/fdl-1.2.txt", "e436bc68467a0ad3edc01af3189fa4aa04af9302", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/fdl-1.2.txt", "e436bc68467a0ad3edc01af3189fa4aa04af9302", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/fdl-1.2.txt", "e436bc68467a0ad3edc01af3189fa4aa04af9302", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/fdl-1.2.txt", "e436bc68467a0ad3edc01af3189fa4aa04af9302", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GFDL-1.3.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GFDL-1.3.json" ) - .name( "GNU Free Documentation License v1.3" ) - .licenseId( "GFDL-1.3" ) - .seeAlso( "https://www.gnu.org/licenses/fdl-1.3.txt" ) - - .urlInfo( "http://gnu.org/licenses/fdl-1.3.txt", "8bdbff3486abb874fd8870d5b6866ee6d1c44f0f", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/fdl-1.3.txt", "8bdbff3486abb874fd8870d5b6866ee6d1c44f0f", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/fdl-1.3.txt", "8bdbff3486abb874fd8870d5b6866ee6d1c44f0f", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/fdl-1.3.txt", "8bdbff3486abb874fd8870d5b6866ee6d1c44f0f", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GFDL-1.3-only.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GFDL-1.3-only.json" ) - .name( "GNU Free Documentation License v1.3 only" ) - .licenseId( "GFDL-1.3-only" ) - .seeAlso( "https://www.gnu.org/licenses/fdl-1.3.txt" ) - - .urlInfo( "http://gnu.org/licenses/fdl-1.3.txt", "8bdbff3486abb874fd8870d5b6866ee6d1c44f0f", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/fdl-1.3.txt", "8bdbff3486abb874fd8870d5b6866ee6d1c44f0f", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/fdl-1.3.txt", "8bdbff3486abb874fd8870d5b6866ee6d1c44f0f", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/fdl-1.3.txt", "8bdbff3486abb874fd8870d5b6866ee6d1c44f0f", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GFDL-1.3-or-later.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GFDL-1.3-or-later.json" ) - .name( "GNU Free Documentation License v1.3 or later" ) - .licenseId( "GFDL-1.3-or-later" ) - .seeAlso( "https://www.gnu.org/licenses/fdl-1.3.txt" ) - - .urlInfo( "http://gnu.org/licenses/fdl-1.3.txt", "8bdbff3486abb874fd8870d5b6866ee6d1c44f0f", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/fdl-1.3.txt", "8bdbff3486abb874fd8870d5b6866ee6d1c44f0f", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/fdl-1.3.txt", "8bdbff3486abb874fd8870d5b6866ee6d1c44f0f", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/fdl-1.3.txt", "8bdbff3486abb874fd8870d5b6866ee6d1c44f0f", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GL2PS.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/GL2PS.json" ) - .name( "GL2PS License" ) - .licenseId( "GL2PS" ) - .seeAlso( "http://www.geuz.org/gl2ps/COPYING.GL2PS" ) - - .urlInfo( "http://geuz.org/gl2ps/COPYING.GL2PS", "c241b1d39ee2c7e49189ca75a5e8dabb35aa4173", null, true, false ) - .urlInfo( "http://www.geuz.org/gl2ps/COPYING.GL2PS", "c241b1d39ee2c7e49189ca75a5e8dabb35aa4173", null, true, false ) - .urlInfo( "https://geuz.org/gl2ps/COPYING.GL2PS", "c241b1d39ee2c7e49189ca75a5e8dabb35aa4173", null, true, false ) - .urlInfo( "https://www.geuz.org/gl2ps/COPYING.GL2PS", "c241b1d39ee2c7e49189ca75a5e8dabb35aa4173", null, true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-1.0.html" ) - .isDeprecatedLicenseId( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-1.0.json" ) - .name( "GNU General Public License v1.0 only" ) - .licenseId( "GPL-1.0" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "http://fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-1.0+.html" ) - .isDeprecatedLicenseId( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-1.0+.json" ) - .name( "GNU General Public License v1.0 or later" ) - .licenseId( "GPL-1.0+" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "http://fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-1.0-only.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/GPL-1.0-only.json" ) - .name( "GNU General Public License v1.0 only" ) - .licenseId( "GPL-1.0-only" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "http://fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-1.0-or-later.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/GPL-1.0-or-later.json" ) - .name( "GNU General Public License v1.0 or later" ) - .licenseId( "GPL-1.0-or-later" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html", "539d8420132db2bb3773ead4cd77f948eed57b7f", "text/html", true, false ) - .urlInfo( "http://fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-1.0.txt", "18eaf66587c5eea277721d5e569a6e3cd869f855", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-2.0.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-2.0.json" ) - .name( "GNU General Public License v2.0 only" ) - .licenseId( "GPL-2.0" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/GPL-2.0" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-2.0+.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-2.0+.json" ) - .name( "GNU General Public License v2.0 or later" ) - .licenseId( "GPL-2.0+" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/GPL-2.0" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-2.0-only.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-2.0-only.json" ) - .name( "GNU General Public License v2.0 only" ) - .licenseId( "GPL-2.0-only" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/GPL-2.0" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-2.0-or-later.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-2.0-or-later.json" ) - .name( "GNU General Public License v2.0 or later" ) - .licenseId( "GPL-2.0-or-later" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/GPL-2.0" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", "f4c15ee1715ae360eaac505fa32cb200565aad4b", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/GPL-2.0", "e42213d8b6a33520f82b0b1c38c3ada3c9ad064f", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt", "4cc77b90af91e615a64ae04893fdffa7939db84c", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-2.0-with-GCC-exception.html" ) - .isDeprecatedLicenseId( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-2.0-with-GCC-exception.json" ) - .name( "GNU General Public License v2.0 w/GCC Runtime Library exception" ) - .licenseId( "GPL-2.0-with-GCC-exception" ) - .seeAlso( "https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/libgcc1.c;h=762f5143fc6eed57b6797c82710f3538aa52b40b;hb=cb143a3ce4fb417c68f5fa2691a1b1b1053dfba9#l10" ) - - .urlInfo( "http://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/libgcc1.c;h=762f5143fc6eed57b6797c82710f3538aa52b40b;hb=cb143a3ce4fb417c68f5fa2691a1b1b1053dfba9#l10", "a2cc775a5ba3b070baa11e1fa3be80026ec52f38", "text/html", true, false ) - .urlInfo( "https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/libgcc1.c;h=762f5143fc6eed57b6797c82710f3538aa52b40b;hb=cb143a3ce4fb417c68f5fa2691a1b1b1053dfba9#l10", "a2cc775a5ba3b070baa11e1fa3be80026ec52f38", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-2.0-with-autoconf-exception.html" ) - .isDeprecatedLicenseId( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-2.0-with-autoconf-exception.json" ) - .name( "GNU General Public License v2.0 w/Autoconf exception" ) - .licenseId( "GPL-2.0-with-autoconf-exception" ) - .seeAlso( "http://ac-archive.sourceforge.net/doc/copyright.html" ) - - .urlInfo( "http://ac-archive.sourceforge.net/doc/copyright.html", "a84ee700564981a2fd26a0a3820d975b470cad3d", "text/html", true, false ) - .urlInfo( "http://www.ac-archive.sourceforge.net/doc/copyright.html", "a84ee700564981a2fd26a0a3820d975b470cad3d", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-2.0-with-bison-exception.html" ) - .isDeprecatedLicenseId( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-2.0-with-bison-exception.json" ) - .name( "GNU General Public License v2.0 w/Bison exception" ) - .licenseId( "GPL-2.0-with-bison-exception" ) - .seeAlso( "http://git.savannah.gnu.org/cgit/bison.git/tree/data/yacc.c?id=193d7c7054ba7197b0789e14965b739162319b5e#n141" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-2.0-with-classpath-exception.html" ) - .isDeprecatedLicenseId( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-2.0-with-classpath-exception.json" ) - .name( "GNU General Public License v2.0 w/Classpath exception" ) - .licenseId( "GPL-2.0-with-classpath-exception" ) - .seeAlso( "https://www.gnu.org/software/classpath/license.html" ) - - .urlInfo( "http://gnu.org/software/classpath/license.html", "f2aa58abadc943bfe830f1aaf00e54fb2f4a2f88", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/software/classpath/license.html", "f2aa58abadc943bfe830f1aaf00e54fb2f4a2f88", "text/html", true, false ) - .urlInfo( "https://gnu.org/software/classpath/license.html", "f2aa58abadc943bfe830f1aaf00e54fb2f4a2f88", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/software/classpath/license.html", "f2aa58abadc943bfe830f1aaf00e54fb2f4a2f88", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-2.0-with-font-exception.html" ) - .isDeprecatedLicenseId( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-2.0-with-font-exception.json" ) - .name( "GNU General Public License v2.0 w/Font exception" ) - .licenseId( "GPL-2.0-with-font-exception" ) - .seeAlso( "https://www.gnu.org/licenses/gpl-faq.html#FontException" ) - - .urlInfo( "http://gnu.org/licenses/gpl-faq.html#FontException", "ca693f05e4340375bea8f86a0977cfd6232d8841", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/gpl-faq.html#FontException", "ca693f05e4340375bea8f86a0977cfd6232d8841", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/gpl-faq.html#FontException", "ca693f05e4340375bea8f86a0977cfd6232d8841", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/gpl-faq.html#FontException", "ca693f05e4340375bea8f86a0977cfd6232d8841", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-3.0.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-3.0.json" ) - .name( "GNU General Public License v3.0 only" ) - .licenseId( "GPL-3.0" ) - .seeAlso( "https://www.gnu.org/licenses/gpl-3.0-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/GPL-3.0" ) - - .urlInfo( "http://gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-3.0+.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-3.0+.json" ) - .name( "GNU General Public License v3.0 or later" ) - .licenseId( "GPL-3.0+" ) - .seeAlso( "https://www.gnu.org/licenses/gpl-3.0-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/GPL-3.0" ) - - .urlInfo( "http://gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-3.0-only.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-3.0-only.json" ) - .name( "GNU General Public License v3.0 only" ) - .licenseId( "GPL-3.0-only" ) - .seeAlso( "https://www.gnu.org/licenses/gpl-3.0-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/GPL-3.0" ) - - .urlInfo( "http://gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-3.0-or-later.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-3.0-or-later.json" ) - .name( "GNU General Public License v3.0 or later" ) - .licenseId( "GPL-3.0-or-later" ) - .seeAlso( "https://www.gnu.org/licenses/gpl-3.0-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/GPL-3.0" ) - - .urlInfo( "http://gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/gpl-3.0-standalone.html", "20c27b0c56d6f42af9917024ad1a12ccc66dde77", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/GPL-3.0", "7495048ef61372884b9904f9c5d9a70b15439bf8", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/gpl-3.0.txt", "31a3d460bb3c7d98845187c716a30db81c44b615", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-3.0-with-GCC-exception.html" ) - .isDeprecatedLicenseId( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-3.0-with-GCC-exception.json" ) - .name( "GNU General Public License v3.0 w/GCC Runtime Library exception" ) - .licenseId( "GPL-3.0-with-GCC-exception" ) - .seeAlso( "https://www.gnu.org/licenses/gcc-exception-3.1.html" ) - - .urlInfo( "http://gnu.org/licenses/gcc-exception-3.1.html", "17068db547b1170cbd73b970c489f97735005b22", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/gcc-exception-3.1.html", "17068db547b1170cbd73b970c489f97735005b22", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/gcc-exception-3.1.html", "17068db547b1170cbd73b970c489f97735005b22", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/gcc-exception-3.1.html", "17068db547b1170cbd73b970c489f97735005b22", "text/html", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./GPL-3.0-with-autoconf-exception.html" ) - .isDeprecatedLicenseId( true ) - .detailsUrl( "http://spdx.org/licenses/GPL-3.0-with-autoconf-exception.json" ) - .name( "GNU General Public License v3.0 w/Autoconf exception" ) - .licenseId( "GPL-3.0-with-autoconf-exception" ) - .seeAlso( "https://www.gnu.org/licenses/autoconf-exception-3.0.html" ) - - .urlInfo( "http://gnu.org/licenses/autoconf-exception-3.0.html", "ac3cdc23356a60d32cbb3468f26f280c28e7cad1", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/autoconf-exception-3.0.html", "ac3cdc23356a60d32cbb3468f26f280c28e7cad1", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/autoconf-exception-3.0.html", "ac3cdc23356a60d32cbb3468f26f280c28e7cad1", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/autoconf-exception-3.0.html", "ac3cdc23356a60d32cbb3468f26f280c28e7cad1", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Giftware.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Giftware.json" ) - .name( "Giftware License" ) - .licenseId( "Giftware" ) - .seeAlso( "http://liballeg.org/license.html#allegro-4-the-giftware-license" ) - - .urlInfo( "http://liballeg.org/license.html#allegro-4-the-giftware-license", "18be1027c26d30dfcb4e438e3d72a6923e5b3726", "text/html", true, false ) - .urlInfo( "http://www.liballeg.org/license.html#allegro-4-the-giftware-license", "18be1027c26d30dfcb4e438e3d72a6923e5b3726", "text/html", true, false ) - .urlInfo( "https://liballeg.org/license.html#allegro-4-the-giftware-license", "18be1027c26d30dfcb4e438e3d72a6923e5b3726", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Glide.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Glide.json" ) - .name( "3dfx Glide License" ) - .licenseId( "Glide" ) - .seeAlso( "http://www.users.on.net/~triforce/glidexp/COPYING.txt" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Glulxe.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Glulxe.json" ) - .name( "Glulxe License" ) - .licenseId( "Glulxe" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Glulxe" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Glulxe", "600d85936d36afb8036d6679cd6ff0b6cd866897", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Glulxe", "600d85936d36afb8036d6679cd6ff0b6cd866897", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./HPND.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/HPND.json" ) - .name( "Historical Permission Notice and Disclaimer" ) - .licenseId( "HPND" ) - .seeAlso( "https://opensource.org/licenses/HPND" ) - - .urlInfo( "http://opensource.org/licenses/HPND", "6a2cd3da04b29962721bd04032669cd99654723e", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/HPND", "6a2cd3da04b29962721bd04032669cd99654723e", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/HPND", "6a2cd3da04b29962721bd04032669cd99654723e", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/HPND", "6a2cd3da04b29962721bd04032669cd99654723e", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./HPND-sell-variant.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/HPND-sell-variant.json" ) - .name( "Historical Permission Notice and Disclaimer - sell variant" ) - .licenseId( "HPND-sell-variant" ) - .seeAlso( "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/sunrpc/auth_gss/gss_generic_token.c?h=v4.19" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./HaskellReport.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/HaskellReport.json" ) - .name( "Haskell Language Report License" ) - .licenseId( "HaskellReport" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Haskell_Language_Report_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Haskell_Language_Report_License", "2143a9ff2a144a2b1e5f05cd2db753701b17aeb3", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Haskell_Language_Report_License", "2143a9ff2a144a2b1e5f05cd2db753701b17aeb3", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./IBM-pibs.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/IBM-pibs.json" ) - .name( "IBM PowerPC Initialization and Boot Software" ) - .licenseId( "IBM-pibs" ) - .seeAlso( "http://git.denx.de/?p=u-boot.git;a=blob;f=arch/powerpc/cpu/ppc4xx/miiphy.c;h=297155fdafa064b955e53e9832de93bfb0cfb85b;hb=9fab4bf4cc077c21e43941866f3f2c196f28670d" ) - - .urlInfo( "http://git.denx.de/?p=u-boot.git;a=blob;f=arch/powerpc/cpu/ppc4xx/miiphy.c;h=297155fdafa064b955e53e9832de93bfb0cfb85b;hb=9fab4bf4cc077c21e43941866f3f2c196f28670d", "5fb6ed7cf5e7c925eb5f262b29acd6aefaf925fb", "text/html", true, false ) - .urlInfo( "https://git.denx.de/?p=u-boot.git;a=blob;f=arch/powerpc/cpu/ppc4xx/miiphy.c;h=297155fdafa064b955e53e9832de93bfb0cfb85b;hb=9fab4bf4cc077c21e43941866f3f2c196f28670d", "5fb6ed7cf5e7c925eb5f262b29acd6aefaf925fb", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./ICU.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/ICU.json" ) - .name( "ICU License" ) - .licenseId( "ICU" ) - .seeAlso( "http://source.icu-project.org/repos/icu/icu/trunk/license.html" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./IJG.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/IJG.json" ) - .name( "Independent JPEG Group License" ) - .licenseId( "IJG" ) - .seeAlso( "http://dev.w3.org/cvsweb/Amaya/libjpeg/Attic/README?rev=1.2" ) - - .urlInfo( "http://dev.w3.org/cvsweb/Amaya/libjpeg/Attic/README?rev=1.2", "8501b4b302c4c2f6f67f82159b8e7c2388227e93", "text/html", true, false ) - .urlInfo( "https://dev.w3.org/cvsweb/Amaya/libjpeg/Attic/README?rev=1.2", "8501b4b302c4c2f6f67f82159b8e7c2388227e93", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./IPA.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/IPA.json" ) - .name( "IPA Font License" ) - .licenseId( "IPA" ) - .seeAlso( "https://opensource.org/licenses/IPA" ) - - .urlInfo( "http://opensource.org/licenses/IPA", "c3c56e9482ac217c0898881a7eb2f41cd6e59449", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/IPA", "c3c56e9482ac217c0898881a7eb2f41cd6e59449", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/IPA", "c3c56e9482ac217c0898881a7eb2f41cd6e59449", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/IPA", "c3c56e9482ac217c0898881a7eb2f41cd6e59449", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./IPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/IPL-1.0.json" ) - .name( "IBM Public License v1.0" ) - .licenseId( "IPL-1.0" ) - .seeAlso( "https://opensource.org/licenses/IPL-1.0" ) - - .urlInfo( "http://opensource.org/licenses/IPL-1.0", "c45cea256e89c3f37e029d04b9a973719c17c536", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/IPL-1.0", "c45cea256e89c3f37e029d04b9a973719c17c536", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/IPL-1.0", "c45cea256e89c3f37e029d04b9a973719c17c536", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/IPL-1.0", "c45cea256e89c3f37e029d04b9a973719c17c536", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./ISC.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/ISC.json" ) - .name( "ISC License" ) - .licenseId( "ISC" ) - .seeAlso( "https://www.isc.org/downloads/software-support-policy/isc-license/" ) - .seeAlso( "https://opensource.org/licenses/ISC" ) - - .urlInfo( "https://isc.org/downloads/software-support-policy/isc-license/", "0ed942cb7331f4396a838bac42ff13ca72cf568c", "text/html", true, false ) - .urlInfo( "https://www.isc.org/downloads/software-support-policy/isc-license/", "0ed942cb7331f4396a838bac42ff13ca72cf568c", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/ISC", "6cd8a2cb39eb7f9f27fc68870341ba32c01d58d4", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/ISC", "6cd8a2cb39eb7f9f27fc68870341ba32c01d58d4", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/ISC", "6cd8a2cb39eb7f9f27fc68870341ba32c01d58d4", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/ISC", "6cd8a2cb39eb7f9f27fc68870341ba32c01d58d4", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./ImageMagick.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/ImageMagick.json" ) - .name( "ImageMagick License" ) - .licenseId( "ImageMagick" ) - .seeAlso( "http://www.imagemagick.org/script/license.php" ) - - .urlInfo( "http://imagemagick.org/script/license.php", "af2eee0fc029843aa9886ed7cc299416cd38bfcc", "text/html", true, false ) - .urlInfo( "http://www.imagemagick.org/script/license.php", "af2eee0fc029843aa9886ed7cc299416cd38bfcc", "text/html", true, false ) - .urlInfo( "https://imagemagick.org/script/license.php", "af2eee0fc029843aa9886ed7cc299416cd38bfcc", "text/html", true, false ) - .urlInfo( "https://www.imagemagick.org/script/license.php", "af2eee0fc029843aa9886ed7cc299416cd38bfcc", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Imlib2.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Imlib2.json" ) - .name( "Imlib2 License" ) - .licenseId( "Imlib2" ) - .seeAlso( "http://trac.enlightenment.org/e/browser/trunk/imlib2/COPYING" ) - .seeAlso( "https://git.enlightenment.org/legacy/imlib2.git/tree/COPYING" ) - - .urlInfo( "http://git.enlightenment.org/legacy/imlib2.git/tree/COPYING", "8d76e9f6926b7a97f0d57efe16a9685e36e89995", "text/html", true, false ) - .urlInfo( "https://git.enlightenment.org/legacy/imlib2.git/tree/COPYING", "8d76e9f6926b7a97f0d57efe16a9685e36e89995", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Info-ZIP.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Info-ZIP.json" ) - .name( "Info-ZIP License" ) - .licenseId( "Info-ZIP" ) - .seeAlso( "http://www.info-zip.org/license.html" ) - - .urlInfo( "http://info-zip.org/license.html", "9596ecc43b8d17228cdf3f5658b9460f653e59ff", "text/html", true, false ) - .urlInfo( "http://www.info-zip.org/license.html", "9596ecc43b8d17228cdf3f5658b9460f653e59ff", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Intel.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Intel.json" ) - .name( "Intel Open Source License" ) - .licenseId( "Intel" ) - .seeAlso( "https://opensource.org/licenses/Intel" ) - - .urlInfo( "http://opensource.org/licenses/Intel", "8869c958cebbb1314ccf8d9e3ef5e8b1a3ae6046", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Intel", "8869c958cebbb1314ccf8d9e3ef5e8b1a3ae6046", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Intel", "8869c958cebbb1314ccf8d9e3ef5e8b1a3ae6046", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Intel", "8869c958cebbb1314ccf8d9e3ef5e8b1a3ae6046", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Intel-ACPI.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Intel-ACPI.json" ) - .name( "Intel ACPI Software License Agreement" ) - .licenseId( "Intel-ACPI" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Intel_ACPI_Software_License_Agreement" ) - - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Intel_ACPI_Software_License_Agreement", null, null, false, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Interbase-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Interbase-1.0.json" ) - .name( "Interbase Public License v1.0" ) - .licenseId( "Interbase-1.0" ) - .seeAlso( "https://web.archive.org/web/20060319014854/http://info.borland.com/devsupport/interbase/opensource/IPL.html" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./JPNIC.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/JPNIC.json" ) - .name( "Japan Network Information Center License" ) - .licenseId( "JPNIC" ) - .seeAlso( "https://gitlab.isc.org/isc-projects/bind9/blob/master/COPYRIGHT#L366" ) - - .urlInfo( "https://gitlab.isc.org/isc-projects/bind9/blob/master/COPYRIGHT#L366", null, null, false, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./JSON.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/JSON.json" ) - .name( "JSON License" ) - .licenseId( "JSON" ) - .seeAlso( "http://www.json.org/license.html" ) - - .urlInfo( "http://json.org/license.html", "9689700df3dd203628d104bb10834983685bf53a", "text/html", true, false ) - .urlInfo( "http://www.json.org/license.html", "9689700df3dd203628d104bb10834983685bf53a", "text/html", true, false ) - .urlInfo( "https://json.org/license.html", "9689700df3dd203628d104bb10834983685bf53a", "text/html", true, false ) - .urlInfo( "https://www.json.org/license.html", "9689700df3dd203628d104bb10834983685bf53a", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./JasPer-2.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/JasPer-2.0.json" ) - .name( "JasPer License" ) - .licenseId( "JasPer-2.0" ) - .seeAlso( "http://www.ece.uvic.ca/~mdadams/jasper/LICENSE" ) - - .urlInfo( "http://ece.uvic.ca/~mdadams/jasper/LICENSE", "14b5d0210560128e1a5d5204698cf705011ef792", "text/plain", true, false ) - .urlInfo( "http://www.ece.uvic.ca/~mdadams/jasper/LICENSE", "14b5d0210560128e1a5d5204698cf705011ef792", "text/plain", true, false ) - .urlInfo( "https://ece.uvic.ca/~mdadams/jasper/LICENSE", "14b5d0210560128e1a5d5204698cf705011ef792", "text/plain", true, false ) - .urlInfo( "https://www.ece.uvic.ca/~mdadams/jasper/LICENSE", "14b5d0210560128e1a5d5204698cf705011ef792", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LAL-1.2.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/LAL-1.2.json" ) - .name( "Licence Art Libre 1.2" ) - .licenseId( "LAL-1.2" ) - .seeAlso( "http://artlibre.org/licence/lal/licence-art-libre-12/" ) - - .urlInfo( "http://artlibre.org/licence/lal/licence-art-libre-12/", "df23d3e0f1fca6107f079efe462314636f5c2641", "text/html", true, true ) - .urlInfo( "http://www.artlibre.org/licence/lal/licence-art-libre-12/", "df23d3e0f1fca6107f079efe462314636f5c2641", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LAL-1.3.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/LAL-1.3.json" ) - .name( "Licence Art Libre 1.3" ) - .licenseId( "LAL-1.3" ) - .seeAlso( "http://artlibre.org/" ) - - .urlInfo( "http://artlibre.org/", "ccb30a10a3d0eae7a668ae6e711c55d000f6d7b3", "text/html", true, true ) - .urlInfo( "http://www.artlibre.org/", "ccb30a10a3d0eae7a668ae6e711c55d000f6d7b3", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LGPL-2.0.html" ) - .isDeprecatedLicenseId( true ) - .detailsUrl( "http://spdx.org/licenses/LGPL-2.0.json" ) - .name( "GNU Library General Public License v2 only" ) - .licenseId( "LGPL-2.0" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "http://fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LGPL-2.0+.html" ) - .isDeprecatedLicenseId( true ) - .detailsUrl( "http://spdx.org/licenses/LGPL-2.0+.json" ) - .name( "GNU Library General Public License v2 or later" ) - .licenseId( "LGPL-2.0+" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "http://fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LGPL-2.0-only.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/LGPL-2.0-only.json" ) - .name( "GNU Library General Public License v2 only" ) - .licenseId( "LGPL-2.0-only" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "http://fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LGPL-2.0-or-later.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/LGPL-2.0-or-later.json" ) - .name( "GNU Library General Public License v2 or later" ) - .licenseId( "LGPL-2.0-or-later" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html", "914d8333aaf7cdc7937142f1bb66972a98c2604b", "text/html", true, false ) - .urlInfo( "http://fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt", "ba8966e2473a9969bdcab3dc82274c817cfd98a1", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LGPL-2.1.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/LGPL-2.1.json" ) - .name( "GNU Lesser General Public License v2.1 only" ) - .licenseId( "LGPL-2.1" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/LGPL-2.1" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LGPL-2.1+.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/LGPL-2.1+.json" ) - .name( "GNU Library General Public License v2.1 or later" ) - .licenseId( "LGPL-2.1+" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/LGPL-2.1" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LGPL-2.1-only.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/LGPL-2.1-only.json" ) - .name( "GNU Lesser General Public License v2.1 only" ) - .licenseId( "LGPL-2.1-only" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/LGPL-2.1" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LGPL-2.1-or-later.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/LGPL-2.1-or-later.json" ) - .name( "GNU Lesser General Public License v2.1 or later" ) - .licenseId( "LGPL-2.1-or-later" ) - .seeAlso( "https://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/LGPL-2.1" ) - - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", "2f96f4fd713e61fb00bb9f3ba073f029afce2ace", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/LGPL-2.1", "1fa1934d71abece4babf044b82e3a8ba0d534e35", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt", "01a6b4bf79aca9b556822601186afab86e8c4fbf", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LGPL-3.0.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/LGPL-3.0.json" ) - .name( "GNU Lesser General Public License v3.0 only" ) - .licenseId( "LGPL-3.0" ) - .seeAlso( "https://www.gnu.org/licenses/lgpl-3.0-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/LGPL-3.0" ) - - .urlInfo( "http://gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LGPL-3.0+.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/LGPL-3.0+.json" ) - .name( "GNU Lesser General Public License v3.0 or later" ) - .licenseId( "LGPL-3.0+" ) - .seeAlso( "https://www.gnu.org/licenses/lgpl-3.0-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/LGPL-3.0" ) - - .urlInfo( "http://gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LGPL-3.0-only.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/LGPL-3.0-only.json" ) - .name( "GNU Lesser General Public License v3.0 only" ) - .licenseId( "LGPL-3.0-only" ) - .seeAlso( "https://www.gnu.org/licenses/lgpl-3.0-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/LGPL-3.0" ) - - .urlInfo( "http://gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LGPL-3.0-or-later.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/LGPL-3.0-or-later.json" ) - .name( "GNU Lesser General Public License v3.0 or later" ) - .licenseId( "LGPL-3.0-or-later" ) - .seeAlso( "https://www.gnu.org/licenses/lgpl-3.0-standalone.html" ) - .seeAlso( "https://opensource.org/licenses/LGPL-3.0" ) - - .urlInfo( "http://gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/lgpl-3.0-standalone.html", "836ef8f5615224a0f967cfe45bae4fdec8cef5ec", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/LGPL-3.0", "950ca7d7ca79b6f0924bd4638961cb6ea33b4fc8", "text/html", false, true ) - .urlInfo( "http://fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "http://gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "http://www.fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "http://www.gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://www.fsf.org/licensing/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .urlInfo( "https://www.gnu.org/licenses/lgpl-3.0.txt", "a8a12e6867d7ee39c21d9b11a984066099b6fb6b", "text/plain", true, false ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LGPLLR.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/LGPLLR.json" ) - .name( "Lesser General Public License For Linguistic Resources" ) - .licenseId( "LGPLLR" ) - .seeAlso( "http://www-igm.univ-mlv.fr/~unitex/lgpllr.html" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/LPL-1.0.json" ) - .name( "Lucent Public License Version 1.0" ) - .licenseId( "LPL-1.0" ) - .seeAlso( "https://opensource.org/licenses/LPL-1.0" ) - - .urlInfo( "http://opensource.org/licenses/LPL-1.0", "aef9ac68795f04ce50433263b6efb2f609260206", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/LPL-1.0", "aef9ac68795f04ce50433263b6efb2f609260206", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/LPL-1.0", "aef9ac68795f04ce50433263b6efb2f609260206", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/LPL-1.0", "aef9ac68795f04ce50433263b6efb2f609260206", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LPL-1.02.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/LPL-1.02.json" ) - .name( "Lucent Public License v1.02" ) - .licenseId( "LPL-1.02" ) - .seeAlso( "http://plan9.bell-labs.com/plan9/license.html" ) - .seeAlso( "https://opensource.org/licenses/LPL-1.02" ) - - .urlInfo( "http://opensource.org/licenses/LPL-1.02", "2b017f711d2a635a6c7a4e963f9559115d1be84a", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/LPL-1.02", "2b017f711d2a635a6c7a4e963f9559115d1be84a", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/LPL-1.02", "2b017f711d2a635a6c7a4e963f9559115d1be84a", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/LPL-1.02", "2b017f711d2a635a6c7a4e963f9559115d1be84a", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LPPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/LPPL-1.0.json" ) - .name( "LaTeX Project Public License v1.0" ) - .licenseId( "LPPL-1.0" ) - .seeAlso( "http://www.latex-project.org/lppl/lppl-1-0.txt" ) - - .urlInfo( "http://latex-project.org/lppl/lppl-1-0.txt", "9e9d71e01cc812a7687e88937b03bf32b05c2e2c", "text/plain", true, false ) - .urlInfo( "http://www.latex-project.org/lppl/lppl-1-0.txt", "9e9d71e01cc812a7687e88937b03bf32b05c2e2c", "text/plain", true, false ) - .urlInfo( "https://latex-project.org/lppl/lppl-1-0.txt", "9e9d71e01cc812a7687e88937b03bf32b05c2e2c", "text/plain", true, false ) - .urlInfo( "https://www.latex-project.org/lppl/lppl-1-0.txt", "9e9d71e01cc812a7687e88937b03bf32b05c2e2c", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LPPL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/LPPL-1.1.json" ) - .name( "LaTeX Project Public License v1.1" ) - .licenseId( "LPPL-1.1" ) - .seeAlso( "http://www.latex-project.org/lppl/lppl-1-1.txt" ) - - .urlInfo( "http://latex-project.org/lppl/lppl-1-1.txt", "19223302b3aa61c5217db535db4cdb076a78e986", "text/plain", true, false ) - .urlInfo( "http://www.latex-project.org/lppl/lppl-1-1.txt", "19223302b3aa61c5217db535db4cdb076a78e986", "text/plain", true, false ) - .urlInfo( "https://latex-project.org/lppl/lppl-1-1.txt", "19223302b3aa61c5217db535db4cdb076a78e986", "text/plain", true, false ) - .urlInfo( "https://www.latex-project.org/lppl/lppl-1-1.txt", "19223302b3aa61c5217db535db4cdb076a78e986", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LPPL-1.2.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/LPPL-1.2.json" ) - .name( "LaTeX Project Public License v1.2" ) - .licenseId( "LPPL-1.2" ) - .seeAlso( "http://www.latex-project.org/lppl/lppl-1-2.txt" ) - - .urlInfo( "http://latex-project.org/lppl/lppl-1-2.txt", "aca248747daf649ff8a701277dd67c55476eb982", "text/plain", true, false ) - .urlInfo( "http://www.latex-project.org/lppl/lppl-1-2.txt", "aca248747daf649ff8a701277dd67c55476eb982", "text/plain", true, false ) - .urlInfo( "https://latex-project.org/lppl/lppl-1-2.txt", "aca248747daf649ff8a701277dd67c55476eb982", "text/plain", true, false ) - .urlInfo( "https://www.latex-project.org/lppl/lppl-1-2.txt", "aca248747daf649ff8a701277dd67c55476eb982", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LPPL-1.3a.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/LPPL-1.3a.json" ) - .name( "LaTeX Project Public License v1.3a" ) - .licenseId( "LPPL-1.3a" ) - .seeAlso( "http://www.latex-project.org/lppl/lppl-1-3a.txt" ) - - .urlInfo( "http://latex-project.org/lppl/lppl-1-3a.txt", "2c40ed15717ba7ffcf1f93fa2d6f31b5d930237f", "text/plain", true, false ) - .urlInfo( "http://www.latex-project.org/lppl/lppl-1-3a.txt", "2c40ed15717ba7ffcf1f93fa2d6f31b5d930237f", "text/plain", true, false ) - .urlInfo( "https://latex-project.org/lppl/lppl-1-3a.txt", "2c40ed15717ba7ffcf1f93fa2d6f31b5d930237f", "text/plain", true, false ) - .urlInfo( "https://www.latex-project.org/lppl/lppl-1-3a.txt", "2c40ed15717ba7ffcf1f93fa2d6f31b5d930237f", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LPPL-1.3c.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/LPPL-1.3c.json" ) - .name( "LaTeX Project Public License v1.3c" ) - .licenseId( "LPPL-1.3c" ) - .seeAlso( "http://www.latex-project.org/lppl/lppl-1-3c.txt" ) - .seeAlso( "https://opensource.org/licenses/LPPL-1.3c" ) - - .urlInfo( "http://latex-project.org/lppl/lppl-1-3c.txt", "47438d5b2ab351796b64b62da105432ab71369ab", "text/plain", true, false ) - .urlInfo( "http://www.latex-project.org/lppl/lppl-1-3c.txt", "47438d5b2ab351796b64b62da105432ab71369ab", "text/plain", true, false ) - .urlInfo( "https://latex-project.org/lppl/lppl-1-3c.txt", "47438d5b2ab351796b64b62da105432ab71369ab", "text/plain", true, false ) - .urlInfo( "https://www.latex-project.org/lppl/lppl-1-3c.txt", "47438d5b2ab351796b64b62da105432ab71369ab", "text/plain", true, false ) - .urlInfo( "http://opensource.org/licenses/LPPL-1.3c", "705d86fc7853fd43cca153606a98abfa56699d6d", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/LPPL-1.3c", "705d86fc7853fd43cca153606a98abfa56699d6d", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/LPPL-1.3c", "705d86fc7853fd43cca153606a98abfa56699d6d", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/LPPL-1.3c", "705d86fc7853fd43cca153606a98abfa56699d6d", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Latex2e.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Latex2e.json" ) - .name( "Latex2e License" ) - .licenseId( "Latex2e" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Latex2e" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Latex2e", "0066fc8656056ea9b2ef1484d3756c777f73f1f6", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Latex2e", "0066fc8656056ea9b2ef1484d3756c777f73f1f6", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Latex2e", "0066fc8656056ea9b2ef1484d3756c777f73f1f6", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Latex2e", "0066fc8656056ea9b2ef1484d3756c777f73f1f6", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Leptonica.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Leptonica.json" ) - .name( "Leptonica License" ) - .licenseId( "Leptonica" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Leptonica" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Leptonica", "a346e354e8a0b57cfb128a55703c5cf1f6d2fff8", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Leptonica", "a346e354e8a0b57cfb128a55703c5cf1f6d2fff8", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Leptonica", "a346e354e8a0b57cfb128a55703c5cf1f6d2fff8", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Leptonica", "a346e354e8a0b57cfb128a55703c5cf1f6d2fff8", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LiLiQ-P-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/LiLiQ-P-1.1.json" ) - .name( "Licence Libre du Québec – Permissive version 1.1" ) - .licenseId( "LiLiQ-P-1.1" ) - .seeAlso( "https://forge.gouv.qc.ca/licence/fr/liliq-v1-1/" ) - .seeAlso( "http://opensource.org/licenses/LiLiQ-P-1.1" ) - - .urlInfo( "http://forge.gouv.qc.ca/licence/fr/liliq-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-forte-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://www.forge.gouv.qc.ca/licence/fr/liliq-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-forte-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://forge.gouv.qc.ca/licence/fr/liliq-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-forte-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://www.forge.gouv.qc.ca/licence/fr/liliq-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-forte-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/LiLiQ-P-1.1", "b60c7fd62b5cfdc339053985d37499e0a759c610", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/LiLiQ-P-1.1", "b60c7fd62b5cfdc339053985d37499e0a759c610", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/LiLiQ-P-1.1", "b60c7fd62b5cfdc339053985d37499e0a759c610", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/LiLiQ-P-1.1", "b60c7fd62b5cfdc339053985d37499e0a759c610", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LiLiQ-R-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/LiLiQ-R-1.1.json" ) - .name( "Licence Libre du Québec – Réciprocité version 1.1" ) - .licenseId( "LiLiQ-R-1.1" ) - .seeAlso( "https://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-liliq-r-v1-1/" ) - .seeAlso( "http://opensource.org/licenses/LiLiQ-R-1.1" ) - - .urlInfo( "http://forge.gouv.qc.ca/licence/fr/liliq-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-forte-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://www.forge.gouv.qc.ca/licence/fr/liliq-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-forte-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://forge.gouv.qc.ca/licence/fr/liliq-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-forte-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://www.forge.gouv.qc.ca/licence/fr/liliq-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-forte-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/LiLiQ-R-1.1", "480556fc34dc97fbeb6c5e11875878649b809a9e", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/LiLiQ-R-1.1", "480556fc34dc97fbeb6c5e11875878649b809a9e", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/LiLiQ-R-1.1", "480556fc34dc97fbeb6c5e11875878649b809a9e", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/LiLiQ-R-1.1", "480556fc34dc97fbeb6c5e11875878649b809a9e", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./LiLiQ-Rplus-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/LiLiQ-Rplus-1.1.json" ) - .name( "Licence Libre du Québec – Réciprocité forte version 1.1" ) - .licenseId( "LiLiQ-Rplus-1.1" ) - .seeAlso( "https://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-forte-liliq-r-v1-1/" ) - .seeAlso( "http://opensource.org/licenses/LiLiQ-Rplus-1.1" ) - - .urlInfo( "http://forge.gouv.qc.ca/licence/fr/liliq-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-forte-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://www.forge.gouv.qc.ca/licence/fr/liliq-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-forte-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://forge.gouv.qc.ca/licence/fr/liliq-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-forte-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://www.forge.gouv.qc.ca/licence/fr/liliq-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-forte-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "https://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-liliq-r-v1-1/", "343a5d92df234cbcd462c8b7a4cf17fcc22227c0", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/LiLiQ-Rplus-1.1", "6ef18e065862cd3ca4ba4ffe313c760d4133d121", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/LiLiQ-Rplus-1.1", "6ef18e065862cd3ca4ba4ffe313c760d4133d121", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/LiLiQ-Rplus-1.1", "6ef18e065862cd3ca4ba4ffe313c760d4133d121", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/LiLiQ-Rplus-1.1", "6ef18e065862cd3ca4ba4ffe313c760d4133d121", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Libpng.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Libpng.json" ) - .name( "libpng License" ) - .licenseId( "Libpng" ) - .seeAlso( "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt" ) - - .urlInfo( "http://libpng.org/pub/png/src/libpng-LICENSE.txt", "e01ba244558d7a6b6729885beb54e9e561583101", "text/plain", true, false ) - .urlInfo( "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", "e01ba244558d7a6b6729885beb54e9e561583101", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Linux-OpenIB.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Linux-OpenIB.json" ) - .name( "Linux Kernel Variant of OpenIB.org license" ) - .licenseId( "Linux-OpenIB" ) - .seeAlso( "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/infiniband/core/sa.h" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MIT.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/MIT.json" ) - .name( "MIT License" ) - .licenseId( "MIT" ) - .seeAlso( "https://opensource.org/licenses/MIT" ) - - .urlInfo( "http://opensource.org/licenses/MIT", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "http://opensource.org/licenses/mit-license", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "http://opensource.org/licenses/mit-license.html", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "http://opensource.org/licenses/mit-license.php", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/MIT", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/mit-license", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/mit-license.html", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/mit-license.php", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/MIT", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/mit-license", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/mit-license.html", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/mit-license.php", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/MIT", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/mit-license", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/mit-license.html", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/mit-license.php", "8b1421deee0354c1f9b222e29b54eab50ae2aab3", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MIT-0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/MIT-0.json" ) - .name( "MIT No Attribution" ) - .licenseId( "MIT-0" ) - .seeAlso( "https://github.com/aws/mit-0" ) - .seeAlso( "https://romanrm.net/mit-zero" ) - .seeAlso( "https://github.com/awsdocs/aws-cloud9-user-guide/blob/master/LICENSE-SAMPLECODE" ) - - .urlInfo( "http://romanrm.net/mit-zero", "55f98e9956fa88358c1ece191b8ba14dbc0f44ef", "text/html", true, true ) - .urlInfo( "https://romanrm.net/mit-zero", "55f98e9956fa88358c1ece191b8ba14dbc0f44ef", "text/html", true, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MIT-CMU.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/MIT-CMU.json" ) - .name( "CMU License" ) - .licenseId( "MIT-CMU" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style" ) - .seeAlso( "https://github.com/python-pillow/Pillow/blob/fffb426092c8db24a5f4b6df243a8a3c01fb63cd/LICENSE" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MIT-advertising.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/MIT-advertising.json" ) - .name( "Enlightenment License (e16)" ) - .licenseId( "MIT-advertising" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/MIT_With_Advertising" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT_With_Advertising", "9d60fdaa27de956f7d28dcfdec9b4de7920c7f22", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT_With_Advertising", "9d60fdaa27de956f7d28dcfdec9b4de7920c7f22", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT_With_Advertising", "9d60fdaa27de956f7d28dcfdec9b4de7920c7f22", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT_With_Advertising", "9d60fdaa27de956f7d28dcfdec9b4de7920c7f22", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MIT-enna.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/MIT-enna.json" ) - .name( "enna License" ) - .licenseId( "MIT-enna" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/MIT#enna" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MIT-feh.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/MIT-feh.json" ) - .name( "feh License" ) - .licenseId( "MIT-feh" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/MIT#feh" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MITNFA.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/MITNFA.json" ) - .name( "MIT +no-false-attribs license" ) - .licenseId( "MITNFA" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/MITNFA" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MITNFA", "77ae78dbb8de0913de66c4fdcc4a587f8318daeb", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MITNFA", "77ae78dbb8de0913de66c4fdcc4a587f8318daeb", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MITNFA", "77ae78dbb8de0913de66c4fdcc4a587f8318daeb", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MITNFA", "77ae78dbb8de0913de66c4fdcc4a587f8318daeb", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/MPL-1.0.json" ) - .name( "Mozilla Public License 1.0" ) - .licenseId( "MPL-1.0" ) - .seeAlso( "http://www.mozilla.org/MPL/MPL-1.0.html" ) - .seeAlso( "https://opensource.org/licenses/MPL-1.0" ) - - .urlInfo( "http://mozilla.org/MPL/MPL-1.0.html", "ea7ac7d1a5d6a61095e8513045f789e695739ab4", "text/html", true, false ) - .urlInfo( "http://www.mozilla.org/MPL/MPL-1.0.html", "ea7ac7d1a5d6a61095e8513045f789e695739ab4", "text/html", true, false ) - .urlInfo( "https://mozilla.org/MPL/MPL-1.0.html", "ea7ac7d1a5d6a61095e8513045f789e695739ab4", "text/html", true, false ) - .urlInfo( "https://www.mozilla.org/MPL/MPL-1.0.html", "ea7ac7d1a5d6a61095e8513045f789e695739ab4", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/MPL-1.0", "80429e50a57da7e83d1ebc0e92a7407195b0edf9", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/MPL-1.0", "80429e50a57da7e83d1ebc0e92a7407195b0edf9", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/MPL-1.0", "80429e50a57da7e83d1ebc0e92a7407195b0edf9", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/MPL-1.0", "80429e50a57da7e83d1ebc0e92a7407195b0edf9", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MPL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/MPL-1.1.json" ) - .name( "Mozilla Public License 1.1" ) - .licenseId( "MPL-1.1" ) - .seeAlso( "http://www.mozilla.org/MPL/MPL-1.1.html" ) - .seeAlso( "https://opensource.org/licenses/MPL-1.1" ) - - .urlInfo( "http://mozilla.org/MPL/MPL-1.1.html", "9e1fce8c91325bc318442713e4884137370e9147", "text/html", true, false ) - .urlInfo( "http://www.mozilla.org/MPL/MPL-1.1.html", "9e1fce8c91325bc318442713e4884137370e9147", "text/html", true, false ) - .urlInfo( "https://mozilla.org/MPL/MPL-1.1.html", "9e1fce8c91325bc318442713e4884137370e9147", "text/html", true, false ) - .urlInfo( "https://www.mozilla.org/MPL/MPL-1.1.html", "9e1fce8c91325bc318442713e4884137370e9147", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/MPL-1.1", "16e335a43c3f7ade9aed1f91e052f660a90e42c1", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/MPL-1.1", "16e335a43c3f7ade9aed1f91e052f660a90e42c1", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/MPL-1.1", "16e335a43c3f7ade9aed1f91e052f660a90e42c1", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/MPL-1.1", "16e335a43c3f7ade9aed1f91e052f660a90e42c1", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MPL-2.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/MPL-2.0.json" ) - .name( "Mozilla Public License 2.0" ) - .licenseId( "MPL-2.0" ) - .seeAlso( "http://www.mozilla.org/MPL/2.0/" ) - .seeAlso( "https://opensource.org/licenses/MPL-2.0" ) - - .urlInfo( "http://mozilla.org/MPL/2.0/", "39842cd17d783d2a49035cdb59bf800a79df0d4e", "text/html", true, false ) - .urlInfo( "http://www.mozilla.org/MPL/2.0/", "39842cd17d783d2a49035cdb59bf800a79df0d4e", "text/html", true, false ) - .urlInfo( "https://mozilla.org/MPL/2.0/", "39842cd17d783d2a49035cdb59bf800a79df0d4e", "text/html", true, false ) - .urlInfo( "https://www.mozilla.org/MPL/2.0/", "39842cd17d783d2a49035cdb59bf800a79df0d4e", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/MPL-2.0", "9fd2b073513bc1b9cde16c3d1321ef54f30dc98b", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/MPL-2.0", "9fd2b073513bc1b9cde16c3d1321ef54f30dc98b", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/MPL-2.0", "9fd2b073513bc1b9cde16c3d1321ef54f30dc98b", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/MPL-2.0", "9fd2b073513bc1b9cde16c3d1321ef54f30dc98b", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MPL-2.0-no-copyleft-exception.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/MPL-2.0-no-copyleft-exception.json" ) - .name( "Mozilla Public License 2.0 (no copyleft exception)" ) - .licenseId( "MPL-2.0-no-copyleft-exception" ) - .seeAlso( "http://www.mozilla.org/MPL/2.0/" ) - .seeAlso( "https://opensource.org/licenses/MPL-2.0" ) - - .urlInfo( "http://mozilla.org/MPL/2.0/", "39842cd17d783d2a49035cdb59bf800a79df0d4e", "text/html", true, false ) - .urlInfo( "http://www.mozilla.org/MPL/2.0/", "39842cd17d783d2a49035cdb59bf800a79df0d4e", "text/html", true, false ) - .urlInfo( "https://mozilla.org/MPL/2.0/", "39842cd17d783d2a49035cdb59bf800a79df0d4e", "text/html", true, false ) - .urlInfo( "https://www.mozilla.org/MPL/2.0/", "39842cd17d783d2a49035cdb59bf800a79df0d4e", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/MPL-2.0", "9fd2b073513bc1b9cde16c3d1321ef54f30dc98b", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/MPL-2.0", "9fd2b073513bc1b9cde16c3d1321ef54f30dc98b", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/MPL-2.0", "9fd2b073513bc1b9cde16c3d1321ef54f30dc98b", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/MPL-2.0", "9fd2b073513bc1b9cde16c3d1321ef54f30dc98b", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MS-PL.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/MS-PL.json" ) - .name( "Microsoft Public License" ) - .licenseId( "MS-PL" ) - .seeAlso( "http://www.microsoft.com/opensource/licenses.mspx" ) - .seeAlso( "https://opensource.org/licenses/MS-PL" ) - - .urlInfo( "http://opensource.org/licenses/MS-PL", "189e532febe1cd9cfeb7c8b56b8049de43f94317", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/MS-PL", "189e532febe1cd9cfeb7c8b56b8049de43f94317", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/MS-PL", "189e532febe1cd9cfeb7c8b56b8049de43f94317", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/MS-PL", "189e532febe1cd9cfeb7c8b56b8049de43f94317", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MS-RL.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/MS-RL.json" ) - .name( "Microsoft Reciprocal License" ) - .licenseId( "MS-RL" ) - .seeAlso( "http://www.microsoft.com/opensource/licenses.mspx" ) - .seeAlso( "https://opensource.org/licenses/MS-RL" ) - - .urlInfo( "http://opensource.org/licenses/MS-RL", "079a7e50ad644e15382dae28d51fc71bb73c3f5b", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/MS-RL", "079a7e50ad644e15382dae28d51fc71bb73c3f5b", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/MS-RL", "079a7e50ad644e15382dae28d51fc71bb73c3f5b", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/MS-RL", "079a7e50ad644e15382dae28d51fc71bb73c3f5b", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MTLL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/MTLL.json" ) - .name( "Matrix Template Library License" ) - .licenseId( "MTLL" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Matrix_Template_Library_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Matrix_Template_Library_License", "e779f5af14f0e2b439bc2c1085aa853ad2c0eab0", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Matrix_Template_Library_License", "e779f5af14f0e2b439bc2c1085aa853ad2c0eab0", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Matrix_Template_Library_License", "e779f5af14f0e2b439bc2c1085aa853ad2c0eab0", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Matrix_Template_Library_License", "e779f5af14f0e2b439bc2c1085aa853ad2c0eab0", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MakeIndex.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/MakeIndex.json" ) - .name( "MakeIndex License" ) - .licenseId( "MakeIndex" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/MakeIndex" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MakeIndex", "15f6eb6ff20e78fc7622405ad1998ed2c83c2d3e", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MakeIndex", "15f6eb6ff20e78fc7622405ad1998ed2c83c2d3e", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MakeIndex", "15f6eb6ff20e78fc7622405ad1998ed2c83c2d3e", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MakeIndex", "15f6eb6ff20e78fc7622405ad1998ed2c83c2d3e", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./MirOS.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/MirOS.json" ) - .name( "MirOS License" ) - .licenseId( "MirOS" ) - .seeAlso( "https://opensource.org/licenses/MirOS" ) - - .urlInfo( "http://opensource.org/licenses/MirOS", "9e09375730143747ce1086fbbf48737c05f39a2e", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/MirOS", "9e09375730143747ce1086fbbf48737c05f39a2e", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/MirOS", "9e09375730143747ce1086fbbf48737c05f39a2e", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/MirOS", "9e09375730143747ce1086fbbf48737c05f39a2e", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Motosoto.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Motosoto.json" ) - .name( "Motosoto License" ) - .licenseId( "Motosoto" ) - .seeAlso( "https://opensource.org/licenses/Motosoto" ) - - .urlInfo( "http://opensource.org/licenses/Motosoto", "f75ccbf1997379673ac1375318e9ef1e17ecd2a6", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Motosoto", "f75ccbf1997379673ac1375318e9ef1e17ecd2a6", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Motosoto", "f75ccbf1997379673ac1375318e9ef1e17ecd2a6", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Motosoto", "f75ccbf1997379673ac1375318e9ef1e17ecd2a6", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Multics.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Multics.json" ) - .name( "Multics License" ) - .licenseId( "Multics" ) - .seeAlso( "https://opensource.org/licenses/Multics" ) - - .urlInfo( "http://opensource.org/licenses/Multics", "acba80ae79da50677054d03fd656904a2562f46f", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Multics", "acba80ae79da50677054d03fd656904a2562f46f", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Multics", "acba80ae79da50677054d03fd656904a2562f46f", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Multics", "acba80ae79da50677054d03fd656904a2562f46f", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Mup.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Mup.json" ) - .name( "Mup License" ) - .licenseId( "Mup" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Mup" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Mup", "f9ce2914ce453db5f9b436b5f663b147cbbfbd11", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Mup", "f9ce2914ce453db5f9b436b5f663b147cbbfbd11", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Mup", "f9ce2914ce453db5f9b436b5f663b147cbbfbd11", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Mup", "f9ce2914ce453db5f9b436b5f663b147cbbfbd11", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./NASA-1.3.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/NASA-1.3.json" ) - .name( "NASA Open Source Agreement 1.3" ) - .licenseId( "NASA-1.3" ) - .seeAlso( "http://ti.arc.nasa.gov/opensource/nosa/" ) - .seeAlso( "https://opensource.org/licenses/NASA-1.3" ) - - .urlInfo( "http://ti.arc.nasa.gov/opensource/nosa/", "11e8aeb6176bf4bcc52cbef177c081bf099cccae", "text/html", true, false ) - .urlInfo( "https://ti.arc.nasa.gov/opensource/nosa/", "11e8aeb6176bf4bcc52cbef177c081bf099cccae", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/NASA-1.3", "29681c7ddf72b212da244a0102e5bfdd37949661", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/NASA-1.3", "29681c7ddf72b212da244a0102e5bfdd37949661", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/NASA-1.3", "29681c7ddf72b212da244a0102e5bfdd37949661", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/NASA-1.3", "29681c7ddf72b212da244a0102e5bfdd37949661", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./NBPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/NBPL-1.0.json" ) - .name( "Net Boolean Public License v1" ) - .licenseId( "NBPL-1.0" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=37b4b3f6cc4bf34e1d3dec61e69914b9819d8894" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=37b4b3f6cc4bf34e1d3dec61e69914b9819d8894", "59fd5b5f04cbeef07405d2459c0016d9fd334d7d", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=37b4b3f6cc4bf34e1d3dec61e69914b9819d8894", "59fd5b5f04cbeef07405d2459c0016d9fd334d7d", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=37b4b3f6cc4bf34e1d3dec61e69914b9819d8894", "59fd5b5f04cbeef07405d2459c0016d9fd334d7d", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./NCSA.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/NCSA.json" ) - .name( "University of Illinois/NCSA Open Source License" ) - .licenseId( "NCSA" ) - .seeAlso( "http://otm.illinois.edu/uiuc_openSource" ) - .seeAlso( "https://opensource.org/licenses/NCSA" ) - - .urlInfo( "http://opensource.org/licenses/NCSA", "3141b0642cf9e6e44ca952c0df2805d1394d5072", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/NCSA", "3141b0642cf9e6e44ca952c0df2805d1394d5072", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/NCSA", "3141b0642cf9e6e44ca952c0df2805d1394d5072", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/NCSA", "3141b0642cf9e6e44ca952c0df2805d1394d5072", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./NGPL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/NGPL.json" ) - .name( "Nethack General Public License" ) - .licenseId( "NGPL" ) - .seeAlso( "https://opensource.org/licenses/NGPL" ) - - .urlInfo( "http://opensource.org/licenses/NGPL", "9a429cbf18343b339a7414c0bcc7a5999b9bd3ec", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/NGPL", "9a429cbf18343b339a7414c0bcc7a5999b9bd3ec", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/NGPL", "9a429cbf18343b339a7414c0bcc7a5999b9bd3ec", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/NGPL", "9a429cbf18343b339a7414c0bcc7a5999b9bd3ec", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./NLOD-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/NLOD-1.0.json" ) - .name( "Norwegian Licence for Open Government Data" ) - .licenseId( "NLOD-1.0" ) - .seeAlso( "http://data.norge.no/nlod/en/1.0" ) - - .urlInfo( "http://data.norge.no/nlod/en/1.0", "3df89100286eb8f646295e602b440b889edfe1da", "text/html", true, true ) - .urlInfo( "http://www.data.norge.no/nlod/en/1.0", "3df89100286eb8f646295e602b440b889edfe1da", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./NLPL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/NLPL.json" ) - .name( "No Limit Public License" ) - .licenseId( "NLPL" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/NLPL" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/NLPL", "7b9bbe8df25314d0b33a26631f1cb64b41c55628", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/NLPL", "7b9bbe8df25314d0b33a26631f1cb64b41c55628", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./NOSL.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/NOSL.json" ) - .name( "Netizen Open Source License" ) - .licenseId( "NOSL" ) - .seeAlso( "http://bits.netizen.com.au/licenses/NOSL/nosl.txt" ) - - .urlInfo( "http://bits.netizen.com.au/licenses/NOSL/nosl.txt", "5468229b50c59c46a173a76abbca76bba8943b2a", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./NPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/NPL-1.0.json" ) - .name( "Netscape Public License v1.0" ) - .licenseId( "NPL-1.0" ) - .seeAlso( "http://www.mozilla.org/MPL/NPL/1.0/" ) - - .urlInfo( "http://mozilla.org/MPL/NPL/1.0/", "2d48e993387d4f0129ea1d2a3823c642dfffbbea", "text/html", true, false ) - .urlInfo( "http://www.mozilla.org/MPL/NPL/1.0/", "2d48e993387d4f0129ea1d2a3823c642dfffbbea", "text/html", true, false ) - .urlInfo( "https://mozilla.org/MPL/NPL/1.0/", "2d48e993387d4f0129ea1d2a3823c642dfffbbea", "text/html", true, false ) - .urlInfo( "https://www.mozilla.org/MPL/NPL/1.0/", "2d48e993387d4f0129ea1d2a3823c642dfffbbea", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./NPL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/NPL-1.1.json" ) - .name( "Netscape Public License v1.1" ) - .licenseId( "NPL-1.1" ) - .seeAlso( "http://www.mozilla.org/MPL/NPL/1.1/" ) - - .urlInfo( "http://mozilla.org/MPL/NPL/1.1/", "b4f7d615c5c6be87e982daca7276bddb0b3aa1e8", "text/html", true, false ) - .urlInfo( "http://www.mozilla.org/MPL/NPL/1.1/", "b4f7d615c5c6be87e982daca7276bddb0b3aa1e8", "text/html", true, false ) - .urlInfo( "https://mozilla.org/MPL/NPL/1.1/", "b4f7d615c5c6be87e982daca7276bddb0b3aa1e8", "text/html", true, false ) - .urlInfo( "https://www.mozilla.org/MPL/NPL/1.1/", "b4f7d615c5c6be87e982daca7276bddb0b3aa1e8", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./NPOSL-3.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/NPOSL-3.0.json" ) - .name( "Non-Profit Open Software License 3.0" ) - .licenseId( "NPOSL-3.0" ) - .seeAlso( "https://opensource.org/licenses/NOSL3.0" ) - - .urlInfo( "http://opensource.org/licenses/NOSL3.0", "3aa334e9eba1c77cc197cd922a4f6527e58232ce", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/NOSL3.0", "3aa334e9eba1c77cc197cd922a4f6527e58232ce", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/NOSL3.0", "3aa334e9eba1c77cc197cd922a4f6527e58232ce", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/NOSL3.0", "3aa334e9eba1c77cc197cd922a4f6527e58232ce", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./NRL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/NRL.json" ) - .name( "NRL License" ) - .licenseId( "NRL" ) - .seeAlso( "http://web.mit.edu/network/isakmp/nrllicense.html" ) - - .urlInfo( "http://web.mit.edu/network/isakmp/nrllicense.html", "0edd2bba1c9c88cc21d6300ed0572528e9c55970", "text/html", true, false ) - .urlInfo( "http://www.web.mit.edu/network/isakmp/nrllicense.html", "0edd2bba1c9c88cc21d6300ed0572528e9c55970", "text/html", true, false ) - .urlInfo( "https://web.mit.edu/network/isakmp/nrllicense.html", "0edd2bba1c9c88cc21d6300ed0572528e9c55970", "text/html", true, false ) - .urlInfo( "https://www.web.mit.edu/network/isakmp/nrllicense.html", "0edd2bba1c9c88cc21d6300ed0572528e9c55970", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./NTP.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/NTP.json" ) - .name( "NTP License" ) - .licenseId( "NTP" ) - .seeAlso( "https://opensource.org/licenses/NTP" ) - - .urlInfo( "http://opensource.org/licenses/NTP", "aedbe014257dedfc949723821731ad7736b54956", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/NTP", "aedbe014257dedfc949723821731ad7736b54956", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/NTP", "aedbe014257dedfc949723821731ad7736b54956", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/NTP", "aedbe014257dedfc949723821731ad7736b54956", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Naumen.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Naumen.json" ) - .name( "Naumen Public License" ) - .licenseId( "Naumen" ) - .seeAlso( "https://opensource.org/licenses/Naumen" ) - - .urlInfo( "http://opensource.org/licenses/Naumen", "83a7381f252c5a90fb736d1025f53923f699766b", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Naumen", "83a7381f252c5a90fb736d1025f53923f699766b", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Naumen", "83a7381f252c5a90fb736d1025f53923f699766b", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Naumen", "83a7381f252c5a90fb736d1025f53923f699766b", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Net-SNMP.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Net-SNMP.json" ) - .name( "Net-SNMP License" ) - .licenseId( "Net-SNMP" ) - .seeAlso( "http://net-snmp.sourceforge.net/about/license.html" ) - - .urlInfo( "http://net-snmp.sourceforge.net/about/license.html", "25bfbfe536d41d2cbe8666ba72875696e13597ef", "text/html", true, false ) - .urlInfo( "http://www.net-snmp.sourceforge.net/about/license.html", "25bfbfe536d41d2cbe8666ba72875696e13597ef", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./NetCDF.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/NetCDF.json" ) - .name( "NetCDF license" ) - .licenseId( "NetCDF" ) - .seeAlso( "http://www.unidata.ucar.edu/software/netcdf/copyright.html" ) - - .urlInfo( "http://unidata.ucar.edu/software/netcdf/copyright.html", "51ecd7daa1a158a4eaffe3143ebaaeb8d113af4b", "text/html", true, false ) - .urlInfo( "http://www.unidata.ucar.edu/software/netcdf/copyright.html", "51ecd7daa1a158a4eaffe3143ebaaeb8d113af4b", "text/html", true, false ) - .urlInfo( "https://unidata.ucar.edu/software/netcdf/copyright.html", "51ecd7daa1a158a4eaffe3143ebaaeb8d113af4b", "text/html", true, false ) - .urlInfo( "https://www.unidata.ucar.edu/software/netcdf/copyright.html", "51ecd7daa1a158a4eaffe3143ebaaeb8d113af4b", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Newsletr.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Newsletr.json" ) - .name( "Newsletr License" ) - .licenseId( "Newsletr" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Newsletr" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Newsletr", "b5f0913b2bdce15c3ae466bdd6a7e59f6904ab05", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Newsletr", "b5f0913b2bdce15c3ae466bdd6a7e59f6904ab05", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Newsletr", "b5f0913b2bdce15c3ae466bdd6a7e59f6904ab05", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Newsletr", "b5f0913b2bdce15c3ae466bdd6a7e59f6904ab05", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Nokia.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Nokia.json" ) - .name( "Nokia Open Source License" ) - .licenseId( "Nokia" ) - .seeAlso( "https://opensource.org/licenses/nokia" ) - - .urlInfo( "http://opensource.org/licenses/nokia", "36bb5004517048de1274fedc881e5c490679f9b0", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/nokia", "36bb5004517048de1274fedc881e5c490679f9b0", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/nokia", "36bb5004517048de1274fedc881e5c490679f9b0", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/nokia", "36bb5004517048de1274fedc881e5c490679f9b0", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Noweb.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Noweb.json" ) - .name( "Noweb License" ) - .licenseId( "Noweb" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Noweb" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Noweb", "2c5e531960095d86cef306683e4488075aca726d", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Noweb", "2c5e531960095d86cef306683e4488075aca726d", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Noweb", "2c5e531960095d86cef306683e4488075aca726d", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Noweb", "2c5e531960095d86cef306683e4488075aca726d", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Nunit.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Nunit.json" ) - .name( "Nunit License" ) - .licenseId( "Nunit" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Nunit" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Nunit", "664c48dfa630b006f31aad9f43cf8e0c2012ead9", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Nunit", "664c48dfa630b006f31aad9f43cf8e0c2012ead9", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Nunit", "664c48dfa630b006f31aad9f43cf8e0c2012ead9", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Nunit", "664c48dfa630b006f31aad9f43cf8e0c2012ead9", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OCCT-PL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OCCT-PL.json" ) - .name( "Open CASCADE Technology Public License" ) - .licenseId( "OCCT-PL" ) - .seeAlso( "http://www.opencascade.com/content/occt-public-license" ) - - .urlInfo( "http://opencascade.com/content/occt-public-license", "127bdd9849acb8993f245aab7fd8b7e4dd0b9f72", "text/html", true, true ) - .urlInfo( "http://www.opencascade.com/content/occt-public-license", "127bdd9849acb8993f245aab7fd8b7e4dd0b9f72", "text/html", true, true ) - .urlInfo( "https://opencascade.com/content/occt-public-license", "127bdd9849acb8993f245aab7fd8b7e4dd0b9f72", "text/html", true, true ) - .urlInfo( "https://www.opencascade.com/content/occt-public-license", "127bdd9849acb8993f245aab7fd8b7e4dd0b9f72", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OCLC-2.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OCLC-2.0.json" ) - .name( "OCLC Research Public License 2.0" ) - .licenseId( "OCLC-2.0" ) - .seeAlso( "http://www.oclc.org/research/activities/software/license/v2final.htm" ) - .seeAlso( "https://opensource.org/licenses/OCLC-2.0" ) - - .urlInfo( "http://opensource.org/licenses/OCLC-2.0", "2f94ac172687877d3cb3786f4865c67965ba1647", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/OCLC-2.0", "2f94ac172687877d3cb3786f4865c67965ba1647", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/OCLC-2.0", "2f94ac172687877d3cb3786f4865c67965ba1647", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/OCLC-2.0", "2f94ac172687877d3cb3786f4865c67965ba1647", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./ODC-By-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/ODC-By-1.0.json" ) - .name( "Open Data Commons Attribution License v1.0" ) - .licenseId( "ODC-By-1.0" ) - .seeAlso( "https://opendatacommons.org/licenses/by/1.0/" ) - - .urlInfo( "http://opendatacommons.org/licenses/by/1.0/", "afbfbf7f0ebef15843a2bffabc45243e3f4d0a89", "text/html", true, false ) - .urlInfo( "http://www.opendatacommons.org/licenses/by/1.0/", "afbfbf7f0ebef15843a2bffabc45243e3f4d0a89", "text/html", true, false ) - .urlInfo( "https://opendatacommons.org/licenses/by/1.0/", "afbfbf7f0ebef15843a2bffabc45243e3f4d0a89", "text/html", true, false ) - .urlInfo( "https://www.opendatacommons.org/licenses/by/1.0/", "afbfbf7f0ebef15843a2bffabc45243e3f4d0a89", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./ODbL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/ODbL-1.0.json" ) - .name( "ODC Open Database License v1.0" ) - .licenseId( "ODbL-1.0" ) - .seeAlso( "http://www.opendatacommons.org/licenses/odbl/1.0/" ) - - .urlInfo( "http://opendatacommons.org/licenses/odbl/1.0/", "fd9b1b8dd63fa929e82acf8b30dc2dd28077017c", "text/html", true, false ) - .urlInfo( "http://www.opendatacommons.org/licenses/odbl/1.0/", "fd9b1b8dd63fa929e82acf8b30dc2dd28077017c", "text/html", true, false ) - .urlInfo( "https://opendatacommons.org/licenses/odbl/1.0/", "fd9b1b8dd63fa929e82acf8b30dc2dd28077017c", "text/html", true, false ) - .urlInfo( "https://www.opendatacommons.org/licenses/odbl/1.0/", "fd9b1b8dd63fa929e82acf8b30dc2dd28077017c", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OFL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/OFL-1.0.json" ) - .name( "SIL Open Font License 1.0" ) - .licenseId( "OFL-1.0" ) - .seeAlso( "http://scripts.sil.org/cms/scripts/page.php?item_id=OFL10_web" ) - - .urlInfo( "http://scripts.sil.org/cms/scripts/page.php?item_id=OFL10_web", null, null, false, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OFL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/OFL-1.1.json" ) - .name( "SIL Open Font License 1.1" ) - .licenseId( "OFL-1.1" ) - .seeAlso( "http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web" ) - .seeAlso( "https://opensource.org/licenses/OFL-1.1" ) - - .urlInfo( "http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web", null, null, false, false ) - .urlInfo( "http://opensource.org/licenses/OFL-1.1", "e58cf9e0ec535d4fa242ab36f92aded54ec57f7b", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/OFL-1.1", "e58cf9e0ec535d4fa242ab36f92aded54ec57f7b", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/OFL-1.1", "e58cf9e0ec535d4fa242ab36f92aded54ec57f7b", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/OFL-1.1", "e58cf9e0ec535d4fa242ab36f92aded54ec57f7b", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OGL-UK-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OGL-UK-1.0.json" ) - .name( "Open Government Licence v1.0" ) - .licenseId( "OGL-UK-1.0" ) - .seeAlso( "http://www.nationalarchives.gov.uk/doc/open-government-licence/version/1/" ) - - .urlInfo( "http://nationalarchives.gov.uk/doc/open-government-licence/version/1/", "fb10be2a7968aff1d6c094384adf6e6c875e1001", "text/html", true, false ) - .urlInfo( "http://www.nationalarchives.gov.uk/doc/open-government-licence/version/1/", "fb10be2a7968aff1d6c094384adf6e6c875e1001", "text/html", true, false ) - .urlInfo( "https://nationalarchives.gov.uk/doc/open-government-licence/version/1/", "fb10be2a7968aff1d6c094384adf6e6c875e1001", "text/html", true, false ) - .urlInfo( "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/1/", "fb10be2a7968aff1d6c094384adf6e6c875e1001", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OGL-UK-2.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OGL-UK-2.0.json" ) - .name( "Open Government Licence v2.0" ) - .licenseId( "OGL-UK-2.0" ) - .seeAlso( "http://www.nationalarchives.gov.uk/doc/open-government-licence/version/2/" ) - - .urlInfo( "http://nationalarchives.gov.uk/doc/open-government-licence/version/2/", "491b72fdcbe84e13e1f58266c7d3776835a26ed0", "text/html", true, false ) - .urlInfo( "http://www.nationalarchives.gov.uk/doc/open-government-licence/version/2/", "491b72fdcbe84e13e1f58266c7d3776835a26ed0", "text/html", true, false ) - .urlInfo( "https://nationalarchives.gov.uk/doc/open-government-licence/version/2/", "491b72fdcbe84e13e1f58266c7d3776835a26ed0", "text/html", true, false ) - .urlInfo( "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/2/", "491b72fdcbe84e13e1f58266c7d3776835a26ed0", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OGL-UK-3.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OGL-UK-3.0.json" ) - .name( "Open Government Licence v3.0" ) - .licenseId( "OGL-UK-3.0" ) - .seeAlso( "http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" ) - - .urlInfo( "http://nationalarchives.gov.uk/doc/open-government-licence/version/3/", "0d03730a8e2941b08068cad5647fa372b78b290b", "text/html", true, false ) - .urlInfo( "http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/", "0d03730a8e2941b08068cad5647fa372b78b290b", "text/html", true, false ) - .urlInfo( "https://nationalarchives.gov.uk/doc/open-government-licence/version/3/", "0d03730a8e2941b08068cad5647fa372b78b290b", "text/html", true, false ) - .urlInfo( "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/", "0d03730a8e2941b08068cad5647fa372b78b290b", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OGTSL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OGTSL.json" ) - .name( "Open Group Test Suite License" ) - .licenseId( "OGTSL" ) - .seeAlso( "http://www.opengroup.org/testing/downloads/The_Open_Group_TSL.txt" ) - .seeAlso( "https://opensource.org/licenses/OGTSL" ) - - .urlInfo( "http://opengroup.org/testing/downloads/The_Open_Group_TSL.txt", "526e91e6d907dcb644d5e3c72e6d889250fd4cb4", "text/plain", true, false ) - .urlInfo( "http://www.opengroup.org/testing/downloads/The_Open_Group_TSL.txt", "526e91e6d907dcb644d5e3c72e6d889250fd4cb4", "text/plain", true, false ) - .urlInfo( "https://opengroup.org/testing/downloads/The_Open_Group_TSL.txt", "526e91e6d907dcb644d5e3c72e6d889250fd4cb4", "text/plain", true, false ) - .urlInfo( "https://www.opengroup.org/testing/downloads/The_Open_Group_TSL.txt", "526e91e6d907dcb644d5e3c72e6d889250fd4cb4", "text/plain", true, false ) - .urlInfo( "http://opensource.org/licenses/OGTSL", "e01f75444a4577ecddfaa220cada37fcaa80605a", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/OGTSL", "e01f75444a4577ecddfaa220cada37fcaa80605a", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/OGTSL", "e01f75444a4577ecddfaa220cada37fcaa80605a", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/OGTSL", "e01f75444a4577ecddfaa220cada37fcaa80605a", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-1.1.json" ) - .name( "Open LDAP Public License v1.1" ) - .licenseId( "OLDAP-1.1" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=806557a5ad59804ef3a44d5abfbe91d706b0791f" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=806557a5ad59804ef3a44d5abfbe91d706b0791f", "cc3609bf4dfaeff579d26ad8a4745e46b40d9e39", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=806557a5ad59804ef3a44d5abfbe91d706b0791f", "cc3609bf4dfaeff579d26ad8a4745e46b40d9e39", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=806557a5ad59804ef3a44d5abfbe91d706b0791f", "cc3609bf4dfaeff579d26ad8a4745e46b40d9e39", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-1.2.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-1.2.json" ) - .name( "Open LDAP Public License v1.2" ) - .licenseId( "OLDAP-1.2" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=42b0383c50c299977b5893ee695cf4e486fb0dc7" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=42b0383c50c299977b5893ee695cf4e486fb0dc7", "36e686a2fb48ace983206f9b8b1b1d96b84ebf35", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=42b0383c50c299977b5893ee695cf4e486fb0dc7", "36e686a2fb48ace983206f9b8b1b1d96b84ebf35", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=42b0383c50c299977b5893ee695cf4e486fb0dc7", "36e686a2fb48ace983206f9b8b1b1d96b84ebf35", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-1.3.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-1.3.json" ) - .name( "Open LDAP Public License v1.3" ) - .licenseId( "OLDAP-1.3" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=e5f8117f0ce088d0bd7a8e18ddf37eaa40eb09b1" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=e5f8117f0ce088d0bd7a8e18ddf37eaa40eb09b1", "dd41669825e0d0a99ab82a10b850f07c28ca163b", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=e5f8117f0ce088d0bd7a8e18ddf37eaa40eb09b1", "dd41669825e0d0a99ab82a10b850f07c28ca163b", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=e5f8117f0ce088d0bd7a8e18ddf37eaa40eb09b1", "dd41669825e0d0a99ab82a10b850f07c28ca163b", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-1.4.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-1.4.json" ) - .name( "Open LDAP Public License v1.4" ) - .licenseId( "OLDAP-1.4" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=c9f95c2f3f2ffb5e0ae55fe7388af75547660941" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=c9f95c2f3f2ffb5e0ae55fe7388af75547660941", "7f9996c5ccda375682c2888c1443b2d88a095ae2", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=c9f95c2f3f2ffb5e0ae55fe7388af75547660941", "7f9996c5ccda375682c2888c1443b2d88a095ae2", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=c9f95c2f3f2ffb5e0ae55fe7388af75547660941", "7f9996c5ccda375682c2888c1443b2d88a095ae2", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-2.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-2.0.json" ) - .name( "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)" ) - .licenseId( "OLDAP-2.0" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=cbf50f4e1185a21abd4c0a54d3f4341fe28f36ea" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=cbf50f4e1185a21abd4c0a54d3f4341fe28f36ea", "4143bc62158eddba55ece8e86c696da95431be52", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=cbf50f4e1185a21abd4c0a54d3f4341fe28f36ea", "4143bc62158eddba55ece8e86c696da95431be52", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=cbf50f4e1185a21abd4c0a54d3f4341fe28f36ea", "4143bc62158eddba55ece8e86c696da95431be52", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-2.0.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-2.0.1.json" ) - .name( "Open LDAP Public License v2.0.1" ) - .licenseId( "OLDAP-2.0.1" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=b6d68acd14e51ca3aab4428bf26522aa74873f0e" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=b6d68acd14e51ca3aab4428bf26522aa74873f0e", "0ad6d8ce330110b0a598a1db41e95f07f867ae8f", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=b6d68acd14e51ca3aab4428bf26522aa74873f0e", "0ad6d8ce330110b0a598a1db41e95f07f867ae8f", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=b6d68acd14e51ca3aab4428bf26522aa74873f0e", "0ad6d8ce330110b0a598a1db41e95f07f867ae8f", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-2.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-2.1.json" ) - .name( "Open LDAP Public License v2.1" ) - .licenseId( "OLDAP-2.1" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=b0d176738e96a0d3b9f85cb51e140a86f21be715" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=b0d176738e96a0d3b9f85cb51e140a86f21be715", "d1c12b87b84ccb94fbe3ee404bc47363a59ae457", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=b0d176738e96a0d3b9f85cb51e140a86f21be715", "d1c12b87b84ccb94fbe3ee404bc47363a59ae457", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=b0d176738e96a0d3b9f85cb51e140a86f21be715", "d1c12b87b84ccb94fbe3ee404bc47363a59ae457", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-2.2.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-2.2.json" ) - .name( "Open LDAP Public License v2.2" ) - .licenseId( "OLDAP-2.2" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=470b0c18ec67621c85881b2733057fecf4a1acc3" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=470b0c18ec67621c85881b2733057fecf4a1acc3", "a2d5f10f30009baefde6908b1f1b91c5e056ad0e", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=470b0c18ec67621c85881b2733057fecf4a1acc3", "a2d5f10f30009baefde6908b1f1b91c5e056ad0e", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=470b0c18ec67621c85881b2733057fecf4a1acc3", "a2d5f10f30009baefde6908b1f1b91c5e056ad0e", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-2.2.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-2.2.1.json" ) - .name( "Open LDAP Public License v2.2.1" ) - .licenseId( "OLDAP-2.2.1" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=4bc786f34b50aa301be6f5600f58a980070f481e" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=4bc786f34b50aa301be6f5600f58a980070f481e", "47f9ffa3cc4cddb9a0a460c899f5ed78a98693ed", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=4bc786f34b50aa301be6f5600f58a980070f481e", "47f9ffa3cc4cddb9a0a460c899f5ed78a98693ed", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=4bc786f34b50aa301be6f5600f58a980070f481e", "47f9ffa3cc4cddb9a0a460c899f5ed78a98693ed", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-2.2.2.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-2.2.2.json" ) - .name( "Open LDAP Public License 2.2.2" ) - .licenseId( "OLDAP-2.2.2" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=df2cc1e21eb7c160695f5b7cffd6296c151ba188" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=df2cc1e21eb7c160695f5b7cffd6296c151ba188", "91a4bcf746a90ec19b5915cf6f440e137220fc65", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=df2cc1e21eb7c160695f5b7cffd6296c151ba188", "91a4bcf746a90ec19b5915cf6f440e137220fc65", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=df2cc1e21eb7c160695f5b7cffd6296c151ba188", "91a4bcf746a90ec19b5915cf6f440e137220fc65", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-2.3.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-2.3.json" ) - .name( "Open LDAP Public License v2.3" ) - .licenseId( "OLDAP-2.3" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=d32cf54a32d581ab475d23c810b0a7fbaf8d63c3" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=d32cf54a32d581ab475d23c810b0a7fbaf8d63c3", "e7edc1d7ffb7a8c5687151ebe8db8d8084459fa6", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=d32cf54a32d581ab475d23c810b0a7fbaf8d63c3", "e7edc1d7ffb7a8c5687151ebe8db8d8084459fa6", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=d32cf54a32d581ab475d23c810b0a7fbaf8d63c3", "e7edc1d7ffb7a8c5687151ebe8db8d8084459fa6", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-2.4.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-2.4.json" ) - .name( "Open LDAP Public License v2.4" ) - .licenseId( "OLDAP-2.4" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=cd1284c4a91a8a380d904eee68d1583f989ed386" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=cd1284c4a91a8a380d904eee68d1583f989ed386", "859351b167aeb994a2bdb83474c446831891cdeb", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=cd1284c4a91a8a380d904eee68d1583f989ed386", "859351b167aeb994a2bdb83474c446831891cdeb", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=cd1284c4a91a8a380d904eee68d1583f989ed386", "859351b167aeb994a2bdb83474c446831891cdeb", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-2.5.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-2.5.json" ) - .name( "Open LDAP Public License v2.5" ) - .licenseId( "OLDAP-2.5" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=6852b9d90022e8593c98205413380536b1b5a7cf" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=6852b9d90022e8593c98205413380536b1b5a7cf", "10bc14c8710f1abd9a9fbe92ef733b9b52727c11", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=6852b9d90022e8593c98205413380536b1b5a7cf", "10bc14c8710f1abd9a9fbe92ef733b9b52727c11", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=6852b9d90022e8593c98205413380536b1b5a7cf", "10bc14c8710f1abd9a9fbe92ef733b9b52727c11", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-2.6.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-2.6.json" ) - .name( "Open LDAP Public License v2.6" ) - .licenseId( "OLDAP-2.6" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=1cae062821881f41b73012ba816434897abf4205" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=1cae062821881f41b73012ba816434897abf4205", "ad139a7d2daff170319dc950d7a9d6ce72f2cbd5", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=1cae062821881f41b73012ba816434897abf4205", "ad139a7d2daff170319dc950d7a9d6ce72f2cbd5", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=1cae062821881f41b73012ba816434897abf4205", "ad139a7d2daff170319dc950d7a9d6ce72f2cbd5", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-2.7.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-2.7.json" ) - .name( "Open LDAP Public License v2.7" ) - .licenseId( "OLDAP-2.7" ) - .seeAlso( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=47c2415c1df81556eeb39be6cad458ef87c534a2" ) - - .urlInfo( "http://openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=47c2415c1df81556eeb39be6cad458ef87c534a2", "e2a208598e075a07706faad2af61b85983f95c93", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=47c2415c1df81556eeb39be6cad458ef87c534a2", "e2a208598e075a07706faad2af61b85983f95c93", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=LICENSE;hb=47c2415c1df81556eeb39be6cad458ef87c534a2", "e2a208598e075a07706faad2af61b85983f95c93", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OLDAP-2.8.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OLDAP-2.8.json" ) - .name( "Open LDAP Public License v2.8" ) - .licenseId( "OLDAP-2.8" ) - .seeAlso( "http://www.openldap.org/software/release/license.html" ) - - .urlInfo( "http://openldap.org/software/release/license.html", "fc5f8da10a6a57b8475f3dff52475367c692de76", "text/html", true, false ) - .urlInfo( "http://www.openldap.org/software/release/license.html", "fc5f8da10a6a57b8475f3dff52475367c692de76", "text/html", true, false ) - .urlInfo( "https://www.openldap.org/software/release/license.html", "fc5f8da10a6a57b8475f3dff52475367c692de76", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OML.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OML.json" ) - .name( "Open Market License" ) - .licenseId( "OML" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Open_Market_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Open_Market_License", "397e02bdd0af54afd96b9949bb190ba0b12c37e6", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Open_Market_License", "397e02bdd0af54afd96b9949bb190ba0b12c37e6", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Open_Market_License", "397e02bdd0af54afd96b9949bb190ba0b12c37e6", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Open_Market_License", "397e02bdd0af54afd96b9949bb190ba0b12c37e6", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OPL-1.0.json" ) - .name( "Open Public License v1.0" ) - .licenseId( "OPL-1.0" ) - .seeAlso( "http://old.koalateam.com/jackaroo/OPL_1_0.TXT" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Open_Public_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Open_Public_License", "cb4b0b31f46f10cba3184639c08ea0d3455a360f", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Open_Public_License", "cb4b0b31f46f10cba3184639c08ea0d3455a360f", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Open_Public_License", "cb4b0b31f46f10cba3184639c08ea0d3455a360f", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Open_Public_License", "cb4b0b31f46f10cba3184639c08ea0d3455a360f", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OSET-PL-2.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/OSET-PL-2.1.json" ) - .name( "OSET Public License version 2.1" ) - .licenseId( "OSET-PL-2.1" ) - .seeAlso( "http://www.osetfoundation.org/public-license" ) - .seeAlso( "https://opensource.org/licenses/OPL-2.1" ) - - .urlInfo( "http://osetfoundation.org/public-license", "77e788702ad7b34ccc822a6c41b4021fc4ba68c0", "text/html", true, false ) - .urlInfo( "http://www.osetfoundation.org/public-license", "77e788702ad7b34ccc822a6c41b4021fc4ba68c0", "text/html", true, false ) - .urlInfo( "https://www.osetfoundation.org/public-license", "77e788702ad7b34ccc822a6c41b4021fc4ba68c0", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/OPL-2.1", "3abf914cd1d74443540f2758324d6c0cef89c8cc", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/OPL-2.1", "3abf914cd1d74443540f2758324d6c0cef89c8cc", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/OPL-2.1", "3abf914cd1d74443540f2758324d6c0cef89c8cc", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/OPL-2.1", "3abf914cd1d74443540f2758324d6c0cef89c8cc", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OSL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/OSL-1.0.json" ) - .name( "Open Software License 1.0" ) - .licenseId( "OSL-1.0" ) - .seeAlso( "https://opensource.org/licenses/OSL-1.0" ) - - .urlInfo( "http://opensource.org/licenses/OSL-1.0", "4e314550f233137ff794d989f5910ce239b911f7", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/OSL-1.0", "4e314550f233137ff794d989f5910ce239b911f7", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/OSL-1.0", "4e314550f233137ff794d989f5910ce239b911f7", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/OSL-1.0", "4e314550f233137ff794d989f5910ce239b911f7", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OSL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/OSL-1.1.json" ) - .name( "Open Software License 1.1" ) - .licenseId( "OSL-1.1" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/OSL1.1" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/OSL1.1", "31807dcec6a012bc946d634200c5cea56a37304a", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/OSL1.1", "31807dcec6a012bc946d634200c5cea56a37304a", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/OSL1.1", "31807dcec6a012bc946d634200c5cea56a37304a", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/OSL1.1", "31807dcec6a012bc946d634200c5cea56a37304a", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OSL-2.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/OSL-2.0.json" ) - .name( "Open Software License 2.0" ) - .licenseId( "OSL-2.0" ) - .seeAlso( "http://web.archive.org/web/20041020171434/http://www.rosenlaw.com/osl2.0.html" ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OSL-2.1.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/OSL-2.1.json" ) - .name( "Open Software License 2.1" ) - .licenseId( "OSL-2.1" ) - .seeAlso( "http://web.archive.org/web/20050212003940/http://www.rosenlaw.com/osl21.htm" ) - .seeAlso( "https://opensource.org/licenses/OSL-2.1" ) - - .urlInfo( "http://opensource.org/licenses/OSL-2.1", "b42a3577ba5d2ce662ecc77d93999d8fb5b127cc", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/OSL-2.1", "b42a3577ba5d2ce662ecc77d93999d8fb5b127cc", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/OSL-2.1", "b42a3577ba5d2ce662ecc77d93999d8fb5b127cc", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/OSL-2.1", "b42a3577ba5d2ce662ecc77d93999d8fb5b127cc", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OSL-3.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/OSL-3.0.json" ) - .name( "Open Software License 3.0" ) - .licenseId( "OSL-3.0" ) - .seeAlso( "https://web.archive.org/web/20120101081418/http://rosenlaw.com:80/OSL3.0.htm" ) - .seeAlso( "https://opensource.org/licenses/OSL-3.0" ) - - .urlInfo( "http://opensource.org/licenses/OSL-3.0", "9da420e5815662ff8685bc7904baf02e35bf5e0b", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/OSL-3.0", "9da420e5815662ff8685bc7904baf02e35bf5e0b", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/OSL-3.0", "9da420e5815662ff8685bc7904baf02e35bf5e0b", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/OSL-3.0", "9da420e5815662ff8685bc7904baf02e35bf5e0b", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./OpenSSL.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/OpenSSL.json" ) - .name( "OpenSSL License" ) - .licenseId( "OpenSSL" ) - .seeAlso( "http://www.openssl.org/source/license.html" ) - - .urlInfo( "http://openssl.org/source/license.html", "fdbb76640b239aafe4b4efdacac25cdf1427418f", "text/html", true, false ) - .urlInfo( "http://www.openssl.org/source/license.html", "fdbb76640b239aafe4b4efdacac25cdf1427418f", "text/html", true, false ) - .urlInfo( "https://openssl.org/source/license.html", "fdbb76640b239aafe4b4efdacac25cdf1427418f", "text/html", true, false ) - .urlInfo( "https://www.openssl.org/source/license.html", "fdbb76640b239aafe4b4efdacac25cdf1427418f", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./PDDL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/PDDL-1.0.json" ) - .name( "ODC Public Domain Dedication & License 1.0" ) - .licenseId( "PDDL-1.0" ) - .seeAlso( "http://opendatacommons.org/licenses/pddl/1.0/" ) - - .urlInfo( "http://opendatacommons.org/licenses/pddl/1.0/", "c73695b2fe15a85ceb8f147bf02c41b3624eaa00", "text/html", true, false ) - .urlInfo( "http://www.opendatacommons.org/licenses/pddl/1.0/", "c73695b2fe15a85ceb8f147bf02c41b3624eaa00", "text/html", true, false ) - .urlInfo( "https://opendatacommons.org/licenses/pddl/1.0/", "c73695b2fe15a85ceb8f147bf02c41b3624eaa00", "text/html", true, false ) - .urlInfo( "https://www.opendatacommons.org/licenses/pddl/1.0/", "c73695b2fe15a85ceb8f147bf02c41b3624eaa00", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./PHP-3.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/PHP-3.0.json" ) - .name( "PHP License v3.0" ) - .licenseId( "PHP-3.0" ) - .seeAlso( "http://www.php.net/license/3_0.txt" ) - .seeAlso( "https://opensource.org/licenses/PHP-3.0" ) - - .urlInfo( "http://php.net/license/3_0.txt", "b568098fecaddcee5626728c874c3d3bebcbb83f", "text/plain", true, false ) - .urlInfo( "http://www.php.net/license/3_0.txt", "b568098fecaddcee5626728c874c3d3bebcbb83f", "text/plain", true, false ) - .urlInfo( "https://php.net/license/3_0.txt", "b568098fecaddcee5626728c874c3d3bebcbb83f", "text/plain", true, false ) - .urlInfo( "https://www.php.net/license/3_0.txt", "b568098fecaddcee5626728c874c3d3bebcbb83f", "text/plain", true, false ) - .urlInfo( "http://opensource.org/licenses/PHP-3.0", "93c68f06d0a7a0da92b01b3bed063b537166d04b", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/PHP-3.0", "93c68f06d0a7a0da92b01b3bed063b537166d04b", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/PHP-3.0", "93c68f06d0a7a0da92b01b3bed063b537166d04b", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/PHP-3.0", "93c68f06d0a7a0da92b01b3bed063b537166d04b", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./PHP-3.01.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/PHP-3.01.json" ) - .name( "PHP License v3.01" ) - .licenseId( "PHP-3.01" ) - .seeAlso( "http://www.php.net/license/3_01.txt" ) - - .urlInfo( "http://php.net/license/3_01.txt", "27b46923d7341b6bb717d06db4850b1180d565b2", "text/plain", true, false ) - .urlInfo( "http://www.php.net/license/3_01.txt", "27b46923d7341b6bb717d06db4850b1180d565b2", "text/plain", true, false ) - .urlInfo( "https://php.net/license/3_01.txt", "27b46923d7341b6bb717d06db4850b1180d565b2", "text/plain", true, false ) - .urlInfo( "https://www.php.net/license/3_01.txt", "27b46923d7341b6bb717d06db4850b1180d565b2", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Plexus.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Plexus.json" ) - .name( "Plexus Classworlds License" ) - .licenseId( "Plexus" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Plexus_Classworlds_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Plexus_Classworlds_License", "f50c771b67fe86c08ce0932e2bb67290ce29c3a0", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Plexus_Classworlds_License", "f50c771b67fe86c08ce0932e2bb67290ce29c3a0", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Plexus_Classworlds_License", "f50c771b67fe86c08ce0932e2bb67290ce29c3a0", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Plexus_Classworlds_License", "f50c771b67fe86c08ce0932e2bb67290ce29c3a0", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./PostgreSQL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/PostgreSQL.json" ) - .name( "PostgreSQL License" ) - .licenseId( "PostgreSQL" ) - .seeAlso( "http://www.postgresql.org/about/licence" ) - .seeAlso( "https://opensource.org/licenses/PostgreSQL" ) - - .urlInfo( "http://postgresql.org/about/licence", "8fe3616ebbaa6f0880dfc7201b28251d8a89e042", "text/html", true, false ) - .urlInfo( "http://www.postgresql.org/about/licence", "8fe3616ebbaa6f0880dfc7201b28251d8a89e042", "text/html", true, false ) - .urlInfo( "https://postgresql.org/about/licence", "8fe3616ebbaa6f0880dfc7201b28251d8a89e042", "text/html", true, false ) - .urlInfo( "https://www.postgresql.org/about/licence", "8fe3616ebbaa6f0880dfc7201b28251d8a89e042", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/PostgreSQL", "f02b9183b2efdec12ba7b1ee7c1f386356e3693a", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/PostgreSQL", "f02b9183b2efdec12ba7b1ee7c1f386356e3693a", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/PostgreSQL", "f02b9183b2efdec12ba7b1ee7c1f386356e3693a", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/PostgreSQL", "f02b9183b2efdec12ba7b1ee7c1f386356e3693a", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Python-2.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Python-2.0.json" ) - .name( "Python License 2.0" ) - .licenseId( "Python-2.0" ) - .seeAlso( "https://opensource.org/licenses/Python-2.0" ) - - .urlInfo( "http://opensource.org/licenses/Python-2.0", "156935145768e0f81d179b4ae7e87165d9abfab8", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Python-2.0", "156935145768e0f81d179b4ae7e87165d9abfab8", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Python-2.0", "156935145768e0f81d179b4ae7e87165d9abfab8", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Python-2.0", "156935145768e0f81d179b4ae7e87165d9abfab8", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./QPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/QPL-1.0.json" ) - .name( "Q Public License 1.0" ) - .licenseId( "QPL-1.0" ) - .seeAlso( "http://doc.qt.nokia.com/3.3/license.html" ) - .seeAlso( "https://opensource.org/licenses/QPL-1.0" ) - - .urlInfo( "http://opensource.org/licenses/QPL-1.0", "0834befe868efb1cc2e3614ac22b3f5c1c23ae4a", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/QPL-1.0", "0834befe868efb1cc2e3614ac22b3f5c1c23ae4a", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/QPL-1.0", "0834befe868efb1cc2e3614ac22b3f5c1c23ae4a", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/QPL-1.0", "0834befe868efb1cc2e3614ac22b3f5c1c23ae4a", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Qhull.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Qhull.json" ) - .name( "Qhull License" ) - .licenseId( "Qhull" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Qhull" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Qhull", "df46e4c9d0e38d78a7e70f93622e3662f18ec285", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Qhull", "df46e4c9d0e38d78a7e70f93622e3662f18ec285", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Qhull", "df46e4c9d0e38d78a7e70f93622e3662f18ec285", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Qhull", "df46e4c9d0e38d78a7e70f93622e3662f18ec285", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./RHeCos-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/RHeCos-1.1.json" ) - .name( "Red Hat eCos Public License v1.1" ) - .licenseId( "RHeCos-1.1" ) - .seeAlso( "http://ecos.sourceware.org/old-license.html" ) - - .urlInfo( "http://ecos.sourceware.org/old-license.html", "7144b1739e30b52df1020dff8866c352babc9460", "text/html", true, false ) - .urlInfo( "http://www.ecos.sourceware.org/old-license.html", "7144b1739e30b52df1020dff8866c352babc9460", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./RPL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/RPL-1.1.json" ) - .name( "Reciprocal Public License 1.1" ) - .licenseId( "RPL-1.1" ) - .seeAlso( "https://opensource.org/licenses/RPL-1.1" ) - - .urlInfo( "http://opensource.org/licenses/RPL-1.1", "34007674968ba1b06171f2e6448bc6c361840e2e", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/RPL-1.1", "34007674968ba1b06171f2e6448bc6c361840e2e", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/RPL-1.1", "34007674968ba1b06171f2e6448bc6c361840e2e", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/RPL-1.1", "34007674968ba1b06171f2e6448bc6c361840e2e", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./RPL-1.5.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/RPL-1.5.json" ) - .name( "Reciprocal Public License 1.5" ) - .licenseId( "RPL-1.5" ) - .seeAlso( "https://opensource.org/licenses/RPL-1.5" ) - - .urlInfo( "http://opensource.org/licenses/RPL-1.5", "b61c1bd2f64d111ce6dd812d47c9b454d9ab7de8", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/RPL-1.5", "b61c1bd2f64d111ce6dd812d47c9b454d9ab7de8", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/RPL-1.5", "b61c1bd2f64d111ce6dd812d47c9b454d9ab7de8", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/RPL-1.5", "b61c1bd2f64d111ce6dd812d47c9b454d9ab7de8", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./RPSL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/RPSL-1.0.json" ) - .name( "RealNetworks Public Source License v1.0" ) - .licenseId( "RPSL-1.0" ) - .seeAlso( "https://helixcommunity.org/content/rpsl" ) - .seeAlso( "https://opensource.org/licenses/RPSL-1.0" ) - - .urlInfo( "http://opensource.org/licenses/RPSL-1.0", "c288846f50aea248ff3cc6f236902bddea441445", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/RPSL-1.0", "c288846f50aea248ff3cc6f236902bddea441445", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/RPSL-1.0", "c288846f50aea248ff3cc6f236902bddea441445", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/RPSL-1.0", "c288846f50aea248ff3cc6f236902bddea441445", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./RSA-MD.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/RSA-MD.json" ) - .name( "RSA Message-Digest License" ) - .licenseId( "RSA-MD" ) - .seeAlso( "http://www.faqs.org/rfcs/rfc1321.html" ) - - .urlInfo( "http://faqs.org/rfcs/rfc1321.html", "c6576de398f1121635a137c8335d9dd548170311", "text/html", true, false ) - .urlInfo( "http://www.faqs.org/rfcs/rfc1321.html", "c6576de398f1121635a137c8335d9dd548170311", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./RSCPL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/RSCPL.json" ) - .name( "Ricoh Source Code Public License" ) - .licenseId( "RSCPL" ) - .seeAlso( "http://wayback.archive.org/web/20060715140826/http://www.risource.org/RPL/RPL-1.0A.shtml" ) - .seeAlso( "https://opensource.org/licenses/RSCPL" ) - - .urlInfo( "http://opensource.org/licenses/RSCPL", "da1b642ae80c4837d8a423b4b4ca8bc8e53bfb59", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/RSCPL", "da1b642ae80c4837d8a423b4b4ca8bc8e53bfb59", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/RSCPL", "da1b642ae80c4837d8a423b4b4ca8bc8e53bfb59", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/RSCPL", "da1b642ae80c4837d8a423b4b4ca8bc8e53bfb59", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Rdisc.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Rdisc.json" ) - .name( "Rdisc License" ) - .licenseId( "Rdisc" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Rdisc_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Rdisc_License", "ed7eb23ca6a2897407c60e8ff92e326428deb803", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Rdisc_License", "ed7eb23ca6a2897407c60e8ff92e326428deb803", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Rdisc_License", "ed7eb23ca6a2897407c60e8ff92e326428deb803", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Rdisc_License", "ed7eb23ca6a2897407c60e8ff92e326428deb803", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Ruby.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Ruby.json" ) - .name( "Ruby License" ) - .licenseId( "Ruby" ) - .seeAlso( "http://www.ruby-lang.org/en/LICENSE.txt" ) - - .urlInfo( "http://ruby-lang.org/en/LICENSE.txt", "f1d4e2e57f37d52f9d2ec0443c5305ad882b73ce", "text/plain", true, false ) - .urlInfo( "http://www.ruby-lang.org/en/LICENSE.txt", "f1d4e2e57f37d52f9d2ec0443c5305ad882b73ce", "text/plain", true, false ) - .urlInfo( "https://www.ruby-lang.org/en/LICENSE.txt", "f1d4e2e57f37d52f9d2ec0443c5305ad882b73ce", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./SAX-PD.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/SAX-PD.json" ) - .name( "Sax Public Domain Notice" ) - .licenseId( "SAX-PD" ) - .seeAlso( "http://www.saxproject.org/copying.html" ) - - .urlInfo( "http://www.saxproject.org/copying.html", "b5045f54ee707e82e7c89ed51a53ba60bb993fd5", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./SCEA.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/SCEA.json" ) - .name( "SCEA Shared Source License" ) - .licenseId( "SCEA" ) - .seeAlso( "http://research.scea.com/scea_shared_source_license.html" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./SGI-B-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/SGI-B-1.0.json" ) - .name( "SGI Free Software License B v1.0" ) - .licenseId( "SGI-B-1.0" ) - .seeAlso( "http://oss.sgi.com/projects/FreeB/SGIFreeSWLicB.1.0.html" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./SGI-B-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/SGI-B-1.1.json" ) - .name( "SGI Free Software License B v1.1" ) - .licenseId( "SGI-B-1.1" ) - .seeAlso( "http://oss.sgi.com/projects/FreeB/" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./SGI-B-2.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/SGI-B-2.0.json" ) - .name( "SGI Free Software License B v2.0" ) - .licenseId( "SGI-B-2.0" ) - .seeAlso( "http://oss.sgi.com/projects/FreeB/SGIFreeSWLicB.2.0.pdf" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./SISSL.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/SISSL.json" ) - .name( "Sun Industry Standards Source License v1.1" ) - .licenseId( "SISSL" ) - .seeAlso( "http://www.openoffice.org/licenses/sissl_license.html" ) - .seeAlso( "https://opensource.org/licenses/SISSL" ) - - .urlInfo( "http://openoffice.org/licenses/sissl_license.html", "d9c2f90c94811005c80c24e2b08349be0e5ea527", "text/html", true, false ) - .urlInfo( "http://www.openoffice.org/licenses/sissl_license.html", "d9c2f90c94811005c80c24e2b08349be0e5ea527", "text/html", true, false ) - .urlInfo( "https://openoffice.org/licenses/sissl_license.html", "d9c2f90c94811005c80c24e2b08349be0e5ea527", "text/html", true, false ) - .urlInfo( "https://www.openoffice.org/licenses/sissl_license.html", "d9c2f90c94811005c80c24e2b08349be0e5ea527", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/SISSL", "c71b77c3d7f17c86d03b966cb86f800c595fdb95", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/SISSL", "c71b77c3d7f17c86d03b966cb86f800c595fdb95", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/SISSL", "c71b77c3d7f17c86d03b966cb86f800c595fdb95", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/SISSL", "c71b77c3d7f17c86d03b966cb86f800c595fdb95", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./SISSL-1.2.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/SISSL-1.2.json" ) - .name( "Sun Industry Standards Source License v1.2" ) - .licenseId( "SISSL-1.2" ) - .seeAlso( "http://gridscheduler.sourceforge.net/Gridengine_SISSL_license.html" ) - - .urlInfo( "http://gridscheduler.sourceforge.net/Gridengine_SISSL_license.html", "38ef0c536157be42d18d16002c02893d814e1516", "text/html", true, false ) - .urlInfo( "http://www.gridscheduler.sourceforge.net/Gridengine_SISSL_license.html", "38ef0c536157be42d18d16002c02893d814e1516", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./SMLNJ.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/SMLNJ.json" ) - .name( "Standard ML of New Jersey License" ) - .licenseId( "SMLNJ" ) - .seeAlso( "https://www.smlnj.org/license.html" ) - - .urlInfo( "http://smlnj.org//license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .urlInfo( "http://smlnj.org/license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .urlInfo( "http://www.smlnj.org//license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .urlInfo( "http://www.smlnj.org/license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .urlInfo( "https://smlnj.org//license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .urlInfo( "https://smlnj.org/license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .urlInfo( "https://www.smlnj.org//license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .urlInfo( "https://www.smlnj.org/license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./SMPPL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/SMPPL.json" ) - .name( "Secure Messaging Protocol Public License" ) - .licenseId( "SMPPL" ) - .seeAlso( "https://github.com/dcblake/SMP/blob/master/Documentation/License.txt" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./SNIA.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/SNIA.json" ) - .name( "SNIA Public License 1.1" ) - .licenseId( "SNIA" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/SNIA_Public_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/SNIA_Public_License", "fb6eab8505c7cbb80424dd411870302f0ab34f39", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/SNIA_Public_License", "fb6eab8505c7cbb80424dd411870302f0ab34f39", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/SNIA_Public_License", "fb6eab8505c7cbb80424dd411870302f0ab34f39", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/SNIA_Public_License", "fb6eab8505c7cbb80424dd411870302f0ab34f39", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./SPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/SPL-1.0.json" ) - .name( "Sun Public License v1.0" ) - .licenseId( "SPL-1.0" ) - .seeAlso( "https://opensource.org/licenses/SPL-1.0" ) - - .urlInfo( "http://opensource.org/licenses/SPL-1.0", "86b253647f6f49a17ff49f5692ae2972f1086fce", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/SPL-1.0", "86b253647f6f49a17ff49f5692ae2972f1086fce", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/SPL-1.0", "86b253647f6f49a17ff49f5692ae2972f1086fce", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/SPL-1.0", "86b253647f6f49a17ff49f5692ae2972f1086fce", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./SWL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/SWL.json" ) - .name( "Scheme Widget Library (SWL) Software License Agreement" ) - .licenseId( "SWL" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/SWL" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/SWL", "8e8f3b2a9fd241df8fa624581f6b69ca155e388d", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/SWL", "8e8f3b2a9fd241df8fa624581f6b69ca155e388d", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/SWL", "8e8f3b2a9fd241df8fa624581f6b69ca155e388d", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/SWL", "8e8f3b2a9fd241df8fa624581f6b69ca155e388d", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Saxpath.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Saxpath.json" ) - .name( "Saxpath License" ) - .licenseId( "Saxpath" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Saxpath_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Saxpath_License", "0b6034499b7fcfea80c6ef0b0782b83a876c8a85", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Saxpath_License", "0b6034499b7fcfea80c6ef0b0782b83a876c8a85", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Saxpath_License", "0b6034499b7fcfea80c6ef0b0782b83a876c8a85", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Saxpath_License", "0b6034499b7fcfea80c6ef0b0782b83a876c8a85", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Sendmail.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Sendmail.json" ) - .name( "Sendmail License" ) - .licenseId( "Sendmail" ) - .seeAlso( "http://www.sendmail.com/pdfs/open_source/sendmail_license.pdf" ) - .seeAlso( "https://web.archive.org/web/20160322142305/https://www.sendmail.com/pdfs/open_source/sendmail_license.pdf" ) - - .urlInfo( "http://www.sendmail.com/pdfs/open_source/sendmail_license.pdf", null, null, false, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Sendmail-8.23.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Sendmail-8.23.json" ) - .name( "Sendmail License 8.23" ) - .licenseId( "Sendmail-8.23" ) - .seeAlso( "https://www.proofpoint.com/sites/default/files/sendmail-license.pdf" ) - .seeAlso( "https://web.archive.org/web/20181003101040/https://www.proofpoint.com/sites/default/files/sendmail-license.pdf" ) - - .urlInfo( "http://proofpoint.com/sites/default/files/sendmail-license.pdf", "2f0605b00214d85158c4bc503e72c02033d09916", "application/pdf", true, false ) - .urlInfo( "http://web.archive.org/web/20181003101040id_/http://proofpoint.com/sites/default/files/sendmail-license.pdf", "2f0605b00214d85158c4bc503e72c02033d09916", "application/pdf", true, false ) - .urlInfo( "http://www.proofpoint.com/sites/default/files/sendmail-license.pdf", "2f0605b00214d85158c4bc503e72c02033d09916", "application/pdf", true, false ) - .urlInfo( "https://proofpoint.com/sites/default/files/sendmail-license.pdf", "2f0605b00214d85158c4bc503e72c02033d09916", "application/pdf", true, false ) - .urlInfo( "https://web.archive.org/web/20181003101040id_/https://www.proofpoint.com/sites/default/files/sendmail-license.pdf", "2f0605b00214d85158c4bc503e72c02033d09916", "application/pdf", true, false ) - .urlInfo( "https://www.proofpoint.com/sites/default/files/sendmail-license.pdf", "2f0605b00214d85158c4bc503e72c02033d09916", "application/pdf", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./SimPL-2.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/SimPL-2.0.json" ) - .name( "Simple Public License 2.0" ) - .licenseId( "SimPL-2.0" ) - .seeAlso( "https://opensource.org/licenses/SimPL-2.0" ) - - .urlInfo( "http://opensource.org/licenses/SimPL-2.0", "af8be541951c6b28afc2a96398135bf898998417", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/SimPL-2.0", "af8be541951c6b28afc2a96398135bf898998417", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/SimPL-2.0", "af8be541951c6b28afc2a96398135bf898998417", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/SimPL-2.0", "af8be541951c6b28afc2a96398135bf898998417", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Sleepycat.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Sleepycat.json" ) - .name( "Sleepycat License" ) - .licenseId( "Sleepycat" ) - .seeAlso( "https://opensource.org/licenses/Sleepycat" ) - - .urlInfo( "http://opensource.org/licenses/Sleepycat", "a2612720cb52ed4c913e12821bb8915ea40a49e6", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Sleepycat", "a2612720cb52ed4c913e12821bb8915ea40a49e6", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Sleepycat", "a2612720cb52ed4c913e12821bb8915ea40a49e6", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Sleepycat", "a2612720cb52ed4c913e12821bb8915ea40a49e6", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Spencer-86.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Spencer-86.json" ) - .name( "Spencer License 86" ) - .licenseId( "Spencer-86" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Henry_Spencer_Reg-Ex_Library_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Henry_Spencer_Reg-Ex_Library_License", "130fcd36be8fe164eb68d951ba73ae3efdb846da", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Henry_Spencer_Reg-Ex_Library_License", "130fcd36be8fe164eb68d951ba73ae3efdb846da", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Henry_Spencer_Reg-Ex_Library_License", "130fcd36be8fe164eb68d951ba73ae3efdb846da", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Henry_Spencer_Reg-Ex_Library_License", "130fcd36be8fe164eb68d951ba73ae3efdb846da", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Spencer-94.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Spencer-94.json" ) - .name( "Spencer License 94" ) - .licenseId( "Spencer-94" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Henry_Spencer_Reg-Ex_Library_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Henry_Spencer_Reg-Ex_Library_License", "130fcd36be8fe164eb68d951ba73ae3efdb846da", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Henry_Spencer_Reg-Ex_Library_License", "130fcd36be8fe164eb68d951ba73ae3efdb846da", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Henry_Spencer_Reg-Ex_Library_License", "130fcd36be8fe164eb68d951ba73ae3efdb846da", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Henry_Spencer_Reg-Ex_Library_License", "130fcd36be8fe164eb68d951ba73ae3efdb846da", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Spencer-99.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Spencer-99.json" ) - .name( "Spencer License 99" ) - .licenseId( "Spencer-99" ) - .seeAlso( "http://www.opensource.apple.com/source/tcl/tcl-5/tcl/generic/regfronts.c" ) - - .urlInfo( "http://www.opensource.apple.com/source/tcl/tcl-5/tcl/generic/regfronts.c", null, null, false, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./StandardML-NJ.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/StandardML-NJ.json" ) - .name( "Standard ML of New Jersey License" ) - .licenseId( "StandardML-NJ" ) - .seeAlso( "http://www.smlnj.org//license.html" ) - - .urlInfo( "http://smlnj.org//license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .urlInfo( "http://smlnj.org/license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .urlInfo( "http://www.smlnj.org//license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .urlInfo( "http://www.smlnj.org/license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .urlInfo( "https://smlnj.org//license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .urlInfo( "https://smlnj.org/license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .urlInfo( "https://www.smlnj.org//license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .urlInfo( "https://www.smlnj.org/license.html", "01211dfcce36969c53f75500005301922763b9aa", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./SugarCRM-1.1.3.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/SugarCRM-1.1.3.json" ) - .name( "SugarCRM Public License v1.1.3" ) - .licenseId( "SugarCRM-1.1.3" ) - .seeAlso( "http://www.sugarcrm.com/crm/SPL" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./TAPR-OHL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/TAPR-OHL-1.0.json" ) - .name( "TAPR Open Hardware License v1.0" ) - .licenseId( "TAPR-OHL-1.0" ) - .seeAlso( "https://www.tapr.org/OHL" ) - - .urlInfo( "http://www.tapr.org/OHL", "c9cba9d51f8396452294954cdff210240cff931e", "text/html", true, false ) - .urlInfo( "https://www.tapr.org/OHL", "c9cba9d51f8396452294954cdff210240cff931e", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./TCL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/TCL.json" ) - .name( "TCL/TK License" ) - .licenseId( "TCL" ) - .seeAlso( "http://www.tcl.tk/software/tcltk/license.html" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/TCL" ) - - .urlInfo( "http://tcl.tk/software/tcltk/license.html", "00499b931c93319beea913277403178316f62b01", "text/html", true, true ) - .urlInfo( "http://www.tcl.tk/software/tcltk/license.html", "00499b931c93319beea913277403178316f62b01", "text/html", true, true ) - .urlInfo( "https://tcl.tk/software/tcltk/license.html", "00499b931c93319beea913277403178316f62b01", "text/html", true, true ) - .urlInfo( "https://www.tcl.tk/software/tcltk/license.html", "00499b931c93319beea913277403178316f62b01", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/TCL", "344bc2a95f4a4908c643babe16d62f4ef9700a0a", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/TCL", "344bc2a95f4a4908c643babe16d62f4ef9700a0a", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/TCL", "344bc2a95f4a4908c643babe16d62f4ef9700a0a", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/TCL", "344bc2a95f4a4908c643babe16d62f4ef9700a0a", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./TCP-wrappers.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/TCP-wrappers.json" ) - .name( "TCP Wrappers License" ) - .licenseId( "TCP-wrappers" ) - .seeAlso( "http://rc.quest.com/topics/openssh/license.php#tcpwrappers" ) - - .urlInfo( "http://rc.quest.com/topics/openssh/license.php#tcpwrappers", "361b2df10b2db8b7f9635890ca8b41ea0f9cba6c", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./TMate.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/TMate.json" ) - .name( "TMate Open Source License" ) - .licenseId( "TMate" ) - .seeAlso( "http://svnkit.com/license.html" ) - - .urlInfo( "http://svnkit.com/license.html", "90cb7e333fa2228df75be9b09b1b8933cddfeddc", "text/html", true, false ) - .urlInfo( "http://www.svnkit.com/license.html", "90cb7e333fa2228df75be9b09b1b8933cddfeddc", "text/html", true, false ) - .urlInfo( "https://svnkit.com/license.html", "90cb7e333fa2228df75be9b09b1b8933cddfeddc", "text/html", true, false ) - .urlInfo( "https://www.svnkit.com/license.html", "90cb7e333fa2228df75be9b09b1b8933cddfeddc", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./TORQUE-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/TORQUE-1.1.json" ) - .name( "TORQUE v2.5+ Software License v1.1" ) - .licenseId( "TORQUE-1.1" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/TORQUEv1.1" ) - - .urlInfo( "https://fedoraproject.org/wiki/Licensing/TORQUEv1.1", null, null, false, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./TOSL.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/TOSL.json" ) - .name( "Trusster Open Source License" ) - .licenseId( "TOSL" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/TOSL" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/TOSL", "3ad0c21abb7f1caef2e40e6e035df4077333d1d3", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/TOSL", "3ad0c21abb7f1caef2e40e6e035df4077333d1d3", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/TOSL", "3ad0c21abb7f1caef2e40e6e035df4077333d1d3", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/TOSL", "3ad0c21abb7f1caef2e40e6e035df4077333d1d3", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./TU-Berlin-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/TU-Berlin-1.0.json" ) - .name( "Technische Universitaet Berlin License 1.0" ) - .licenseId( "TU-Berlin-1.0" ) - .seeAlso( "https://github.com/swh/ladspa/blob/7bf6f3799fdba70fda297c2d8fd9f526803d9680/gsm/COPYRIGHT" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./TU-Berlin-2.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/TU-Berlin-2.0.json" ) - .name( "Technische Universitaet Berlin License 2.0" ) - .licenseId( "TU-Berlin-2.0" ) - .seeAlso( "https://github.com/CorsixTH/deps/blob/fd339a9f526d1d9c9f01ccf39e438a015da50035/licences/libgsm.txt" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./UPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/UPL-1.0.json" ) - .name( "Universal Permissive License v1.0" ) - .licenseId( "UPL-1.0" ) - .seeAlso( "https://opensource.org/licenses/UPL" ) - - .urlInfo( "http://opensource.org/licenses/UPL", "8cdb2dda66095220c953ae7ad85ab705eb910562", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/UPL", "8cdb2dda66095220c953ae7ad85ab705eb910562", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/UPL", "8cdb2dda66095220c953ae7ad85ab705eb910562", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/UPL", "8cdb2dda66095220c953ae7ad85ab705eb910562", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Unicode-DFS-2015.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Unicode-DFS-2015.json" ) - .name( "Unicode License Agreement - Data Files and Software (2015)" ) - .licenseId( "Unicode-DFS-2015" ) - .seeAlso( "https://web.archive.org/web/20151224134844/http://unicode.org/copyright.html" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Unicode-DFS-2016.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Unicode-DFS-2016.json" ) - .name( "Unicode License Agreement - Data Files and Software (2016)" ) - .licenseId( "Unicode-DFS-2016" ) - .seeAlso( "http://www.unicode.org/copyright.html" ) - - .urlInfo( "http://unicode.org/copyright.html", "616802fe8277aa08324ee4f77d9f57bddb1b4f1b", "text/html", true, false ) - .urlInfo( "http://www.unicode.org/copyright.html", "616802fe8277aa08324ee4f77d9f57bddb1b4f1b", "text/html", true, false ) - .urlInfo( "https://unicode.org/copyright.html", "616802fe8277aa08324ee4f77d9f57bddb1b4f1b", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Unicode-TOU.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Unicode-TOU.json" ) - .name( "Unicode Terms of Use" ) - .licenseId( "Unicode-TOU" ) - .seeAlso( "http://www.unicode.org/copyright.html" ) - - .urlInfo( "http://unicode.org/copyright.html", "616802fe8277aa08324ee4f77d9f57bddb1b4f1b", "text/html", true, false ) - .urlInfo( "http://www.unicode.org/copyright.html", "616802fe8277aa08324ee4f77d9f57bddb1b4f1b", "text/html", true, false ) - .urlInfo( "https://unicode.org/copyright.html", "616802fe8277aa08324ee4f77d9f57bddb1b4f1b", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Unlicense.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Unlicense.json" ) - .name( "The Unlicense" ) - .licenseId( "Unlicense" ) - .seeAlso( "http://unlicense.org/" ) - - .urlInfo( "http://unlicense.org/", "2793aa722410d051088cb60cdf13fb5cf68f8b16", "text/html", true, false ) - .urlInfo( "http://www.unlicense.org/", "2793aa722410d051088cb60cdf13fb5cf68f8b16", "text/html", true, false ) - .urlInfo( "https://unlicense.org/", "2793aa722410d051088cb60cdf13fb5cf68f8b16", "text/html", true, false ) - .urlInfo( "https://www.unlicense.org/", "2793aa722410d051088cb60cdf13fb5cf68f8b16", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./VOSTROM.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/VOSTROM.json" ) - .name( "VOSTROM Public License for Open Source" ) - .licenseId( "VOSTROM" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/VOSTROM" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/VOSTROM", "b0ca9206e99414f2d226278eb6b43c4249e1162d", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/VOSTROM", "b0ca9206e99414f2d226278eb6b43c4249e1162d", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/VOSTROM", "b0ca9206e99414f2d226278eb6b43c4249e1162d", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/VOSTROM", "b0ca9206e99414f2d226278eb6b43c4249e1162d", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./VSL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/VSL-1.0.json" ) - .name( "Vovida Software License v1.0" ) - .licenseId( "VSL-1.0" ) - .seeAlso( "https://opensource.org/licenses/VSL-1.0" ) - - .urlInfo( "http://opensource.org/licenses/VSL-1.0", "30566b653cd4b94e1885055dcc9024a3cfac3e4b", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/VSL-1.0", "30566b653cd4b94e1885055dcc9024a3cfac3e4b", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/VSL-1.0", "30566b653cd4b94e1885055dcc9024a3cfac3e4b", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/VSL-1.0", "30566b653cd4b94e1885055dcc9024a3cfac3e4b", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Vim.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Vim.json" ) - .name( "Vim License" ) - .licenseId( "Vim" ) - .seeAlso( "http://vimdoc.sourceforge.net/htmldoc/uganda.html" ) - - .urlInfo( "http://vimdoc.sourceforge.net/htmldoc/uganda.html", "03dc2a471da404470ef443a26d08bfaf12a629aa", "text/html", true, false ) - .urlInfo( "http://www.vimdoc.sourceforge.net/htmldoc/uganda.html", "03dc2a471da404470ef443a26d08bfaf12a629aa", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./W3C.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/W3C.json" ) - .name( "W3C Software Notice and License (2002-12-31)" ) - .licenseId( "W3C" ) - .seeAlso( "http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.html" ) - .seeAlso( "https://opensource.org/licenses/W3C" ) - - .urlInfo( "http://w3.org/Consortium/Legal/2002/copyright-software-20021231.html", "e9caaa14c2ed4bfe41608e3d865811423707bbe5", "text/html", true, false ) - .urlInfo( "http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.html", "e9caaa14c2ed4bfe41608e3d865811423707bbe5", "text/html", true, false ) - .urlInfo( "https://w3.org/Consortium/Legal/2002/copyright-software-20021231.html", "e9caaa14c2ed4bfe41608e3d865811423707bbe5", "text/html", true, false ) - .urlInfo( "https://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.html", "e9caaa14c2ed4bfe41608e3d865811423707bbe5", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/W3C", "9957c74acaf9412fcab9f768382a879bf6f5bd9a", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/W3C", "9957c74acaf9412fcab9f768382a879bf6f5bd9a", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/W3C", "9957c74acaf9412fcab9f768382a879bf6f5bd9a", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/W3C", "9957c74acaf9412fcab9f768382a879bf6f5bd9a", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./W3C-19980720.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/W3C-19980720.json" ) - .name( "W3C Software Notice and License (1998-07-20)" ) - .licenseId( "W3C-19980720" ) - .seeAlso( "http://www.w3.org/Consortium/Legal/copyright-software-19980720.html" ) - - .urlInfo( "http://w3.org/Consortium/Legal/copyright-software-19980720.html", "9bca94cc5985c5c1fa93f64ab74c32dbe270ff40", "text/html", true, false ) - .urlInfo( "http://www.w3.org/Consortium/Legal/copyright-software-19980720.html", "9bca94cc5985c5c1fa93f64ab74c32dbe270ff40", "text/html", true, false ) - .urlInfo( "https://w3.org/Consortium/Legal/copyright-software-19980720.html", "9bca94cc5985c5c1fa93f64ab74c32dbe270ff40", "text/html", true, false ) - .urlInfo( "https://www.w3.org/Consortium/Legal/copyright-software-19980720.html", "9bca94cc5985c5c1fa93f64ab74c32dbe270ff40", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./W3C-20150513.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/W3C-20150513.json" ) - .name( "W3C Software Notice and Document License (2015-05-13)" ) - .licenseId( "W3C-20150513" ) - .seeAlso( "https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document" ) - - .urlInfo( "http://w3.org/Consortium/Legal/2015/copyright-software-and-document", "b6483f77e4ea82c472b1006e5e49323deb569c37", "text/html", true, false ) - .urlInfo( "http://www.w3.org/Consortium/Legal/2015/copyright-software-and-document", "b6483f77e4ea82c472b1006e5e49323deb569c37", "text/html", true, false ) - .urlInfo( "https://w3.org/Consortium/Legal/2015/copyright-software-and-document", "b6483f77e4ea82c472b1006e5e49323deb569c37", "text/html", true, false ) - .urlInfo( "https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document", "b6483f77e4ea82c472b1006e5e49323deb569c37", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./WTFPL.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/WTFPL.json" ) - .name( "Do What The F*ck You Want To Public License" ) - .licenseId( "WTFPL" ) - .seeAlso( "http://sam.zoy.org/wtfpl/COPYING" ) - - .urlInfo( "http://sam.zoy.org/wtfpl/COPYING", "337ece375beddfdb7392699fd00eb9b3e823d03f", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Watcom-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Watcom-1.0.json" ) - .name( "Sybase Open Watcom Public License 1.0" ) - .licenseId( "Watcom-1.0" ) - .seeAlso( "https://opensource.org/licenses/Watcom-1.0" ) - - .urlInfo( "http://opensource.org/licenses/Watcom-1.0", "4300d9560c127e25505e855e7ee103b378f29d6b", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Watcom-1.0", "4300d9560c127e25505e855e7ee103b378f29d6b", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Watcom-1.0", "4300d9560c127e25505e855e7ee103b378f29d6b", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Watcom-1.0", "4300d9560c127e25505e855e7ee103b378f29d6b", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Wsuipa.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Wsuipa.json" ) - .name( "Wsuipa License" ) - .licenseId( "Wsuipa" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Wsuipa" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Wsuipa", "ff7b66840ab0914bbf3ba00a284a8eca93d8b2fc", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Wsuipa", "ff7b66840ab0914bbf3ba00a284a8eca93d8b2fc", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Wsuipa", "ff7b66840ab0914bbf3ba00a284a8eca93d8b2fc", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Wsuipa", "ff7b66840ab0914bbf3ba00a284a8eca93d8b2fc", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./X11.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/X11.json" ) - .name( "X11 License" ) - .licenseId( "X11" ) - .seeAlso( "http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3" ) - - .urlInfo( "http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3", "af17279d4b362c0421337bac10272977c3cba3e3", "text/html", true, false ) - .urlInfo( "http://xfree86.org/3.3.6/COPYRIGHT2.html#3", "af17279d4b362c0421337bac10272977c3cba3e3", "text/html", true, false ) - .urlInfo( "https://www.xfree86.org/3.3.6/COPYRIGHT2.html#3", "af17279d4b362c0421337bac10272977c3cba3e3", "text/html", true, false ) - .urlInfo( "https://xfree86.org/3.3.6/COPYRIGHT2.html#3", "af17279d4b362c0421337bac10272977c3cba3e3", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./XFree86-1.1.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/XFree86-1.1.json" ) - .name( "XFree86 License 1.1" ) - .licenseId( "XFree86-1.1" ) - .seeAlso( "http://www.xfree86.org/current/LICENSE4.html" ) - - .urlInfo( "http://www.xfree86.org/current/LICENSE4.html", "5ad8574c481e3d9f1c527a4a49f4042ac65cc964", "text/html", true, false ) - .urlInfo( "http://xfree86.org/current/LICENSE4.html", "5ad8574c481e3d9f1c527a4a49f4042ac65cc964", "text/html", true, false ) - .urlInfo( "https://www.xfree86.org/current/LICENSE4.html", "5ad8574c481e3d9f1c527a4a49f4042ac65cc964", "text/html", true, false ) - .urlInfo( "https://xfree86.org/current/LICENSE4.html", "5ad8574c481e3d9f1c527a4a49f4042ac65cc964", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./XSkat.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/XSkat.json" ) - .name( "XSkat License" ) - .licenseId( "XSkat" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/XSkat_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/XSkat_License", "76f97550c044e523e4e850c50800295d796d3390", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/XSkat_License", "76f97550c044e523e4e850c50800295d796d3390", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Xerox.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Xerox.json" ) - .name( "Xerox License" ) - .licenseId( "Xerox" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Xerox" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Xerox", "bc96822269ec4cebf103a898c5ef433a39e9c071", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Xerox", "bc96822269ec4cebf103a898c5ef433a39e9c071", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Xerox", "bc96822269ec4cebf103a898c5ef433a39e9c071", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Xerox", "bc96822269ec4cebf103a898c5ef433a39e9c071", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Xnet.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Xnet.json" ) - .name( "X.Net License" ) - .licenseId( "Xnet" ) - .seeAlso( "https://opensource.org/licenses/Xnet" ) - - .urlInfo( "http://opensource.org/licenses/Xnet", "10d9f75626a7edd79c98333c59555bfee7ae33f1", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Xnet", "10d9f75626a7edd79c98333c59555bfee7ae33f1", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Xnet", "10d9f75626a7edd79c98333c59555bfee7ae33f1", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Xnet", "10d9f75626a7edd79c98333c59555bfee7ae33f1", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./YPL-1.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/YPL-1.0.json" ) - .name( "Yahoo! Public License v1.0" ) - .licenseId( "YPL-1.0" ) - .seeAlso( "http://www.zimbra.com/license/yahoo_public_license_1.0.html" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./YPL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/YPL-1.1.json" ) - .name( "Yahoo! Public License v1.1" ) - .licenseId( "YPL-1.1" ) - .seeAlso( "http://www.zimbra.com/license/yahoo_public_license_1.1.html" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./ZPL-1.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/ZPL-1.1.json" ) - .name( "Zope Public License 1.1" ) - .licenseId( "ZPL-1.1" ) - .seeAlso( "http://old.zope.org/Resources/License/ZPL-1.1" ) - - .urlInfo( "http://old.zope.org/Resources/License/ZPL-1.1", "545bd59cf22b63f4b3005a8e192382fadd409a80", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./ZPL-2.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/ZPL-2.0.json" ) - .name( "Zope Public License 2.0" ) - .licenseId( "ZPL-2.0" ) - .seeAlso( "http://old.zope.org/Resources/License/ZPL-2.0" ) - .seeAlso( "https://opensource.org/licenses/ZPL-2.0" ) - - .urlInfo( "http://old.zope.org/Resources/License/ZPL-2.0", "48d0ce3d50083691ba056f531eab912596a2317d", null, true, false ) - .urlInfo( "http://opensource.org/licenses/ZPL-2.0", "b372551d0be3732638e91d36be17da95b7578f16", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/ZPL-2.0", "b372551d0be3732638e91d36be17da95b7578f16", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/ZPL-2.0", "b372551d0be3732638e91d36be17da95b7578f16", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/ZPL-2.0", "b372551d0be3732638e91d36be17da95b7578f16", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./ZPL-2.1.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/ZPL-2.1.json" ) - .name( "Zope Public License 2.1" ) - .licenseId( "ZPL-2.1" ) - .seeAlso( "http://old.zope.org/Resources/ZPL/" ) - - .urlInfo( "http://old.zope.org/Resources/ZPL/", "a1553972c0c3eb546dbf4ea440f3723136e1f772", null, true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Zed.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Zed.json" ) - .name( "Zed License" ) - .licenseId( "Zed" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Zed" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Zed", "31ffd6238e9db0b71f200c74856a16af1bf6e602", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Zed", "31ffd6238e9db0b71f200c74856a16af1bf6e602", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Zed", "31ffd6238e9db0b71f200c74856a16af1bf6e602", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Zed", "31ffd6238e9db0b71f200c74856a16af1bf6e602", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Zend-2.0.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Zend-2.0.json" ) - .name( "Zend License v2.0" ) - .licenseId( "Zend-2.0" ) - .seeAlso( "https://web.archive.org/web/20130517195954/http://www.zend.com/license/2_00.txt" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Zimbra-1.3.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Zimbra-1.3.json" ) - .name( "Zimbra Public License v1.3" ) - .licenseId( "Zimbra-1.3" ) - .seeAlso( "http://web.archive.org/web/20100302225219/http://www.zimbra.com/license/zimbra-public-license-1-3.html" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Zimbra-1.4.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/Zimbra-1.4.json" ) - .name( "Zimbra Public License v1.4" ) - .licenseId( "Zimbra-1.4" ) - .seeAlso( "http://www.zimbra.com/legal/zimbra-public-license-1-4" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./Zlib.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/Zlib.json" ) - .name( "zlib License" ) - .licenseId( "Zlib" ) - .seeAlso( "http://www.zlib.net/zlib_license.html" ) - .seeAlso( "https://opensource.org/licenses/Zlib" ) - - .urlInfo( "http://www.zlib.net/zlib_license.html", "42ebabf4a661ae8b089652de5063ef17275045e7", "text/html", true, false ) - .urlInfo( "http://zlib.net/zlib_license.html", "42ebabf4a661ae8b089652de5063ef17275045e7", "text/html", true, false ) - .urlInfo( "https://zlib.net/zlib_license.html", "42ebabf4a661ae8b089652de5063ef17275045e7", "text/html", true, false ) - .urlInfo( "http://opensource.org/licenses/Zlib", "8f86bc16ae0e29f31f80a9652b027c7f3b372209", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/Zlib", "8f86bc16ae0e29f31f80a9652b027c7f3b372209", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/Zlib", "8f86bc16ae0e29f31f80a9652b027c7f3b372209", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/Zlib", "8f86bc16ae0e29f31f80a9652b027c7f3b372209", "text/html", false, true ) - .isOsiApproved( true ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./bzip2-1.0.5.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/bzip2-1.0.5.json" ) - .name( "bzip2 and libbzip2 License v1.0.5" ) - .licenseId( "bzip2-1.0.5" ) - .seeAlso( "http://bzip.org/1.0.5/bzip2-manual-1.0.5.html" ) - - .urlInfo( "http://bzip.org/1.0.5/bzip2-manual-1.0.5.html", "6adfa86e0a55bdeebac130b7f6d9d145597ee949", "text/html", true, false ) - .urlInfo( "http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html", "6adfa86e0a55bdeebac130b7f6d9d145597ee949", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./bzip2-1.0.6.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/bzip2-1.0.6.json" ) - .name( "bzip2 and libbzip2 License v1.0.6" ) - .licenseId( "bzip2-1.0.6" ) - .seeAlso( "https://github.com/asimonov-im/bzip2/blob/master/LICENSE" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./copyleft-next-0.3.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/copyleft-next-0.3.0.json" ) - .name( "copyleft-next 0.3.0" ) - .licenseId( "copyleft-next-0.3.0" ) - .seeAlso( "https://github.com/copyleft-next/copyleft-next/blob/master/Releases/copyleft-next-0.3.0" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./copyleft-next-0.3.1.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/copyleft-next-0.3.1.json" ) - .name( "copyleft-next 0.3.1" ) - .licenseId( "copyleft-next-0.3.1" ) - .seeAlso( "https://github.com/copyleft-next/copyleft-next/blob/master/Releases/copyleft-next-0.3.1" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./curl.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/curl.json" ) - .name( "curl License" ) - .licenseId( "curl" ) - .seeAlso( "https://github.com/bagder/curl/blob/master/COPYING" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./diffmark.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/diffmark.json" ) - .name( "diffmark license" ) - .licenseId( "diffmark" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/diffmark" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/diffmark", "c0491051a1b905d7c4d1af938e9b2c440c127147", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/diffmark", "c0491051a1b905d7c4d1af938e9b2c440c127147", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/diffmark", "c0491051a1b905d7c4d1af938e9b2c440c127147", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/diffmark", "c0491051a1b905d7c4d1af938e9b2c440c127147", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./dvipdfm.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/dvipdfm.json" ) - .name( "dvipdfm License" ) - .licenseId( "dvipdfm" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/dvipdfm" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/dvipdfm", "11ea8b2544554e53e3e4dbc94e236f123c082fbe", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/dvipdfm", "11ea8b2544554e53e3e4dbc94e236f123c082fbe", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/dvipdfm", "11ea8b2544554e53e3e4dbc94e236f123c082fbe", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/dvipdfm", "11ea8b2544554e53e3e4dbc94e236f123c082fbe", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./eCos-2.0.html" ) - .isDeprecatedLicenseId( true ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/eCos-2.0.json" ) - .name( "eCos license version 2.0" ) - .licenseId( "eCos-2.0" ) - .seeAlso( "https://www.gnu.org/licenses/ecos-license.html" ) - - .urlInfo( "http://gnu.org/licenses/ecos-license.html", "75f4827b2f7314ac26a345b750eff70fd32ba663", "text/html", true, false ) - .urlInfo( "http://www.gnu.org/licenses/ecos-license.html", "75f4827b2f7314ac26a345b750eff70fd32ba663", "text/html", true, false ) - .urlInfo( "https://gnu.org/licenses/ecos-license.html", "75f4827b2f7314ac26a345b750eff70fd32ba663", "text/html", true, false ) - .urlInfo( "https://www.gnu.org/licenses/ecos-license.html", "75f4827b2f7314ac26a345b750eff70fd32ba663", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./eGenix.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/eGenix.json" ) - .name( "eGenix.com Public License 1.1.0" ) - .licenseId( "eGenix" ) - .seeAlso( "http://www.egenix.com/products/eGenix.com-Public-License-1.1.0.pdf" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/eGenix.com_Public_License_1.1.0" ) - - .urlInfo( "http://egenix.com/products/eGenix.com-Public-License-1.1.0.pdf", "c49b063afe6f7390cf5603d84d4f71e23a4cbf12", "application/pdf", true, false ) - .urlInfo( "http://www.egenix.com/products/eGenix.com-Public-License-1.1.0.pdf", "c49b063afe6f7390cf5603d84d4f71e23a4cbf12", "application/pdf", true, false ) - .urlInfo( "https://egenix.com/products/eGenix.com-Public-License-1.1.0.pdf", "c49b063afe6f7390cf5603d84d4f71e23a4cbf12", "application/pdf", true, false ) - .urlInfo( "https://www.egenix.com/products/eGenix.com-Public-License-1.1.0.pdf", "c49b063afe6f7390cf5603d84d4f71e23a4cbf12", "application/pdf", true, false ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/eGenix.com_Public_License_1.1.0", null, null, false, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./gSOAP-1.3b.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/gSOAP-1.3b.json" ) - .name( "gSOAP Public License v1.3b" ) - .licenseId( "gSOAP-1.3b" ) - .seeAlso( "http://www.cs.fsu.edu/~engelen/license.html" ) - - .urlInfo( "http://www.cs.fsu.edu/~engelen/license.html", "5f4878afcfa16971a9285ae461bf5c01f3f5989d", "text/html", true, false ) - .urlInfo( "https://www.cs.fsu.edu/~engelen/license.html", "5f4878afcfa16971a9285ae461bf5c01f3f5989d", "text/html", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./gnuplot.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/gnuplot.json" ) - .name( "gnuplot License" ) - .licenseId( "gnuplot" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Gnuplot" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Gnuplot", "ea5f748372b5d14642ce2b1c2f901c18a8cc9c3a", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Gnuplot", "ea5f748372b5d14642ce2b1c2f901c18a8cc9c3a", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Gnuplot", "ea5f748372b5d14642ce2b1c2f901c18a8cc9c3a", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Gnuplot", "ea5f748372b5d14642ce2b1c2f901c18a8cc9c3a", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./iMatix.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/iMatix.json" ) - .name( "iMatix Standard Function Library Agreement" ) - .licenseId( "iMatix" ) - .seeAlso( "http://legacy.imatix.com/html/sfl/sfl4.htm#license" ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./libpng-2.0.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/libpng-2.0.json" ) - .name( "PNG Reference Library version 2" ) - .licenseId( "libpng-2.0" ) - .seeAlso( "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt" ) - - .urlInfo( "http://libpng.org/pub/png/src/libpng-LICENSE.txt", "e01ba244558d7a6b6729885beb54e9e561583101", "text/plain", true, false ) - .urlInfo( "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt", "e01ba244558d7a6b6729885beb54e9e561583101", "text/plain", true, false ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./libtiff.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/libtiff.json" ) - .name( "libtiff License" ) - .licenseId( "libtiff" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/libtiff" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/libtiff", "708e759486fc725e1b0851aa81832ca930809130", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/libtiff", "708e759486fc725e1b0851aa81832ca930809130", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/libtiff", "708e759486fc725e1b0851aa81832ca930809130", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/libtiff", "708e759486fc725e1b0851aa81832ca930809130", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./mpich2.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/mpich2.json" ) - .name( "mpich2 License" ) - .licenseId( "mpich2" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/MIT" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#enna", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/MIT#feh", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT#CMU_Style", "5f9907fe0ec229349cae07b4f774844c18f36698", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./psfrag.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/psfrag.json" ) - .name( "psfrag License" ) - .licenseId( "psfrag" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/psfrag" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/psfrag", "32d44b278ce3c316d8b5b7e2c7dda675cc3f0bfb", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/psfrag", "32d44b278ce3c316d8b5b7e2c7dda675cc3f0bfb", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/psfrag", "32d44b278ce3c316d8b5b7e2c7dda675cc3f0bfb", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/psfrag", "32d44b278ce3c316d8b5b7e2c7dda675cc3f0bfb", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./psutils.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/psutils.json" ) - .name( "psutils License" ) - .licenseId( "psutils" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/psutils" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/psutils", "97bcc435e87889c737af7f96f12b8f9215f19df5", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/psutils", "97bcc435e87889c737af7f96f12b8f9215f19df5", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/psutils", "97bcc435e87889c737af7f96f12b8f9215f19df5", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/psutils", "97bcc435e87889c737af7f96f12b8f9215f19df5", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./wxWindows.html" ) - .isDeprecatedLicenseId( true ) - .detailsUrl( "http://spdx.org/licenses/wxWindows.json" ) - .name( "wxWindows Library License" ) - .licenseId( "wxWindows" ) - .seeAlso( "https://opensource.org/licenses/WXwindows" ) - - .urlInfo( "http://opensource.org/licenses/WXwindows", "854619e2b00190d2ef8d92df89d3feace947ae00", "text/html", false, true ) - .urlInfo( "http://www.opensource.org/licenses/WXwindows", "854619e2b00190d2ef8d92df89d3feace947ae00", "text/html", false, true ) - .urlInfo( "https://opensource.org/licenses/WXwindows", "854619e2b00190d2ef8d92df89d3feace947ae00", "text/html", false, true ) - .urlInfo( "https://www.opensource.org/licenses/WXwindows", "854619e2b00190d2ef8d92df89d3feace947ae00", "text/html", false, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./xinetd.html" ) - .isDeprecatedLicenseId( false ) - .isFsfLibre( true ) - .detailsUrl( "http://spdx.org/licenses/xinetd.json" ) - .name( "xinetd License" ) - .licenseId( "xinetd" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/Xinetd_License" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/Xinetd_License", "fb9fc73d5d1c4396206b11262ba3114cc5ca8f00", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/Xinetd_License", "fb9fc73d5d1c4396206b11262ba3114cc5ca8f00", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/Xinetd_License", "fb9fc73d5d1c4396206b11262ba3114cc5ca8f00", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/Xinetd_License", "fb9fc73d5d1c4396206b11262ba3114cc5ca8f00", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./xpp.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/xpp.json" ) - .name( "XPP License" ) - .licenseId( "xpp" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/xpp" ) - - .urlInfo( "https://fedoraproject.org/wiki/Licensing/xpp", null, null, false, true ) - .isOsiApproved( false ) - .build() - ); - - builder.license( SpdxLicenseInfo.builder() - .reference( "./zlib-acknowledgement.html" ) - .isDeprecatedLicenseId( false ) - .detailsUrl( "http://spdx.org/licenses/zlib-acknowledgement.json" ) - .name( "zlib/libpng License with Acknowledgement" ) - .licenseId( "zlib-acknowledgement" ) - .seeAlso( "https://fedoraproject.org/wiki/Licensing/ZlibWithAcknowledgement" ) - - .urlInfo( "http://fedoraproject.org/wiki/Licensing/ZlibWithAcknowledgement", "2b8e20ff3942ce7e2e743ce7433caa87cc7fce3e", "text/html", true, true ) - .urlInfo( "http://www.fedoraproject.org/wiki/Licensing/ZlibWithAcknowledgement", "2b8e20ff3942ce7e2e743ce7433caa87cc7fce3e", "text/html", true, true ) - .urlInfo( "https://fedoraproject.org/wiki/Licensing/ZlibWithAcknowledgement", "2b8e20ff3942ce7e2e743ce7433caa87cc7fce3e", "text/html", true, true ) - .urlInfo( "https://www.fedoraproject.org/wiki/Licensing/ZlibWithAcknowledgement", "2b8e20ff3942ce7e2e743ce7433caa87cc7fce3e", "text/html", true, true ) - .isOsiApproved( false ) - .build() - ); - - builder.releaseDate( "2019-04-02" ); - - builder.urlReplacement( "archive.org-0", "(archive\\.org/web/[0-9]+)/", "$1id_/" ); - builder.urlReplacement( "git.kernel.org-0", "https?://git\\.kernel\\.org/pub/scm/linux/([^/]+)/git/torvalds/linux\\.git/tree/(.*)", "https://git.kernel.org/pub/scm/linux/$1/git/torvalds/linux.git/plain/$2" ); - builder.urlReplacement( "git.savannah.gnu.org-0", "https?://git\\.savannah\\.gnu\\.org/cgit/(.*)\\.git/tree/(.*)", "http://git.savannah.gnu.org/cgit/$1.git/plain/$2" ); - builder.urlReplacement( "github.aaakk.us.kg-0", "https?://github\\.com/([^/]+)/([^/]+)/blob/(.*)", "https://raw.githubusercontent.com/$1/$2/$3" ); - builder.urlReplacement( "github.com/aws/mit-0", ".*github\\.com/aws/mit-0", "https://raw.githubusercontent.com/aws/mit-0/master/MIT-0" ); - builder.urlReplacement( "microsoft.com/opensource/licenses.mspx", ".*microsoft\\.com/opensource/licenses\\.mspx", "https://web.archive.org/web/20150619132250id_/http://www.microsoft.com/en-us/openness/licenses.aspx" ); - builder.urlReplacement( "mozilla.org/MPL/MPL-1.1.txt", ".*\\Q.mozilla.org/MPL/MPL-1.1.txt\\E", "https://www.mozilla.org/media/MPL/1.1/index.0c5913925d40.txt" ); - builder.urlReplacement( "repository.jboss.com/licenses", "https?://repository\\.jboss\\.com/licenses/(.*)", "https://web.archive.org/web/20171202125112id_/http://repository.jboss.com/licenses/$1" ); - - builder.contentSanitizer( "artlibre.org-0", ".*artlibre\\.org.*", "", "" ); - builder.contentSanitizer( "artlibre.org-1", ".*artlibre\\.org.*", "", "" ); - builder.contentSanitizer( "codeproject.com-0", ".*codeproject\\.com.*", ">[^<]+members<", "><" ); - builder.contentSanitizer( "codeproject.com-1", ".*codeproject\\.com.*", "
[^\\n]+", "" ); - builder.contentSanitizer( "codeproject.com-2", ".*codeproject\\.com.*", "
\\s*[^\\s]+\\s*\\|\\s*[^\\s]+\\s*\\|", "" ); - builder.contentSanitizer( "creativecommons.org-0", ".*creativecommons\\.org.*", "\\n ", "\\n" ); - builder.contentSanitizer( "data.norge.no-0", ".*data\\.norge\\.no.*", "jQuery\\.extend\\(Drupal\\.settings[^\\n]+", "" ); - builder.contentSanitizer( "data.norge.no-1", ".*data\\.norge\\.no.*", "value=\"form-[^\"]*\"", "" ); - builder.contentSanitizer( "data.norge.no-2", ".*data\\.norge\\.no.*", "view-dom-id-[0-9a-f]{12}", "" ); - builder.contentSanitizer( "directory.fsf.org-0", ".*directory\\.fsf\\.org.*", "\"wgRequestId\":\"[^\"]*\"", "\"wgRequestId\":\"\"" ); - builder.contentSanitizer( "directory.fsf.org-1", ".*directory\\.fsf\\.org.*", "\"wgBackendResponseTime\":[0-9]+", "\"wgBackendResponseTime\":0" ); - builder.contentSanitizer( "eu-datagrid.web.cern.ch-0", ".*eu-datagrid\\.web\\.cern\\.ch.*", "wct=[^&\"]+", "wct=" ); - builder.contentSanitizer( "fedoraproject.org-0", ".*fedoraproject\\.org.*", "\"wgRequestId\":\"[^\"]*\"", "\"wgRequestId\":\"\"" ); - builder.contentSanitizer( "fedoraproject.org-1", ".*fedoraproject\\.org.*", "\"wgBackendResponseTime\":[0-9]+", "\"wgBackendResponseTime\":0" ); - builder.contentSanitizer( "gianluca.dellavedova.org-0", ".*gianluca\\.dellavedova\\.org.*", "", + ""); + builder.contentSanitizer("ohwr.org-0", ".*ohwr\\.org.*", "]+ in [^\\-<>]+ -->", + ""); + builder.contentSanitizer("zimbra.com-0", ".*zimbra\\.com.*", "Compiled on [^D]+ - Do not edit", ""); return builder.build(); } diff --git a/src/main/java/org/codehaus/mojo/license/utils/FileUtil.java b/src/main/java/org/codehaus/mojo/license/utils/FileUtil.java index ad7350af1..117016441 100644 --- a/src/main/java/org/codehaus/mojo/license/utils/FileUtil.java +++ b/src/main/java/org/codehaus/mojo/license/utils/FileUtil.java @@ -22,10 +22,6 @@ * #L% */ -import org.apache.commons.codec.binary.Hex; -import org.codehaus.plexus.util.FileUtils; -import org.codehaus.plexus.util.IOUtil; - import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -50,6 +46,10 @@ import java.util.List; import java.util.Locale; +import org.apache.commons.codec.binary.Hex; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.IOUtil; + /** * Some basic file io utilities * @@ -57,37 +57,26 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class FileUtil -{ +public class FileUtil { - public static void tryClose( InputStream is ) - { - if ( is == null ) - { + public static void tryClose(InputStream is) { + if (is == null) { return; } - try - { + try { is.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // do nothing } } - public static void tryClose( OutputStream os ) - { - if ( os == null ) - { + public static void tryClose(OutputStream os) { + if (os == null) { return; } - try - { + try { os.close(); - } - catch ( IOException e ) - { + } catch (IOException e) { // do nothing } } @@ -100,31 +89,23 @@ public static void tryClose( OutputStream os ) * need to create it * @throws IOException if could not create directory */ - public static boolean createDirectoryIfNecessary( File dir ) - throws IOException - { - if ( !dir.exists() ) - { + public static boolean createDirectoryIfNecessary(File dir) throws IOException { + if (!dir.exists()) { boolean b = dir.mkdirs(); - if ( !b ) - { - throw new IOException( "Could not create directory " + dir ); + if (!b) { + throw new IOException("Could not create directory " + dir); } return true; } return false; } - public static boolean createNewFile( File file ) - throws IOException - { - createDirectoryIfNecessary( file.getParentFile() ); - if ( !file.exists() ) - { + public static boolean createNewFile(File file) throws IOException { + createDirectoryIfNecessary(file.getParentFile()); + if (!file.exists()) { boolean b = file.createNewFile(); - if ( !b ) - { - throw new IOException( "Could not create new file " + file ); + if (!b) { + throw new IOException("Could not create new file " + file); } return true; } @@ -137,18 +118,14 @@ public static boolean createNewFile( File file ) * @param file the file to delete * @throws IOException if could not delete the file */ - public static void deleteFile( File file ) - throws IOException - { - if ( !file.exists() ) - { + public static void deleteFile(File file) throws IOException { + if (!file.exists()) { // file does not exist, can not delete it return; } boolean b = file.delete(); - if ( !b ) - { - throw new IOException( "could not delete file " + file ); + if (!b) { + throw new IOException("could not delete file " + file); } } @@ -159,25 +136,17 @@ public static void deleteFile( File file ) * @param destination the destination file * @throws IOException if could not rename the file */ - public static void renameFile( File file, File destination ) - throws IOException - { - try - { - try - { - org.apache.commons.io.FileUtils.forceDelete( destination ); - } - catch ( FileNotFoundException ex ) - { - //Just do nothing + public static void renameFile(File file, File destination) throws IOException { + try { + try { + org.apache.commons.io.FileUtils.forceDelete(destination); + } catch (FileNotFoundException ex) { + // Just do nothing } - org.apache.commons.io.FileUtils.moveFile( file, destination ); - } - catch ( IOException ex ) - { - throw new IOException( String.format( "could not rename '%s' to '%s'", file, destination ) ); + org.apache.commons.io.FileUtils.moveFile(file, destination); + } catch (IOException ex) { + throw new IOException(String.format("could not rename '%s' to '%s'", file, destination)); } } @@ -188,30 +157,25 @@ public static void renameFile( File file, File destination ) * @param target file name of destination file. * @throws IOException if could not copy file. */ - public static void copyFile( File source, File target ) - throws IOException - { - createDirectoryIfNecessary( target.getParentFile() ); - FileUtils.copyFile( source, target ); + public static void copyFile(File source, File target) throws IOException { + createDirectoryIfNecessary(target.getParentFile()); + FileUtils.copyFile(source, target); } - public static File getFile( File base, String... paths ) - { + public static File getFile(File base, String... paths) { StringBuilder buffer = new StringBuilder(); - for ( String path : paths ) - { - buffer.append( File.separator ).append( path ); + for (String path : paths) { + buffer.append(File.separator).append(path); } - return new File( base, buffer.substring( 1 ) ); + return new File(base, buffer.substring(1)); } /** * @param file the source file * @return the backup file */ - public static File getBackupFile( File file ) - { - return new File( file.getAbsolutePath() + "~" ); + public static File getBackupFile(File file) { + return new File(file.getAbsolutePath() + "~"); } /** @@ -221,11 +185,9 @@ public static File getBackupFile( File file ) * @param f the file to backup * @throws IOException if any pb while copying the file */ - public static void backupFile( File f ) - throws IOException - { - File dst = getBackupFile( f ); - copyFile( f, dst ); + public static void backupFile(File f) throws IOException { + File dst = getBackupFile(f); + copyFile(f, dst); } /** @@ -237,17 +199,12 @@ public static void backupFile( File f ) * @return the content of the file * @throws IOException if IO pb */ - public static String readAsString( File file, String encoding ) - throws IOException - { - FileInputStream inf = new FileInputStream( file ); - BufferedReader in = new BufferedReader( new InputStreamReader( inf, encoding ) ); - try - { - return IOUtil.toString( in ); - } - finally - { + public static String readAsString(File file, String encoding) throws IOException { + FileInputStream inf = new FileInputStream(file); + BufferedReader in = new BufferedReader(new InputStreamReader(inf, encoding)); + try { + return IOUtil.toString(in); + } finally { in.close(); } } @@ -260,91 +217,67 @@ public static String readAsString( File file, String encoding ) * @param encoding the encoding to write in * @throws IOException if IO pb */ - public static void printString( File file, String content, String encoding ) - throws IOException - { - createDirectoryIfNecessary( file.getParentFile() ); + public static void printString(File file, String content, String encoding) throws IOException { + createDirectoryIfNecessary(file.getParentFile()); BufferedReader in; PrintWriter out; - in = new BufferedReader( new StringReader( content ) ); - out = new PrintWriter( new BufferedWriter( new OutputStreamWriter( new FileOutputStream( file ), encoding ) ) ); - try - { + in = new BufferedReader(new StringReader(content)); + out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), encoding))); + try { String line; - while ( ( line = in.readLine() ) != null ) - { - out.println( line ); + while ((line = in.readLine()) != null) { + out.println(line); } - } - finally - { + } finally { in.close(); out.close(); } } - public static List orderFiles( Collection files ) - { - List result = new ArrayList<>( files ); - Collections.sort( result, new Comparator() - { - public int compare( File o1, File o2 ) - { - return o1.getAbsolutePath().compareTo( o2.getAbsolutePath() ); + public static List orderFiles(Collection files) { + List result = new ArrayList<>(files); + Collections.sort(result, new Comparator() { + public int compare(File o1, File o2) { + return o1.getAbsolutePath().compareTo(o2.getAbsolutePath()); } - } ); + }); return result; } - public static String sha1( Path in ) throws IOException - { - try - { - final MessageDigest md = MessageDigest.getInstance( "SHA-1" ); - return Hex.encodeHexString( md.digest( Files.readAllBytes( in ) ) ); - } - catch ( NoSuchAlgorithmException e ) - { - throw new RuntimeException( e ); + public static String sha1(Path in) throws IOException { + try { + final MessageDigest md = MessageDigest.getInstance("SHA-1"); + return Hex.encodeHexString(md.digest(Files.readAllBytes(in))); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); } } - public static String toExtension( String mimeType, boolean throwDefault ) - { - if ( mimeType == null ) - { - if ( throwDefault ) - { - throw new IllegalStateException( "Unexpected null mime type" ); - } - else - { + public static String toExtension(String mimeType, boolean throwDefault) { + if (mimeType == null) { + if (throwDefault) { + throw new IllegalStateException("Unexpected null mime type"); + } else { return null; } } - final String lowerMimeType = mimeType.toLowerCase( Locale.ROOT ); - if ( lowerMimeType.contains( "plain" ) || "text/x-c".equals( lowerMimeType ) ) - { + final String lowerMimeType = mimeType.toLowerCase(Locale.ROOT); + if (lowerMimeType.contains("plain") || "text/x-c".equals(lowerMimeType)) { return ".txt"; } - if ( lowerMimeType.contains( "html" ) ) - { + if (lowerMimeType.contains("html")) { return ".html"; } - if ( lowerMimeType.contains( "pdf" ) ) - { + if (lowerMimeType.contains("pdf")) { return ".pdf"; } - if ( throwDefault ) - { - throw new IllegalStateException( "Unexpected mime type '" + mimeType + "'" ); - } - else - { + if (throwDefault) { + throw new IllegalStateException("Unexpected mime type '" + mimeType + "'"); + } else { return null; } } diff --git a/src/main/java/org/codehaus/mojo/license/utils/MojoHelper.java b/src/main/java/org/codehaus/mojo/license/utils/MojoHelper.java index d22026df4..0f1986864 100644 --- a/src/main/java/org/codehaus/mojo/license/utils/MojoHelper.java +++ b/src/main/java/org/codehaus/mojo/license/utils/MojoHelper.java @@ -22,34 +22,6 @@ * #L% */ -import org.apache.commons.collections.comparators.ComparatorChain; - -/* - * #%L - * License Maven Plugin - * %% - * Copyright (C) 2010 - 2011 Codehaus - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * #L% - */ - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.model.Resource; -import org.apache.maven.project.MavenProject; - import java.io.File; import java.net.MalformedURLException; import java.net.URL; @@ -58,14 +30,18 @@ import java.util.Comparator; import java.util.List; +import org.apache.commons.collections.comparators.ComparatorChain; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.model.Resource; +import org.apache.maven.project.MavenProject; + /** * Mojo helper methods. * * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class MojoHelper -{ +public class MojoHelper { /** * Add the directory as a resource of the given project. @@ -75,10 +51,9 @@ public class MojoHelper * @param includes the includes of the resource * @return {@code true} if the resources was added (not already existing) */ - public static boolean addResourceDir( File dir, MavenProject project, String... includes ) - { + public static boolean addResourceDir(File dir, MavenProject project, String... includes) { List resources = project.getResources(); - return addResourceDir( dir, project, resources, includes ); + return addResourceDir(dir, project, resources, includes); } /** @@ -90,105 +65,87 @@ public static boolean addResourceDir( File dir, MavenProject project, String... * @param includes includes of the new resources * @return {@code true} if the resource was added (not already existing) */ - public static boolean addResourceDir( File dir, MavenProject project, List resources, String... includes ) - { + public static boolean addResourceDir(File dir, MavenProject project, List resources, String... includes) { String newresourceDir = dir.getAbsolutePath(); boolean shouldAdd = true; - for ( Object o : resources ) - { + for (Object o : resources) { Resource r = (Resource) o; - if ( !r.getDirectory().equals( newresourceDir ) ) - { + if (!r.getDirectory().equals(newresourceDir)) { continue; } - for ( String i : includes ) - { - if ( !r.getIncludes().contains( i ) ) - { - r.addInclude( i ); + for (String i : includes) { + if (!r.getIncludes().contains(i)) { + r.addInclude(i); } } shouldAdd = false; break; } - if ( shouldAdd ) - { + if (shouldAdd) { Resource r = new Resource(); - r.setDirectory( newresourceDir ); - for ( String i : includes ) - { - if ( !r.getIncludes().contains( i ) ) - { - r.addInclude( i ); + r.setDirectory(newresourceDir); + for (String i : includes) { + if (!r.getIncludes().contains(i)) { + r.addInclude(i); } } - project.addResource( r ); + project.addResource(r); } return shouldAdd; } - public static Comparator newMavenProjectComparator() - { - return new Comparator() - { + public static Comparator newMavenProjectComparator() { + return new Comparator() { /** * {@inheritDoc} */ - public int compare( MavenProject o1, MavenProject o2 ) - { + public int compare(MavenProject o1, MavenProject o2) { - String id1 = getArtifactId( o1.getArtifact() ); - String id2 = getArtifactId( o2.getArtifact() ); - return id1.compareTo( id2 ); + String id1 = getArtifactId(o1.getArtifact()); + String id2 = getArtifactId(o2.getArtifact()); + return id1.compareTo(id2); } }; - } - @SuppressWarnings( "unchecked" ) - public static Comparator newMavenProjectComparatorByName() - { - Comparator comparatorByName = new Comparator() - { + @SuppressWarnings("unchecked") + public static Comparator newMavenProjectComparatorByName() { + Comparator comparatorByName = new Comparator() { /** * {@inheritDoc} */ - public int compare( MavenProject o1, MavenProject o2 ) - { + public int compare(MavenProject o1, MavenProject o2) { - String id1 = getProjectName( o1 ); - String id2 = getProjectName( o2 ); - return id1.compareToIgnoreCase( id2 ); + String id1 = getProjectName(o1); + String id2 = getProjectName(o2); + return id1.compareToIgnoreCase(id2); } }; - //in case 2 project names are equal, compare by maven coordinates, to avoid losing - //projects with same name and different coordinates - return new ComparatorChain( Arrays.asList( comparatorByName, newMavenProjectComparator() ) ); + // in case 2 project names are equal, compare by maven coordinates, to avoid losing + // projects with same name and different coordinates + return new ComparatorChain(Arrays.asList(comparatorByName, newMavenProjectComparator())); } - protected static final double[] TIME_FACTORS = { 1000000, 1000, 60, 60, 24 }; + protected static final double[] TIME_FACTORS = {1000000, 1000, 60, 60, 24}; - protected static final String[] TIME_UNITES = { "ns", "ms", "s", "m", "h", "d" }; + protected static final String[] TIME_UNITES = {"ns", "ms", "s", "m", "h", "d"}; - public static String convertTime( long value ) - { - return convert( value, TIME_FACTORS, TIME_UNITES ); + public static String convertTime(long value) { + return convert(value, TIME_FACTORS, TIME_UNITES); } - public static String convert( long value, double[] factors, String[] unites ) - { - long sign = value == 0 ? 1 : value / Math.abs( value ); + public static String convert(long value, double[] factors, String[] unites) { + long sign = value == 0 ? 1 : value / Math.abs(value); int i = 0; - double tmp = Math.abs( value ); - while ( i < factors.length && i < unites.length && tmp > factors[i] ) - { + double tmp = Math.abs(value); + while (i < factors.length && i < unites.length && tmp > factors[i]) { tmp = tmp / factors[i++]; } tmp *= sign; String result; - result = MessageFormat.format( "{0,number,0.###}{1}", tmp, unites[i] ); + result = MessageFormat.format("{0,number,0.###}{1}", tmp, unites[i]); return result; } @@ -199,77 +156,63 @@ public static String convert( long value, double[] factors, String[] unites ) * @param suffix suffix to add * @return the new url */ - public static URL getUrl( URL baseUrl, String suffix ) - { + public static URL getUrl(URL baseUrl, String suffix) { String url = baseUrl.toString() + "/" + suffix; - try - { - return new URL( url ); - } - catch ( MalformedURLException ex ) - { - throw new IllegalArgumentException( "could not obtain url " + url, ex ); + try { + return new URL(url); + } catch (MalformedURLException ex) { + throw new IllegalArgumentException("could not obtain url " + url, ex); } } - public static String getArtifactId( Artifact artifact ) - { + public static String getArtifactId(Artifact artifact) { StringBuilder sb = new StringBuilder(); - sb.append( artifact.getGroupId() ); - sb.append( "--" ); - sb.append( artifact.getArtifactId() ); - sb.append( "--" ); - sb.append( artifact.getVersion() ); + sb.append(artifact.getGroupId()); + sb.append("--"); + sb.append(artifact.getArtifactId()); + sb.append("--"); + sb.append(artifact.getVersion()); return sb.toString(); } - public static String getArtifactName( MavenProject project ) - { + public static String getArtifactName(MavenProject project) { StringBuilder sb = new StringBuilder(); - if ( project.getName().startsWith( "Unnamed -" ) ) - { + if (project.getName().startsWith("Unnamed -")) { // as in Maven 3, let's use the artifact id - sb.append( project.getArtifactId() ); + sb.append(project.getArtifactId()); + } else { + sb.append(project.getName()); } - else - { - sb.append( project.getName() ); - } - sb.append( " (" ); - sb.append( project.getGroupId() ); - sb.append( ":" ); - sb.append( project.getArtifactId() ); - sb.append( ":" ); - sb.append( project.getVersion() ); - sb.append( " - " ); + sb.append(" ("); + sb.append(project.getGroupId()); + sb.append(":"); + sb.append(project.getArtifactId()); + sb.append(":"); + sb.append(project.getVersion()); + sb.append(" - "); String url = project.getUrl(); - sb.append( url == null ? "no url defined" : url ); - sb.append( ")" ); + sb.append(url == null ? "no url defined" : url); + sb.append(")"); return sb.toString(); } - public static String getProjectName( MavenProject project ) - { + public static String getProjectName(MavenProject project) { String sb; - if ( project.getName().startsWith( "Unnamed" ) ) - { + if (project.getName().startsWith("Unnamed")) { // as in Maven 3, let's use the artifact id sb = project.getArtifactId(); - } - else - { + } else { sb = project.getName(); } return sb; } - public static List getParams( String params ) - { - String[] split = params == null ? new String[0] : params.split( "," ); - return Arrays.asList( split ); + public static List getParams(String params) { + String[] split = params == null ? new String[0] : params.split(","); + return Arrays.asList(split); } } diff --git a/src/main/java/org/codehaus/mojo/license/utils/SortedProperties.java b/src/main/java/org/codehaus/mojo/license/utils/SortedProperties.java index b35ead216..7b88108e4 100644 --- a/src/main/java/org/codehaus/mojo/license/utils/SortedProperties.java +++ b/src/main/java/org/codehaus/mojo/license/utils/SortedProperties.java @@ -22,7 +22,6 @@ * #L% */ - import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -41,9 +40,7 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class SortedProperties - extends Properties -{ +public class SortedProperties extends Properties { private static final long serialVersionUID = -1147150444452577558L; @@ -57,44 +54,35 @@ public class SortedProperties */ protected boolean removeHeader; - - public SortedProperties( String encoding ) - { - this( encoding, true ); + public SortedProperties(String encoding) { + this(encoding, true); } - - public SortedProperties( String encoding, boolean removeHeader ) - { + public SortedProperties(String encoding, boolean removeHeader) { this.encoding = encoding; this.removeHeader = removeHeader; } - public SortedProperties( Properties defaults ) - { - super( defaults ); + public SortedProperties(Properties defaults) { + super(defaults); } /** * {@inheritDoc} */ @Override - public Enumeration keys() - { - List objects = Collections.list( super.keys() ); + public Enumeration keys() { + List objects = Collections.list(super.keys()); Vector result; - try - { + try { // Attention, si les clef ne sont pas des string, ca ne marchera pas - List list = toGenericList( objects, String.class ); - Collections.sort( list ); - result = new Vector( list ); - } - catch ( IllegalArgumentException e ) - { + List list = toGenericList(objects, String.class); + Collections.sort(list); + result = new Vector(list); + } catch (IllegalArgumentException e) { // keys are not string !!! // can not sort keys - result = new Vector<>( objects ); + result = new Vector<>(objects); } return result.elements(); } @@ -106,16 +94,11 @@ public Enumeration keys() * @return l'instance du properties * @throws java.io.IOException if any io pb */ - public SortedProperties load( File src ) - throws IOException - { - FileInputStream reader = new FileInputStream( src ); - try - { - load( reader ); - } - finally - { + public SortedProperties load(File src) throws IOException { + FileInputStream reader = new FileInputStream(src); + try { + load(reader); + } finally { reader.close(); } return this; @@ -127,16 +110,11 @@ public SortedProperties load( File src ) * @param dst the fichier de destination * @throws java.io.IOException if any io pb */ - public void store( File dst ) - throws IOException - { - OutputStream writer = new FileOutputStream( dst ); - try - { - store( writer, null ); - } - finally - { + public void store(File dst) throws IOException { + OutputStream writer = new FileOutputStream(dst); + try { + store(writer, null); + } finally { writer.close(); } } @@ -158,23 +136,17 @@ public void store( File dst ) * n'est pas en adequation avec le type * voulue. */ - @SuppressWarnings( { "unchecked" } ) - public static List toGenericList( List list, Class type ) - throws IllegalArgumentException - { - if ( list.isEmpty() ) - { + @SuppressWarnings({"unchecked"}) + public static List toGenericList(List list, Class type) throws IllegalArgumentException { + if (list.isEmpty()) { return (List) list; } - for ( Object o : list ) - { - if ( !type.isAssignableFrom( o.getClass() ) ) - { + for (Object o : list) { + if (!type.isAssignableFrom(o.getClass())) { throw new IllegalArgumentException( - "can not cast List with object of type " + o.getClass() + " to " + type + " type!" ); + "can not cast List with object of type " + o.getClass() + " to " + type + " type!"); } } return (List) list; } - } diff --git a/src/main/java/org/codehaus/mojo/license/utils/StringToList.java b/src/main/java/org/codehaus/mojo/license/utils/StringToList.java index 1fe303ba9..a34ef6bee 100644 --- a/src/main/java/org/codehaus/mojo/license/utils/StringToList.java +++ b/src/main/java/org/codehaus/mojo/license/utils/StringToList.java @@ -22,12 +22,11 @@ * #L% */ -import org.apache.commons.lang3.StringUtils; -import org.apache.maven.plugin.MojoExecutionException; - import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang3.StringUtils; +import org.apache.maven.plugin.MojoExecutionException; /** * Object to convert in mojo a parameter from a some simple String to a List. @@ -37,52 +36,40 @@ * @author tchemit dev@tchemit.fr * @since 1.4 */ -public class StringToList -{ +public class StringToList { /** * List of data. */ private final List data; - public StringToList() - { + public StringToList() { data = new ArrayList<>(); } - /** - * @param data a list of licenses or a URL - */ - public StringToList( String data ) throws MojoExecutionException - { - this(); - if ( !UrlRequester.isStringUrl( data ) ) - { - for ( String s : data.split( "\\s*\\|\\s*" ) ) - { - addEntryToList( s ); - } - } - else - { - for ( String license : UrlRequester.downloadList( data ) ) - { - if ( data != null && StringUtils.isNotBlank( license ) && !this.data.contains( license ) ) - { - this.data.add( license ); - } + /** + * @param data a list of licenses or a URL + */ + public StringToList(String data) throws MojoExecutionException { + this(); + if (!UrlRequester.isStringUrl(data)) { + for (String s : data.split("\\s*\\|\\s*")) { + addEntryToList(s); + } + } else { + for (String license : UrlRequester.downloadList(data)) { + if (data != null && StringUtils.isNotBlank(license) && !this.data.contains(license)) { + this.data.add(license); + } + } } - } } - public List getData() - { + public List getData() { return data; } - protected void addEntryToList( String data ) - { - this.data.add( data ); + protected void addEntryToList(String data) { + this.data.add(data); } - } diff --git a/src/main/java/org/codehaus/mojo/license/utils/UrlRequester.java b/src/main/java/org/codehaus/mojo/license/utils/UrlRequester.java index 5a6dd11eb..20712c0fa 100644 --- a/src/main/java/org/codehaus/mojo/license/utils/UrlRequester.java +++ b/src/main/java/org/codehaus/mojo/license/utils/UrlRequester.java @@ -30,6 +30,7 @@ import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; + import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; @@ -40,14 +41,12 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.maven.plugin.MojoExecutionException; - /** * This class should be used to load the content from a URL. *

* Supported URL protocols are those standards plus classpath protocol. */ -public class UrlRequester -{ +public class UrlRequester { public static final String CLASSPATH_PROTOCOL = "classpath"; @@ -57,23 +56,17 @@ public class UrlRequester * @param data the license string or a URL * @return true if URL, false else */ - public static boolean isStringUrl( String data ) - { - if ( StringUtils.isBlank( data ) ) - { + public static boolean isStringUrl(String data) { + if (StringUtils.isBlank(data)) { return false; } - if ( data.startsWith( CLASSPATH_PROTOCOL + ':' ) ) - { + if (data.startsWith(CLASSPATH_PROTOCOL + ':')) { return true; } - try - { - new URL( data ); + try { + new URL(data); return true; - } - catch ( MalformedURLException e ) - { + } catch (MalformedURLException e) { return false; } } @@ -84,10 +77,9 @@ public static boolean isStringUrl( String data ) * @param url the URL as a string * @return true if URL use external protocol */ - public static boolean isExternalUrl( String url ) - { - String protocol = findProtocol( url ); - return "http".equals( protocol ) || "https".equals( protocol ) || CLASSPATH_PROTOCOL.equals( protocol ); + public static boolean isExternalUrl(String url) { + String protocol = findProtocol(url); + return "http".equals(protocol) || "https".equals(protocol) || CLASSPATH_PROTOCOL.equals(protocol); } /** @@ -97,9 +89,8 @@ public static boolean isExternalUrl( String url ) * @return the string representation of the resource at the given URL * @throws IOException If an I/O error occurs when retrieve of the content URL */ - public static String getFromUrl( String url ) throws IOException - { - return getFromUrl( url, "UTF-8" ); + public static String getFromUrl(String url) throws IOException { + return getFromUrl(url, "UTF-8"); } /** @@ -110,10 +101,9 @@ public static String getFromUrl( String url ) throws IOException * @param url the URL as a string. * @return the protocol from the URL. */ - public static String findProtocol( String url ) - { + public static String findProtocol(String url) { // Here could not be used the URL parser because classpath does not have a registered Handler - return StringUtils.substringBefore( url, ":" ).toLowerCase(); + return StringUtils.substringBefore(url, ":").toLowerCase(); } /** @@ -124,61 +114,46 @@ public static String findProtocol( String url ) * @return the string representation of the resource at the given URL * @throws IOException If an I/O error occurs when retrieve of the content URL */ - public static String getFromUrl( String url, String encoding ) throws IOException - { - String protocol = findProtocol( url ); - Charset charset = Charset.forName( encoding ); + public static String getFromUrl(String url, String encoding) throws IOException { + String protocol = findProtocol(url); + Charset charset = Charset.forName(encoding); String result = null; - if ( CLASSPATH_PROTOCOL.equals( protocol ) ) - { + if (CLASSPATH_PROTOCOL.equals(protocol)) { ClassLoader classLoader = UrlRequester.class.getClassLoader(); - String resource = url.substring( CLASSPATH_PROTOCOL.length() + 1 ); - URL resourceUrl = classLoader.getResource( resource ); - if ( resourceUrl != null ) - { - result = IOUtils.toString( resourceUrl, charset ); + String resource = url.substring(CLASSPATH_PROTOCOL.length() + 1); + URL resourceUrl = classLoader.getResource(resource); + if (resourceUrl != null) { + result = IOUtils.toString(resourceUrl, charset); + } else { + throw new IOException("The resource " + resource + " was not found in the maven plugin classpath"); } - else - { - throw new IOException( "The resource " + resource - + " was not found in the maven plugin classpath" ); - } - } - else if ( "http".equals( protocol ) || "https".equals( protocol ) ) - { - try ( CloseableHttpClient httpClient = HttpClientBuilder.create().build() ) - { - HttpGet get = new HttpGet( url ); - try ( CloseableHttpResponse response = httpClient.execute( get ) ) - { + } else if ("http".equals(protocol) || "https".equals(protocol)) { + try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) { + HttpGet get = new HttpGet(url); + try (CloseableHttpResponse response = httpClient.execute(get)) { int responseCode = response.getStatusLine().getStatusCode(); // CHECKSTYLE_OFF: MagicNumber - if ( responseCode >= 200 && responseCode < 300 ) + if (responseCode >= 200 && responseCode < 300) // CHECKSTYLE_ON: MagicNumber { // server has response and there might be a not empty payload HttpEntity entity = response.getEntity(); - ContentType contentType = ContentType.get( entity ); - if ( contentType != null ) - { + ContentType contentType = ContentType.get(entity); + if (contentType != null) { charset = contentType.getCharset(); } - result = IOUtils.toString( entity.getContent(), charset ); - } - else - { - throw new IOException( "For the URL (" + url + ") the server responded with " - + response.getStatusLine() ); + result = IOUtils.toString(entity.getContent(), charset); + } else { + throw new IOException( + "For the URL (" + url + ") the server responded with " + response.getStatusLine()); } } } - } - else - { - result = IOUtils.toString( new URL( url ).openStream(), charset ); + } else { + result = IOUtils.toString(new URL(url).openStream(), charset); } return result; } @@ -195,37 +170,26 @@ else if ( "http".equals( protocol ) || "https".equals( protocol ) ) * @param url the URL to the external resource * @return a new list with all license entries from the remote resource */ - public static List downloadList( String url ) throws MojoExecutionException - { + public static List downloadList(String url) throws MojoExecutionException { List list = new ArrayList<>(); BufferedReader bufferedReader = null; - try - { - bufferedReader = new BufferedReader( new CharArrayReader( getFromUrl( url ).toCharArray() ) ); + try { + bufferedReader = + new BufferedReader(new CharArrayReader(getFromUrl(url).toCharArray())); String line; - while ( ( line = bufferedReader.readLine() ) != null ) - { - if ( StringUtils.isNotBlank( line ) && !StringUtils.startsWith( line, "#" ) && !list.contains( line ) ) - { - list.add( line ); + while ((line = bufferedReader.readLine()) != null) { + if (StringUtils.isNotBlank(line) && !StringUtils.startsWith(line, "#") && !list.contains(line)) { + list.add(line); } } - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Could not open connection to URL: " + url, e ); - } - finally - { - if ( bufferedReader != null ) - { - try - { + } catch (IOException e) { + throw new MojoExecutionException("Could not open connection to URL: " + url, e); + } finally { + if (bufferedReader != null) { + try { bufferedReader.close(); - } - catch ( IOException e ) - { - throw new MojoExecutionException( e.getMessage(), e ); + } catch (IOException e) { + throw new MojoExecutionException(e.getMessage(), e); } } } diff --git a/src/test/java/org/codehaus/mojo/license/LicenseMojoUtilsTest.java b/src/test/java/org/codehaus/mojo/license/LicenseMojoUtilsTest.java index b36d67c23..e1a41ceb9 100644 --- a/src/test/java/org/codehaus/mojo/license/LicenseMojoUtilsTest.java +++ b/src/test/java/org/codehaus/mojo/license/LicenseMojoUtilsTest.java @@ -1,165 +1,141 @@ package org.codehaus.mojo.license; -import static org.junit.Assert.*; - import java.io.File; import org.junit.Test; -public class LicenseMojoUtilsTest -{ +import static org.junit.Assert.*; + +public class LicenseMojoUtilsTest { private String resolvedUrl; private File deprecatedFile; private String url; - private File basedir = new File( "" ); + private File basedir = new File(""); private MockLogger log = new MockLogger(); @Test - public void testIsValidNull() - { - assertFalse( LicenseMojoUtils.isValid( null ) ); + public void testIsValidNull() { + assertFalse(LicenseMojoUtils.isValid(null)); } @Test - public void testIsValidEmpty() - { + public void testIsValidEmpty() { // This might be wrong; feel free to change the test when it starts to fail - assertTrue( LicenseMojoUtils.isValid( "" ) ); + assertTrue(LicenseMojoUtils.isValid("")); } @Test - public void testIsValidBlank() - { + public void testIsValidBlank() { // This might be wrong; feel free to change the test when it starts to fail - assertTrue( LicenseMojoUtils.isValid( " " ) ); + assertTrue(LicenseMojoUtils.isValid(" ")); } @Test - public void testIsValidNonexistingClasspathResource() - { - assertTrue( LicenseMojoUtils.isValid( "classpath:noSuchResource" ) ); + public void testIsValidNonexistingClasspathResource() { + assertTrue(LicenseMojoUtils.isValid("classpath:noSuchResource")); } @Test - public void testIsValidClasspathResource() - { - assertTrue( LicenseMojoUtils.isValid( "classpath:log4j.properties" ) ); + public void testIsValidClasspathResource() { + assertTrue(LicenseMojoUtils.isValid("classpath:log4j.properties")); } @Test - public void testIsValidHttpResource() - { - assertTrue( LicenseMojoUtils.isValid( "http://foo/bar/baz" ) ); + public void testIsValidHttpResource() { + assertTrue(LicenseMojoUtils.isValid("http://foo/bar/baz")); } @Test - public void testPrepareThirdPartyOverrideUrlNull() - { - String actual = LicenseMojoUtils.prepareThirdPartyOverrideUrl( resolvedUrl, deprecatedFile, url, basedir, log ); - assertEquals( LicenseMojoUtils.NO_URL, actual ); + public void testPrepareThirdPartyOverrideUrlNull() { + String actual = LicenseMojoUtils.prepareThirdPartyOverrideUrl(resolvedUrl, deprecatedFile, url, basedir, log); + assertEquals(LicenseMojoUtils.NO_URL, actual); } @Test - public void testPrepareThirdPartyOverrideUrlBothOverrides() - { - deprecatedFile = new File( "src/test/resources/overrides.properties" ); + public void testPrepareThirdPartyOverrideUrlBothOverrides() { + deprecatedFile = new File("src/test/resources/overrides.properties"); url = "classpath:overrides.properties"; - try - { - LicenseMojoUtils.prepareThirdPartyOverrideUrl( resolvedUrl, deprecatedFile, url, basedir, log ); + try { + LicenseMojoUtils.prepareThirdPartyOverrideUrl(resolvedUrl, deprecatedFile, url, basedir, log); - fail( "Missing exception" ); - } - catch( IllegalArgumentException e ) - { - assertEquals( "You can't use both overrideFile and overrideUrl", e.getMessage() ); + fail("Missing exception"); + } catch (IllegalArgumentException e) { + assertEquals("You can't use both overrideFile and overrideUrl", e.getMessage()); } } @Test - public void testPrepareThirdPartyOverrideUrlNonExistingDeprecatedFile() - { - deprecatedFile = new File( "foo" ); + public void testPrepareThirdPartyOverrideUrlNonExistingDeprecatedFile() { + deprecatedFile = new File("foo"); String actual = runTestAndJoinResults(); assertEquals( "resolved=file:///inexistent\n" - + "valid=false\n" - + "WARN 'overrideFile' mojo parameter is deprecated. Use 'overrideUrl' instead.\n" - + "WARN overrideFile [.../foo] was configured but doesn't exist\n" - + "DEBUG No (valid) URL and no file [.../override-THIRD-PARTY.properties] found; not loading any overrides\n" - , actual ); + + "valid=false\n" + + "WARN 'overrideFile' mojo parameter is deprecated. Use 'overrideUrl' instead.\n" + + "WARN overrideFile [.../foo] was configured but doesn't exist\n" + + "DEBUG No (valid) URL and no file [.../override-THIRD-PARTY.properties] found; not loading any overrides\n", + actual); } @Test - public void testPrepareThirdPartyOverrideUrlDeprecatedFile() - { - deprecatedFile = new File( "src/test/resources/overrides.properties" ); + public void testPrepareThirdPartyOverrideUrlDeprecatedFile() { + deprecatedFile = new File("src/test/resources/overrides.properties"); String actual = runTestAndJoinResults(); assertEquals( "resolved=file:/.../overrides.properties\n" - + "valid=true\n" - + "WARN 'overrideFile' mojo parameter is deprecated. Use 'overrideUrl' instead.\n" - + "DEBUG Loading overrides from file file:/.../overrides.properties\n" - , actual ); + + "valid=true\n" + + "WARN 'overrideFile' mojo parameter is deprecated. Use 'overrideUrl' instead.\n" + + "DEBUG Loading overrides from file file:/.../overrides.properties\n", + actual); } @Test - public void testPrepareThirdPartyOverrideClasspathResource() - { + public void testPrepareThirdPartyOverrideClasspathResource() { url = "classpath:overrides.properties"; - String actual = LicenseMojoUtils.prepareThirdPartyOverrideUrl( resolvedUrl, deprecatedFile, url, basedir, log ); - assertEquals( url, actual ); - assertTrue( LicenseMojoUtils.isValid(actual) ); - assertEquals( "DEBUG Loading overrides from URL classpath:overrides.properties\n", log.dump() ); + String actual = LicenseMojoUtils.prepareThirdPartyOverrideUrl(resolvedUrl, deprecatedFile, url, basedir, log); + assertEquals(url, actual); + assertTrue(LicenseMojoUtils.isValid(actual)); + assertEquals("DEBUG Loading overrides from URL classpath:overrides.properties\n", log.dump()); } @Test - public void testPrepareThirdPartyOverrideInvalidUrl() - { + public void testPrepareThirdPartyOverrideInvalidUrl() { url = "foo://localhost/bar"; String actual = runTestAndJoinResults(); assertEquals( "resolved=file:///inexistent\n" - + "valid=false\n" - + "WARN Unsupported or invalid URL [foo://localhost/bar] found in overrideUrl; supported are 'classpath:' URLs and anything your JVM supports (file:, http: and https: should always work)\n" - + "DEBUG No (valid) URL and no file [.../override-THIRD-PARTY.properties] found; not loading any overrides\n" - , actual ); + + "valid=false\n" + + "WARN Unsupported or invalid URL [foo://localhost/bar] found in overrideUrl; supported are 'classpath:' URLs and anything your JVM supports (file:, http: and https: should always work)\n" + + "DEBUG No (valid) URL and no file [.../override-THIRD-PARTY.properties] found; not loading any overrides\n", + actual); } @Test - public void testPrepareThirdPartyOverridePreventReinit() - { + public void testPrepareThirdPartyOverridePreventReinit() { resolvedUrl = "classpath:overrides.properties"; - deprecatedFile = new File( "foo" ); + deprecatedFile = new File("foo"); url = "classpath:bar"; String actual = runTestAndJoinResults(); assertEquals( "resolved=classpath:overrides.properties\n" - + "valid=true\n" - + "WARN 'overrideFile' mojo parameter is deprecated. Use 'overrideUrl' instead.\n" - , actual ); + + "valid=true\n" + + "WARN 'overrideFile' mojo parameter is deprecated. Use 'overrideUrl' instead.\n", + actual); } /** Allow to validate several test results in one assert */ - private String runTestAndJoinResults() - { - String result = LicenseMojoUtils.prepareThirdPartyOverrideUrl( resolvedUrl, deprecatedFile, url, basedir, log ); - File defaultOverride = new File ( LicenseMojoUtils.DEFAULT_OVERRIDE_THIRD_PARTY ); - String dump = log.dump() - .replace( defaultOverride.getAbsolutePath(), ".../" + defaultOverride.getName() ); - - if ( deprecatedFile != null ) - { - dump = dump - .replace( deprecatedFile.toURI().toString(), "file:/.../" + deprecatedFile.getName() ) - .replace( deprecatedFile.getAbsolutePath(), ".../" + deprecatedFile.getName() ); - result = result - .replace( deprecatedFile.toURI().toString(), "file:/.../" + deprecatedFile.getName() ); + private String runTestAndJoinResults() { + String result = LicenseMojoUtils.prepareThirdPartyOverrideUrl(resolvedUrl, deprecatedFile, url, basedir, log); + File defaultOverride = new File(LicenseMojoUtils.DEFAULT_OVERRIDE_THIRD_PARTY); + String dump = log.dump().replace(defaultOverride.getAbsolutePath(), ".../" + defaultOverride.getName()); + + if (deprecatedFile != null) { + dump = dump.replace(deprecatedFile.toURI().toString(), "file:/.../" + deprecatedFile.getName()) + .replace(deprecatedFile.getAbsolutePath(), ".../" + deprecatedFile.getName()); + result = result.replace(deprecatedFile.toURI().toString(), "file:/.../" + deprecatedFile.getName()); } - String actual = "resolved=" + result + "\n" - + "valid=" + LicenseMojoUtils.isValid( result ) + "\n" - + dump; + String actual = "resolved=" + result + "\n" + "valid=" + LicenseMojoUtils.isValid(result) + "\n" + dump; return actual; } } diff --git a/src/test/java/org/codehaus/mojo/license/MockLogger.java b/src/test/java/org/codehaus/mojo/license/MockLogger.java index 7bb614ad5..7b7533450 100644 --- a/src/test/java/org/codehaus/mojo/license/MockLogger.java +++ b/src/test/java/org/codehaus/mojo/license/MockLogger.java @@ -5,45 +5,35 @@ import org.codehaus.mojo.license.LicenseMojoUtils.LoggerFacade; -public class MockLogger - implements LoggerFacade -{ - private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile( "\\Q{}\\E" ); - - private static final String format( String template, Object param ) - { - return PLACEHOLDER_PATTERN.matcher( template ) - .replaceFirst( Matcher.quoteReplacement( String.valueOf( param ) ) ); +public class MockLogger implements LoggerFacade { + private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("\\Q{}\\E"); + + private static final String format(String template, Object param) { + return PLACEHOLDER_PATTERN.matcher(template).replaceFirst(Matcher.quoteReplacement(String.valueOf(param))); } private final StringBuilder log = new StringBuilder(); @Override - public void debug( String template, Object param ) - { - log.append( "DEBUG " ).append( format( template, param ) ).append( "\n" ); + public void debug(String template, Object param) { + log.append("DEBUG ").append(format(template, param)).append("\n"); } @Override - public void warn( String string ) - { - log.append( "WARN " ).append( string ).append( "\n" ); + public void warn(String string) { + log.append("WARN ").append(string).append("\n"); } @Override - public void warn( String template, Object param ) - { - log.append( "WARN " ).append( format( template, param ) ).append( "\n" ); + public void warn(String template, Object param) { + log.append("WARN ").append(format(template, param)).append("\n"); } - public String dump() - { + public String dump() { return log.toString(); } - public void reset() - { - log.setLength( 0 ); + public void reset() { + log.setLength(0); } - } diff --git a/src/test/java/org/codehaus/mojo/license/api/ArtifactFiltersTest.java b/src/test/java/org/codehaus/mojo/license/api/ArtifactFiltersTest.java index b63d8b285..60fec21c6 100644 --- a/src/test/java/org/codehaus/mojo/license/api/ArtifactFiltersTest.java +++ b/src/test/java/org/codehaus/mojo/license/api/ArtifactFiltersTest.java @@ -10,188 +10,186 @@ import org.apache.maven.artifact.DefaultArtifact; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.artifact.versioning.VersionRange; -import org.codehaus.mojo.license.api.ArtifactFilters; import org.codehaus.mojo.license.api.ArtifactFilters.Builder; import org.junit.Assert; import org.junit.Test; -public class ArtifactFiltersTest -{ +public class ArtifactFiltersTest { @Test - public void isIncluded() - throws InvalidVersionSpecificationException - { - final Artifact jar1Compile = - new DefaultArtifact( "org.group1", "artifact1", VersionRange.createFromVersionSpec( "1.0" ), "compile", - "jar", "", null ); - final Artifact jar2Compile = - new DefaultArtifact( "org.group1", "artifact2", VersionRange.createFromVersionSpec( "1.0" ), "compile", - "jar", "", null ); - final Artifact jar3Compile = - new DefaultArtifact( "org.group1", "artifact3", VersionRange.createFromVersionSpec( "1.0" ), "compile", - "jar", "", null ); - final Artifact war1Compile = - new DefaultArtifact( "org.group1", "artifact1", VersionRange.createFromVersionSpec( "1.0" ), "compile", - "war", "", null ); - final Artifact jar1Test = - new DefaultArtifact( "org.group1", "artifact1", VersionRange.createFromVersionSpec( "1.0" ), "test", "jar", - "", null ); - - final Artifact jar4CompileOptional = - new DefaultArtifact( "org.group1", "artifact4", VersionRange.createFromVersionSpec( "1.0" ), "compile", - "jar", "", null ); - jar4CompileOptional.setOptional( true ); + public void isIncluded() throws InvalidVersionSpecificationException { + final Artifact jar1Compile = new DefaultArtifact( + "org.group1", "artifact1", VersionRange.createFromVersionSpec("1.0"), "compile", "jar", "", null); + final Artifact jar2Compile = new DefaultArtifact( + "org.group1", "artifact2", VersionRange.createFromVersionSpec("1.0"), "compile", "jar", "", null); + final Artifact jar3Compile = new DefaultArtifact( + "org.group1", "artifact3", VersionRange.createFromVersionSpec("1.0"), "compile", "jar", "", null); + final Artifact war1Compile = new DefaultArtifact( + "org.group1", "artifact1", VersionRange.createFromVersionSpec("1.0"), "compile", "war", "", null); + final Artifact jar1Test = new DefaultArtifact( + "org.group1", "artifact1", VersionRange.createFromVersionSpec("1.0"), "test", "jar", "", null); + + final Artifact jar4CompileOptional = new DefaultArtifact( + "org.group1", "artifact4", VersionRange.createFromVersionSpec("1.0"), "compile", "jar", "", null); + jar4CompileOptional.setOptional(true); final ArtifactFilters defaultFilters = ArtifactFilters.buidler().build(); - Assert.assertTrue( defaultFilters.isIncluded( jar1Compile ) ); - Assert.assertTrue( defaultFilters.isIncluded( jar2Compile ) ); - Assert.assertTrue( defaultFilters.isIncluded( war1Compile ) ); - Assert.assertTrue( defaultFilters.isIncluded( jar1Test ) ); - Assert.assertTrue( defaultFilters.isIncluded( jar4CompileOptional ) ); - - final ArtifactFilters includeScope = ArtifactFilters.buidler().includeScope( "compile" ).build(); - Assert.assertTrue( includeScope.isIncluded( jar1Compile ) ); - Assert.assertTrue( includeScope.isIncluded( jar2Compile ) ); - Assert.assertTrue( includeScope.isIncluded( war1Compile ) ); - Assert.assertFalse( includeScope.isIncluded( jar1Test ) ); - Assert.assertTrue( includeScope.isIncluded( jar4CompileOptional ) ); - - final ArtifactFilters excludeScope = ArtifactFilters.buidler().excludeScope( "test" ).build(); - Assert.assertTrue( excludeScope.isIncluded( jar1Compile ) ); - Assert.assertTrue( excludeScope.isIncluded( jar2Compile ) ); - Assert.assertTrue( excludeScope.isIncluded( war1Compile ) ); - Assert.assertFalse( excludeScope.isIncluded( jar1Test ) ); - Assert.assertTrue( excludeScope.isIncluded( jar4CompileOptional ) ); - - final ArtifactFilters includeType = ArtifactFilters.buidler().includeType( "jar" ).build(); - Assert.assertTrue( includeType.isIncluded( jar1Compile ) ); - Assert.assertTrue( includeType.isIncluded( jar2Compile ) ); - Assert.assertFalse( includeType.isIncluded( war1Compile ) ); - Assert.assertTrue( includeType.isIncluded( jar1Test ) ); - Assert.assertTrue( includeType.isIncluded( jar4CompileOptional ) ); - - final ArtifactFilters excludeType = ArtifactFilters.buidler().excludeType( "war" ).build(); - Assert.assertTrue( excludeType.isIncluded( jar1Compile ) ); - Assert.assertTrue( excludeType.isIncluded( jar2Compile ) ); - Assert.assertFalse( excludeType.isIncluded( war1Compile ) ); - Assert.assertTrue( excludeType.isIncluded( jar1Test ) ); - Assert.assertTrue( excludeType.isIncluded( jar4CompileOptional ) ); - - final ArtifactFilters includeGa = ArtifactFilters.buidler().includeGa( "org\\.group1:artifact[^2]" ).build(); - Assert.assertTrue( includeGa.isIncluded( jar1Compile ) ); - Assert.assertFalse( includeGa.isIncluded( jar2Compile ) ); - Assert.assertTrue( includeGa.isIncluded( war1Compile ) ); - Assert.assertTrue( includeGa.isIncluded( jar1Test ) ); - Assert.assertTrue( includeGa.isIncluded( jar4CompileOptional ) ); - - final ArtifactFilters includeGas = - ArtifactFilters.buidler().includeGas( "org\\.group1:artifact1", "org\\.group1:artifact3" ).build(); - Assert.assertTrue( includeGas.isIncluded( jar1Compile ) ); - Assert.assertFalse( includeGas.isIncluded( jar2Compile ) ); - Assert.assertTrue( includeGas.isIncluded( jar3Compile ) ); - Assert.assertTrue( includeGas.isIncluded( war1Compile ) ); - Assert.assertTrue( includeGas.isIncluded( jar1Test ) ); - Assert.assertFalse( includeGas.isIncluded( jar4CompileOptional ) ); - - final ArtifactFilters excludeGas = - ArtifactFilters.buidler().excludeGas( "org\\.group1:artifact2", "org\\.group1:artifact3" ).build(); - Assert.assertTrue( excludeGas.isIncluded( jar1Compile ) ); - Assert.assertFalse( excludeGas.isIncluded( jar2Compile ) ); - Assert.assertFalse( excludeGas.isIncluded( jar3Compile ) ); - Assert.assertTrue( excludeGas.isIncluded( war1Compile ) ); - Assert.assertTrue( excludeGas.isIncluded( jar1Test ) ); - Assert.assertTrue( excludeGas.isIncluded( jar4CompileOptional ) ); - - final ArtifactFilters excludeGa = ArtifactFilters.buidler().excludeGa( "org\\.group1:artifact2" ).build(); - Assert.assertTrue( excludeGa.isIncluded( jar1Compile ) ); - Assert.assertFalse( excludeGa.isIncluded( jar2Compile ) ); - Assert.assertTrue( excludeGa.isIncluded( war1Compile ) ); - Assert.assertTrue( excludeGa.isIncluded( jar1Test ) ); - Assert.assertTrue( excludeGa.isIncluded( jar4CompileOptional ) ); - - final ArtifactFilters includeExcludeGas = - ArtifactFilters.buidler().includeGa( "org\\.group1:.*" ).excludeGa( "org\\.group1:artifact3" ).build(); - Assert.assertTrue( includeExcludeGas.isIncluded( jar1Compile ) ); - Assert.assertTrue( includeExcludeGas.isIncluded( jar2Compile ) ); - Assert.assertFalse( includeExcludeGas.isIncluded( jar3Compile ) ); - Assert.assertTrue( includeExcludeGas.isIncluded( war1Compile ) ); - Assert.assertTrue( includeExcludeGas.isIncluded( jar1Test ) ); - Assert.assertTrue( includeExcludeGas.isIncluded( jar4CompileOptional ) ); - - final ArtifactFilters includeExcludeGasType = - ArtifactFilters.buidler().includeGa( "org\\.group1:.*" ).excludeGa( "org\\.group1:artifact3" ).excludeType( "war" ).build(); - Assert.assertTrue( includeExcludeGasType.isIncluded( jar1Compile ) ); - Assert.assertTrue( includeExcludeGasType.isIncluded( jar2Compile ) ); - Assert.assertFalse( includeExcludeGasType.isIncluded( jar3Compile ) ); - Assert.assertFalse( includeExcludeGasType.isIncluded( war1Compile ) ); - Assert.assertTrue( includeExcludeGasType.isIncluded( jar1Test ) ); - Assert.assertTrue( includeExcludeGasType.isIncluded( jar4CompileOptional ) ); - - final ArtifactFilters includeExcludeGasTypeScope = - ArtifactFilters.buidler().includeGa( "org\\.group1:.*" ).excludeGa( "org\\.group1:artifact3" ).excludeType( "war" ).excludeScope( "test" ).build(); - Assert.assertTrue( includeExcludeGasTypeScope.isIncluded( jar1Compile ) ); - Assert.assertTrue( includeExcludeGasTypeScope.isIncluded( jar2Compile ) ); - Assert.assertFalse( includeExcludeGasTypeScope.isIncluded( jar3Compile ) ); - Assert.assertFalse( includeExcludeGasTypeScope.isIncluded( war1Compile ) ); - Assert.assertFalse( includeExcludeGasTypeScope.isIncluded( jar1Test ) ); - Assert.assertTrue( includeExcludeGasTypeScope.isIncluded( jar4CompileOptional ) ); - - final ArtifactFilters includeOptional = ArtifactFilters.buidler().includeOptional( true ).build(); - Assert.assertTrue( includeOptional.isIncluded( jar1Compile ) ); - Assert.assertTrue( includeOptional.isIncluded( jar2Compile ) ); - Assert.assertTrue( includeOptional.isIncluded( war1Compile ) ); - Assert.assertTrue( includeOptional.isIncluded( jar1Test ) ); - Assert.assertTrue( includeOptional.isIncluded( jar4CompileOptional ) ); - - final ArtifactFilters excludeOptional = ArtifactFilters.buidler().includeOptional( false ).build(); - Assert.assertTrue( excludeOptional.isIncluded( jar1Compile ) ); - Assert.assertTrue( excludeOptional.isIncluded( jar2Compile ) ); - Assert.assertTrue( excludeOptional.isIncluded( war1Compile ) ); - Assert.assertTrue( excludeOptional.isIncluded( jar1Test ) ); - Assert.assertFalse( excludeOptional.isIncluded( jar4CompileOptional ) ); - + Assert.assertTrue(defaultFilters.isIncluded(jar1Compile)); + Assert.assertTrue(defaultFilters.isIncluded(jar2Compile)); + Assert.assertTrue(defaultFilters.isIncluded(war1Compile)); + Assert.assertTrue(defaultFilters.isIncluded(jar1Test)); + Assert.assertTrue(defaultFilters.isIncluded(jar4CompileOptional)); + + final ArtifactFilters includeScope = + ArtifactFilters.buidler().includeScope("compile").build(); + Assert.assertTrue(includeScope.isIncluded(jar1Compile)); + Assert.assertTrue(includeScope.isIncluded(jar2Compile)); + Assert.assertTrue(includeScope.isIncluded(war1Compile)); + Assert.assertFalse(includeScope.isIncluded(jar1Test)); + Assert.assertTrue(includeScope.isIncluded(jar4CompileOptional)); + + final ArtifactFilters excludeScope = + ArtifactFilters.buidler().excludeScope("test").build(); + Assert.assertTrue(excludeScope.isIncluded(jar1Compile)); + Assert.assertTrue(excludeScope.isIncluded(jar2Compile)); + Assert.assertTrue(excludeScope.isIncluded(war1Compile)); + Assert.assertFalse(excludeScope.isIncluded(jar1Test)); + Assert.assertTrue(excludeScope.isIncluded(jar4CompileOptional)); + + final ArtifactFilters includeType = + ArtifactFilters.buidler().includeType("jar").build(); + Assert.assertTrue(includeType.isIncluded(jar1Compile)); + Assert.assertTrue(includeType.isIncluded(jar2Compile)); + Assert.assertFalse(includeType.isIncluded(war1Compile)); + Assert.assertTrue(includeType.isIncluded(jar1Test)); + Assert.assertTrue(includeType.isIncluded(jar4CompileOptional)); + + final ArtifactFilters excludeType = + ArtifactFilters.buidler().excludeType("war").build(); + Assert.assertTrue(excludeType.isIncluded(jar1Compile)); + Assert.assertTrue(excludeType.isIncluded(jar2Compile)); + Assert.assertFalse(excludeType.isIncluded(war1Compile)); + Assert.assertTrue(excludeType.isIncluded(jar1Test)); + Assert.assertTrue(excludeType.isIncluded(jar4CompileOptional)); + + final ArtifactFilters includeGa = + ArtifactFilters.buidler().includeGa("org\\.group1:artifact[^2]").build(); + Assert.assertTrue(includeGa.isIncluded(jar1Compile)); + Assert.assertFalse(includeGa.isIncluded(jar2Compile)); + Assert.assertTrue(includeGa.isIncluded(war1Compile)); + Assert.assertTrue(includeGa.isIncluded(jar1Test)); + Assert.assertTrue(includeGa.isIncluded(jar4CompileOptional)); + + final ArtifactFilters includeGas = ArtifactFilters.buidler() + .includeGas("org\\.group1:artifact1", "org\\.group1:artifact3") + .build(); + Assert.assertTrue(includeGas.isIncluded(jar1Compile)); + Assert.assertFalse(includeGas.isIncluded(jar2Compile)); + Assert.assertTrue(includeGas.isIncluded(jar3Compile)); + Assert.assertTrue(includeGas.isIncluded(war1Compile)); + Assert.assertTrue(includeGas.isIncluded(jar1Test)); + Assert.assertFalse(includeGas.isIncluded(jar4CompileOptional)); + + final ArtifactFilters excludeGas = ArtifactFilters.buidler() + .excludeGas("org\\.group1:artifact2", "org\\.group1:artifact3") + .build(); + Assert.assertTrue(excludeGas.isIncluded(jar1Compile)); + Assert.assertFalse(excludeGas.isIncluded(jar2Compile)); + Assert.assertFalse(excludeGas.isIncluded(jar3Compile)); + Assert.assertTrue(excludeGas.isIncluded(war1Compile)); + Assert.assertTrue(excludeGas.isIncluded(jar1Test)); + Assert.assertTrue(excludeGas.isIncluded(jar4CompileOptional)); + + final ArtifactFilters excludeGa = + ArtifactFilters.buidler().excludeGa("org\\.group1:artifact2").build(); + Assert.assertTrue(excludeGa.isIncluded(jar1Compile)); + Assert.assertFalse(excludeGa.isIncluded(jar2Compile)); + Assert.assertTrue(excludeGa.isIncluded(war1Compile)); + Assert.assertTrue(excludeGa.isIncluded(jar1Test)); + Assert.assertTrue(excludeGa.isIncluded(jar4CompileOptional)); + + final ArtifactFilters includeExcludeGas = ArtifactFilters.buidler() + .includeGa("org\\.group1:.*") + .excludeGa("org\\.group1:artifact3") + .build(); + Assert.assertTrue(includeExcludeGas.isIncluded(jar1Compile)); + Assert.assertTrue(includeExcludeGas.isIncluded(jar2Compile)); + Assert.assertFalse(includeExcludeGas.isIncluded(jar3Compile)); + Assert.assertTrue(includeExcludeGas.isIncluded(war1Compile)); + Assert.assertTrue(includeExcludeGas.isIncluded(jar1Test)); + Assert.assertTrue(includeExcludeGas.isIncluded(jar4CompileOptional)); + + final ArtifactFilters includeExcludeGasType = ArtifactFilters.buidler() + .includeGa("org\\.group1:.*") + .excludeGa("org\\.group1:artifact3") + .excludeType("war") + .build(); + Assert.assertTrue(includeExcludeGasType.isIncluded(jar1Compile)); + Assert.assertTrue(includeExcludeGasType.isIncluded(jar2Compile)); + Assert.assertFalse(includeExcludeGasType.isIncluded(jar3Compile)); + Assert.assertFalse(includeExcludeGasType.isIncluded(war1Compile)); + Assert.assertTrue(includeExcludeGasType.isIncluded(jar1Test)); + Assert.assertTrue(includeExcludeGasType.isIncluded(jar4CompileOptional)); + + final ArtifactFilters includeExcludeGasTypeScope = ArtifactFilters.buidler() + .includeGa("org\\.group1:.*") + .excludeGa("org\\.group1:artifact3") + .excludeType("war") + .excludeScope("test") + .build(); + Assert.assertTrue(includeExcludeGasTypeScope.isIncluded(jar1Compile)); + Assert.assertTrue(includeExcludeGasTypeScope.isIncluded(jar2Compile)); + Assert.assertFalse(includeExcludeGasTypeScope.isIncluded(jar3Compile)); + Assert.assertFalse(includeExcludeGasTypeScope.isIncluded(war1Compile)); + Assert.assertFalse(includeExcludeGasTypeScope.isIncluded(jar1Test)); + Assert.assertTrue(includeExcludeGasTypeScope.isIncluded(jar4CompileOptional)); + + final ArtifactFilters includeOptional = + ArtifactFilters.buidler().includeOptional(true).build(); + Assert.assertTrue(includeOptional.isIncluded(jar1Compile)); + Assert.assertTrue(includeOptional.isIncluded(jar2Compile)); + Assert.assertTrue(includeOptional.isIncluded(war1Compile)); + Assert.assertTrue(includeOptional.isIncluded(jar1Test)); + Assert.assertTrue(includeOptional.isIncluded(jar4CompileOptional)); + + final ArtifactFilters excludeOptional = + ArtifactFilters.buidler().includeOptional(false).build(); + Assert.assertTrue(excludeOptional.isIncluded(jar1Compile)); + Assert.assertTrue(excludeOptional.isIncluded(jar2Compile)); + Assert.assertTrue(excludeOptional.isIncluded(war1Compile)); + Assert.assertTrue(excludeOptional.isIncluded(jar1Test)); + Assert.assertFalse(excludeOptional.isIncluded(jar4CompileOptional)); } @Test - public void urlContent() - throws IOException, InvalidVersionSpecificationException - { + public void urlContent() throws IOException, InvalidVersionSpecificationException { final Builder builder = ArtifactFilters.buidler(); - final URL url = getClass().getClassLoader().getResource( "org/codehaus/mojo/license/api/atifact-filters.txt" ); - try (InputStream in = url.openStream()) - { - final String content = IOUtils.toString( in, StandardCharsets.UTF_8 ); - builder.script( "file:///path/to/my-file.txt", content ); + final URL url = getClass().getClassLoader().getResource("org/codehaus/mojo/license/api/atifact-filters.txt"); + try (InputStream in = url.openStream()) { + final String content = IOUtils.toString(in, StandardCharsets.UTF_8); + builder.script("file:///path/to/my-file.txt", content); } final ArtifactFilters filters = builder.build(); - final Artifact jar1Compile = - new DefaultArtifact( "org.group1", "artifact1", VersionRange.createFromVersionSpec( "1.0" ), "compile", - "jar", "", null ); - final Artifact jar2Compile = - new DefaultArtifact( "org.group1", "artifact2", VersionRange.createFromVersionSpec( "1.0" ), "compile", - "jar", "", null ); - final Artifact jar3Compile = - new DefaultArtifact( "org.group3", "artifact3", VersionRange.createFromVersionSpec( "1.0" ), "compile", - "jar", "", null ); - final Artifact war1Compile = - new DefaultArtifact( "org.group1", "artifact1", VersionRange.createFromVersionSpec( "1.0" ), "compile", - "war", "", null ); - final Artifact jar1Test = - new DefaultArtifact( "org.group1", "artifact1", VersionRange.createFromVersionSpec( "1.0" ), "test", "jar", - "", null ); - final Artifact jar4CompileOptional = - new DefaultArtifact( "org.group1", "artifact4", VersionRange.createFromVersionSpec( "1.0" ), "compile", - "jar", "", null ); - jar4CompileOptional.setOptional( false ); - - Assert.assertTrue( filters.isIncluded( jar1Compile ) ); - Assert.assertFalse( filters.isIncluded( jar2Compile ) ); - Assert.assertFalse( filters.isIncluded( jar3Compile ) ); - Assert.assertFalse( filters.isIncluded( war1Compile ) ); - Assert.assertFalse( filters.isIncluded( jar1Test ) ); - Assert.assertFalse( filters.isIncluded( jar4CompileOptional ) ); + final Artifact jar1Compile = new DefaultArtifact( + "org.group1", "artifact1", VersionRange.createFromVersionSpec("1.0"), "compile", "jar", "", null); + final Artifact jar2Compile = new DefaultArtifact( + "org.group1", "artifact2", VersionRange.createFromVersionSpec("1.0"), "compile", "jar", "", null); + final Artifact jar3Compile = new DefaultArtifact( + "org.group3", "artifact3", VersionRange.createFromVersionSpec("1.0"), "compile", "jar", "", null); + final Artifact war1Compile = new DefaultArtifact( + "org.group1", "artifact1", VersionRange.createFromVersionSpec("1.0"), "compile", "war", "", null); + final Artifact jar1Test = new DefaultArtifact( + "org.group1", "artifact1", VersionRange.createFromVersionSpec("1.0"), "test", "jar", "", null); + final Artifact jar4CompileOptional = new DefaultArtifact( + "org.group1", "artifact4", VersionRange.createFromVersionSpec("1.0"), "compile", "jar", "", null); + jar4CompileOptional.setOptional(false); + + Assert.assertTrue(filters.isIncluded(jar1Compile)); + Assert.assertFalse(filters.isIncluded(jar2Compile)); + Assert.assertFalse(filters.isIncluded(jar3Compile)); + Assert.assertFalse(filters.isIncluded(war1Compile)); + Assert.assertFalse(filters.isIncluded(jar1Test)); + Assert.assertFalse(filters.isIncluded(jar4CompileOptional)); } - } diff --git a/src/test/java/org/codehaus/mojo/license/api/FreeMarkerHelperTest.java b/src/test/java/org/codehaus/mojo/license/api/FreeMarkerHelperTest.java index 7f285c95f..505c4299c 100644 --- a/src/test/java/org/codehaus/mojo/license/api/FreeMarkerHelperTest.java +++ b/src/test/java/org/codehaus/mojo/license/api/FreeMarkerHelperTest.java @@ -40,106 +40,122 @@ * @author tchemit dev@tchemit.fr * @since 1.1 */ -public class FreeMarkerHelperTest -{ +public class FreeMarkerHelperTest { private static final Logger LOG = LoggerFactory.getLogger(FreeMarkerHelperTest.class); @Test - public void testRenderTemplateForThirdPartyFile() - throws Exception - { + public void testRenderTemplateForThirdPartyFile() throws Exception { FreeMarkerHelper helper = FreeMarkerHelper.newDefaultHelper(); LicenseMap licenseMap = new LicenseMap(); MavenProject deps = new MavenProject(); - deps.setArtifact( - new DefaultArtifact( "groupId", "artifactId", VersionRange.createFromVersionSpec( "0" ), "compile", "type", - "classifier", null ) ); - deps.setGroupId( "groupId" ); - deps.setArtifactId( "artifactId" ); - deps.setVersion( "version" ); - deps.setUrl( "url" ); + deps.setArtifact(new DefaultArtifact( + "groupId", + "artifactId", + VersionRange.createFromVersionSpec("0"), + "compile", + "type", + "classifier", + null)); + deps.setGroupId("groupId"); + deps.setArtifactId("artifactId"); + deps.setVersion("version"); + deps.setUrl("url"); MavenProject deps2 = new MavenProject(); - deps2.setArtifact( - new DefaultArtifact( "groupId2", "artifactId2", VersionRange.createFromVersionSpec( "2" ), "compile", - "type", "classifier", null ) ); - deps2.setGroupId( "groupId2" ); - deps2.setArtifactId( "artifactId2" ); - deps2.setVersion( "version2" ); - licenseMap.put( "license 1", deps ); - licenseMap.put( "license 1", deps2 ); - licenseMap.put( "license 2", deps2 ); + deps2.setArtifact(new DefaultArtifact( + "groupId2", + "artifactId2", + VersionRange.createFromVersionSpec("2"), + "compile", + "type", + "classifier", + null)); + deps2.setGroupId("groupId2"); + deps2.setArtifactId("artifactId2"); + deps2.setVersion("version2"); + licenseMap.put("license 1", deps); + licenseMap.put("license 1", deps2); + licenseMap.put("license 2", deps2); Map properties = new HashMap<>(); - properties.put( "licenseMap", licenseMap.entrySet() ); - properties.put( "dependencyMap", licenseMap.toDependencyMap().entrySet() ); + properties.put("licenseMap", licenseMap.entrySet()); + properties.put("dependencyMap", licenseMap.toDependencyMap().entrySet()); - String s = helper.renderTemplate( "/org/codehaus/mojo/license/third-party-file.ftl", properties ); - LOG.info( "{}", s ); + String s = helper.renderTemplate("/org/codehaus/mojo/license/third-party-file.ftl", properties); + LOG.info("{}", s); } @Test - public void testRenderTemplateForThirdPartyFileGroupByLicense() - throws Exception - { + public void testRenderTemplateForThirdPartyFileGroupByLicense() throws Exception { FreeMarkerHelper helper = FreeMarkerHelper.newDefaultHelper(); LicenseMap licenseMap = new LicenseMap(); MavenProject deps = new MavenProject(); - deps.setArtifact( - new DefaultArtifact( "groupId", "artifactId", VersionRange.createFromVersionSpec( "0" ), "compile", "type", - "classifier", null ) ); - deps.setGroupId( "groupId" ); - deps.setArtifactId( "artifactId" ); - deps.setVersion( "version" ); + deps.setArtifact(new DefaultArtifact( + "groupId", + "artifactId", + VersionRange.createFromVersionSpec("0"), + "compile", + "type", + "classifier", + null)); + deps.setGroupId("groupId"); + deps.setArtifactId("artifactId"); + deps.setVersion("version"); MavenProject deps2 = new MavenProject(); - deps2.setArtifact( - new DefaultArtifact( "groupId2", "artifactId2", VersionRange.createFromVersionSpec( "2" ), "compile", - "type", "classifier", null ) ); - deps2.setGroupId( "groupId2" ); - deps2.setArtifactId( "artifactId2" ); - deps2.setVersion( "version2" ); - deps2.setUrl( "url2" ); - licenseMap.put( "license 1", deps ); - licenseMap.put( "license 1", deps2 ); - licenseMap.put( "license 2", deps2 ); + deps2.setArtifact(new DefaultArtifact( + "groupId2", + "artifactId2", + VersionRange.createFromVersionSpec("2"), + "compile", + "type", + "classifier", + null)); + deps2.setGroupId("groupId2"); + deps2.setArtifactId("artifactId2"); + deps2.setVersion("version2"); + deps2.setUrl("url2"); + licenseMap.put("license 1", deps); + licenseMap.put("license 1", deps2); + licenseMap.put("license 2", deps2); Map properties = new HashMap<>(); - properties.put( "licenseMap", licenseMap.entrySet() ); - properties.put( "dependencyMap", licenseMap.toDependencyMap().entrySet() ); + properties.put("licenseMap", licenseMap.entrySet()); + properties.put("dependencyMap", licenseMap.toDependencyMap().entrySet()); - String s = - helper.renderTemplate( "/org/codehaus/mojo/license/third-party-file-groupByLicense.ftl", properties ); - LOG.info( "{}", s ); + String s = helper.renderTemplate("/org/codehaus/mojo/license/third-party-file-groupByLicense.ftl", properties); + LOG.info("{}", s); } @Test - public void testRenderTemplateForUpdateFileHeader() - throws Exception - { + public void testRenderTemplateForUpdateFileHeader() throws Exception { FreeMarkerHelper helper = FreeMarkerHelper.newDefaultHelper(); MavenProject project = new MavenProject(); - project.setArtifact( - new DefaultArtifact( "groupId", "artifactId", VersionRange.createFromVersionSpec( "0" ), "compile", "type", - "classifier", null ) ); - project.setGroupId( "groupId" ); - project.setArtifactId( "artifactId" ); - project.setVersion( "version" ); + project.setArtifact(new DefaultArtifact( + "groupId", + "artifactId", + VersionRange.createFromVersionSpec("0"), + "compile", + "type", + "classifier", + null)); + project.setGroupId("groupId"); + project.setArtifactId("artifactId"); + project.setVersion("version"); Map properties = new HashMap<>(); - properties.put( "project", project ); - properties.put( "projectName", "projectName" ); - properties.put( "inceptionYear", "inceptionYear" ); - properties.put( "organizationName", "organizationName" ); - properties.put( "addSvnKeyWords", true ); - - String s = - helper.renderTemplate( "/org/codehaus/mojo/license/default-file-header-description.ftl", properties ); - Assert.assertEquals( "projectName\n$Id:$\n$HeadURL:$", s ); - LOG.info( "{}", s ); + properties.put("project", project); + properties.put("projectName", "projectName"); + properties.put("inceptionYear", "inceptionYear"); + properties.put("organizationName", "organizationName"); + properties.put("addSvnKeyWords", true); + + String s = helper.renderTemplate("/org/codehaus/mojo/license/default-file-header-description.ftl", properties); + Assert.assertEquals("projectName\n$Id:$\n$HeadURL:$", s); + LOG.info("{}", s); } } diff --git a/src/test/java/org/codehaus/mojo/license/download/LicenseDownloaderTest.java b/src/test/java/org/codehaus/mojo/license/download/LicenseDownloaderTest.java index a93b918ee..9b566a149 100644 --- a/src/test/java/org/codehaus/mojo/license/download/LicenseDownloaderTest.java +++ b/src/test/java/org/codehaus/mojo/license/download/LicenseDownloaderTest.java @@ -27,20 +27,17 @@ import org.junit.Assert; import org.junit.Test; -public class LicenseDownloaderTest -{ +public class LicenseDownloaderTest { @Test public void updateFileExtension() { - assertExtension( "path/to/file.html", "path/to/file.php", "text/html" ); - assertExtension( "path/to/file.txt", "path/to/file", null ); + assertExtension("path/to/file.html", "path/to/file.php", "text/html"); + assertExtension("path/to/file.txt", "path/to/file", null); } - private static void assertExtension( String expected, String input, String mimeType ) - { - final File in = new File( input ); - final File result = LicenseDownloader.updateFileExtension( in, mimeType ); - Assert.assertEquals( expected, result.getPath().replace( '\\', '/' ) ); + private static void assertExtension(String expected, String input, String mimeType) { + final File in = new File(input); + final File result = LicenseDownloader.updateFileExtension(in, mimeType); + Assert.assertEquals(expected, result.getPath().replace('\\', '/')); } - } diff --git a/src/test/java/org/codehaus/mojo/license/download/LicenseMatchersTest.java b/src/test/java/org/codehaus/mojo/license/download/LicenseMatchersTest.java index b08ad9d44..ba18673ad 100644 --- a/src/test/java/org/codehaus/mojo/license/download/LicenseMatchersTest.java +++ b/src/test/java/org/codehaus/mojo/license/download/LicenseMatchersTest.java @@ -29,131 +29,122 @@ import org.junit.Assert; import org.junit.Test; -public class LicenseMatchersTest -{ +public class LicenseMatchersTest { @Test - public void licenseMatches() - { - final LicenseMatcher lm1 = new LicenseMatcher( "my license", "http://some.com", null, "important comment" ); - final ProjectLicense lic = - new ProjectLicense( "my license", "http://some.com", null, "important comment", null ); - - Assert.assertTrue( lm1.matches( lic ) ); - lic.setName( "other license" ); - Assert.assertFalse( lm1.matches( lic ) ); - - final LicenseMatcher lm2 = new LicenseMatcher( "other.*", "http://some.com", null, "important comment" ); - Assert.assertTrue( lm2.matches( lic ) ); - lic.setUrl( "http://other.org" ); - Assert.assertFalse( lm2.matches( lic ) ); - - final LicenseMatcher lm3 = new LicenseMatcher( "other.*", "http://other\\..*", null, "important comment" ); - Assert.assertTrue( lm3.matches( lic ) ); - lic.setComments( "other comment" ); - Assert.assertFalse( lm3.matches( lic ) ); - - final LicenseMatcher lm4 = new LicenseMatcher( "other.*", "http://other\\..*", null, ".*comment" ); - Assert.assertTrue( lm4.matches( lic ) ); - - - lic.setComments( null ); - lic.setDistribution( null ); - lic.setFile( null ); - lic.setName( null ); - lic.setUrl( null ); - final LicenseMatcher lm5 = new LicenseMatcher( (String) null, (String) null, (String) null, (String) null ); - Assert.assertTrue( lm5.matches( lic ) ); - - lic.setComments( "" ); - lic.setDistribution( "" ); - lic.setFile( "" ); - lic.setName( "" ); - lic.setUrl( "" ); - Assert.assertTrue( lm5.matches( lic ) ); - + public void licenseMatches() { + final LicenseMatcher lm1 = new LicenseMatcher("my license", "http://some.com", null, "important comment"); + final ProjectLicense lic = new ProjectLicense("my license", "http://some.com", null, "important comment", null); + + Assert.assertTrue(lm1.matches(lic)); + lic.setName("other license"); + Assert.assertFalse(lm1.matches(lic)); + + final LicenseMatcher lm2 = new LicenseMatcher("other.*", "http://some.com", null, "important comment"); + Assert.assertTrue(lm2.matches(lic)); + lic.setUrl("http://other.org"); + Assert.assertFalse(lm2.matches(lic)); + + final LicenseMatcher lm3 = new LicenseMatcher("other.*", "http://other\\..*", null, "important comment"); + Assert.assertTrue(lm3.matches(lic)); + lic.setComments("other comment"); + Assert.assertFalse(lm3.matches(lic)); + + final LicenseMatcher lm4 = new LicenseMatcher("other.*", "http://other\\..*", null, ".*comment"); + Assert.assertTrue(lm4.matches(lic)); + + lic.setComments(null); + lic.setDistribution(null); + lic.setFile(null); + lic.setName(null); + lic.setUrl(null); + final LicenseMatcher lm5 = new LicenseMatcher((String) null, (String) null, (String) null, (String) null); + Assert.assertTrue(lm5.matches(lic)); + + lic.setComments(""); + lic.setDistribution(""); + lic.setFile(""); + lic.setName(""); + lic.setUrl(""); + Assert.assertTrue(lm5.matches(lic)); } @Test - public void replaceMatchesLegacy() - { - final ProjectLicenseInfo dep = new ProjectLicenseInfo( "myGroup", "myArtifact", "1a2.3" ); - final ProjectLicenseInfo pli1 = new ProjectLicenseInfo( "myGroup", "myArtifact", "1.2.3", false ); + public void replaceMatchesLegacy() { + final ProjectLicenseInfo dep = new ProjectLicenseInfo("myGroup", "myArtifact", "1a2.3"); + final ProjectLicenseInfo pli1 = new ProjectLicenseInfo("myGroup", "myArtifact", "1.2.3", false); final ProjectLicense lic2 = new ProjectLicense("lic2", "http://other.org", null, "other comment", null); - pli1.addLicense( lic2 ); - final DependencyMatcher m1 = DependencyMatcher.of( pli1 ); - Assert.assertTrue( m1.matches( dep ) ); // legacy mode disregards the version - dep.setVersion( "1.2.3" ); - Assert.assertTrue( m1.matches( dep ) ); - - dep.addLicense( new ProjectLicense( "lic1", "http://some.org", null, "comment", null ) ); - Assert.assertTrue( m1.matches( dep ) ); - final LicenseMatchers matchers1 = LicenseMatchers.builder().matcher( m1 ).build(); - matchers1.replaceMatches( dep ); - Assert.assertEquals( 1, dep.getLicenses().size() ); - Assert.assertEquals( lic2, dep.getLicenses().get( 0 ) ); - Assert.assertNotSame( lic2, dep.getLicenses().get( 0 ) ); + pli1.addLicense(lic2); + final DependencyMatcher m1 = DependencyMatcher.of(pli1); + Assert.assertTrue(m1.matches(dep)); // legacy mode disregards the version + dep.setVersion("1.2.3"); + Assert.assertTrue(m1.matches(dep)); + + dep.addLicense(new ProjectLicense("lic1", "http://some.org", null, "comment", null)); + Assert.assertTrue(m1.matches(dep)); + final LicenseMatchers matchers1 = LicenseMatchers.builder().matcher(m1).build(); + matchers1.replaceMatches(dep); + Assert.assertEquals(1, dep.getLicenses().size()); + Assert.assertEquals(lic2, dep.getLicenses().get(0)); + Assert.assertNotSame(lic2, dep.getLicenses().get(0)); } @Test - public void replaceMatches() - { + public void replaceMatches() { - final ProjectLicenseInfo dep = new ProjectLicenseInfo( "myGroup", "myArtifact", "1.2.3" ); - final DependencyMatcher m0 = - DependencyMatcher.of( new ProjectLicenseInfo( "myGroup", "myArtifact", null, true ) ); - Assert.assertTrue( m0.matches( dep ) ); + final ProjectLicenseInfo dep = new ProjectLicenseInfo("myGroup", "myArtifact", "1.2.3"); + final DependencyMatcher m0 = DependencyMatcher.of(new ProjectLicenseInfo("myGroup", "myArtifact", null, true)); + Assert.assertTrue(m0.matches(dep)); final DependencyMatcher m1 = - DependencyMatcher.of( new ProjectLicenseInfo( "myGroup", "myArtifact", "1\\.2\\.3", true ) ); - Assert.assertTrue( m1.matches( dep ) ); - dep.setGroupId( "otherGroup" ); - Assert.assertFalse( m1.matches( dep ) ); + DependencyMatcher.of(new ProjectLicenseInfo("myGroup", "myArtifact", "1\\.2\\.3", true)); + Assert.assertTrue(m1.matches(dep)); + dep.setGroupId("otherGroup"); + Assert.assertFalse(m1.matches(dep)); final DependencyMatcher m2 = - DependencyMatcher.of( new ProjectLicenseInfo( "other.*", "myArtifact", "1\\.2\\.3", true ) ); - Assert.assertTrue( m2.matches( dep ) ); - dep.setArtifactId( "otherArtifact" ); - Assert.assertFalse( m2.matches( dep ) ); + DependencyMatcher.of(new ProjectLicenseInfo("other.*", "myArtifact", "1\\.2\\.3", true)); + Assert.assertTrue(m2.matches(dep)); + dep.setArtifactId("otherArtifact"); + Assert.assertFalse(m2.matches(dep)); final DependencyMatcher m3 = - DependencyMatcher.of( new ProjectLicenseInfo( "other.*", ".*Artifact", "1\\.2\\.3", true ) ); - Assert.assertTrue( m3.matches( dep ) ); - dep.setVersion( "2.2.2" ); - Assert.assertFalse( m3.matches( dep ) ); + DependencyMatcher.of(new ProjectLicenseInfo("other.*", ".*Artifact", "1\\.2\\.3", true)); + Assert.assertTrue(m3.matches(dep)); + dep.setVersion("2.2.2"); + Assert.assertFalse(m3.matches(dep)); final DependencyMatcher m4 = - DependencyMatcher.of( new ProjectLicenseInfo( "other.*", ".*Artifact", "2\\.2\\..*", true ) ); - Assert.assertTrue( m4.matches( dep ) ); + DependencyMatcher.of(new ProjectLicenseInfo("other.*", ".*Artifact", "2\\.2\\..*", true)); + Assert.assertTrue(m4.matches(dep)); - final LicenseMatchers matchers1 = LicenseMatchers.builder().matcher( m1 ).build(); + final LicenseMatchers matchers1 = LicenseMatchers.builder().matcher(m1).build(); final List oldLics = dep.cloneLicenses(); - matchers1.replaceMatches( dep ); - Assert.assertEquals( oldLics, dep.getLicenses() ); + matchers1.replaceMatches(dep); + Assert.assertEquals(oldLics, dep.getLicenses()); - dep.addLicense( new ProjectLicense( "lic1", "http://some.org", null, "comment", null ) ); - Assert.assertFalse( m1.matches( dep ) ); + dep.addLicense(new ProjectLicense("lic1", "http://some.org", null, "comment", null)); + Assert.assertFalse(m1.matches(dep)); - final ProjectLicenseInfo dep11 = new ProjectLicenseInfo( "myGroup", "myArtifact", "1.2.3" ); - dep11.addLicense( new ProjectLicense( "lic1", "http://some.org", null, "comment", null ) ); + final ProjectLicenseInfo dep11 = new ProjectLicenseInfo("myGroup", "myArtifact", "1.2.3"); + dep11.addLicense(new ProjectLicense("lic1", "http://some.org", null, "comment", null)); final List oldLics11 = dep.cloneLicenses(); - final ProjectLicenseInfo pli11 = new ProjectLicenseInfo( "myGroup", "myArtifact", "1\\.2\\.3", true ); - pli11.addMatchLicense( new ProjectLicense( "lic1", "http://some\\.org", null, "comment", null ) ); - pli11.addLicense( new ProjectLicense( "lic2", "http://other.org", null, "other comment", null ) ); - final DependencyMatcher m11 = DependencyMatcher.of( pli11 ); - Assert.assertTrue( m11.matches( dep11 ) ); + final ProjectLicenseInfo pli11 = new ProjectLicenseInfo("myGroup", "myArtifact", "1\\.2\\.3", true); + pli11.addMatchLicense(new ProjectLicense("lic1", "http://some\\.org", null, "comment", null)); + pli11.addLicense(new ProjectLicense("lic2", "http://other.org", null, "other comment", null)); + final DependencyMatcher m11 = DependencyMatcher.of(pli11); + Assert.assertTrue(m11.matches(dep11)); - Assert.assertEquals( oldLics11, dep11.getLicenses() ); + Assert.assertEquals(oldLics11, dep11.getLicenses()); - final LicenseMatchers matchers11 = LicenseMatchers.builder().matcher( m11 ).build(); - matchers11.replaceMatches( dep11 ); + final LicenseMatchers matchers11 = + LicenseMatchers.builder().matcher(m11).build(); + matchers11.replaceMatches(dep11); - Assert.assertNotEquals( oldLics11, dep11.getLicenses() ); + Assert.assertNotEquals(oldLics11, dep11.getLicenses()); final List newLics = dep11.getLicenses(); - Assert.assertEquals( 1, newLics.size() ); - Assert.assertEquals( 1, newLics.size() ); - + Assert.assertEquals(1, newLics.size()); + Assert.assertEquals(1, newLics.size()); } - } diff --git a/src/test/java/org/codehaus/mojo/license/download/LicenseSummaryTest.java b/src/test/java/org/codehaus/mojo/license/download/LicenseSummaryTest.java index 058e922f2..98f20d9a4 100644 --- a/src/test/java/org/codehaus/mojo/license/download/LicenseSummaryTest.java +++ b/src/test/java/org/codehaus/mojo/license/download/LicenseSummaryTest.java @@ -1,15 +1,9 @@ package org.codehaus.mojo.license.download; -import org.codehaus.mojo.license.Eol; -import org.codehaus.mojo.license.download.LicenseSummaryReader; -import org.codehaus.mojo.license.download.LicenseSummaryWriter; -import org.junit.Assert; -import org.junit.Test; -import org.xml.sax.SAXException; - import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactoryConfigurationError; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -17,11 +11,15 @@ import java.util.ArrayList; import java.util.List; +import org.codehaus.mojo.license.Eol; +import org.junit.Assert; +import org.junit.Test; +import org.xml.sax.SAXException; + /** * @since 1.0 */ -public class LicenseSummaryTest -{ +public class LicenseSummaryTest { /** * Test reading the license summary xml file into ProjectLicenseInfo objects @@ -31,27 +29,24 @@ public class LicenseSummaryTest * @throws SAXException if any */ @Test - public void testReadLicenseSummary() - throws IOException, SAXException, ParserConfigurationException - { - File licenseSummaryFile = new File( "src/test/resources/license-summary-test.xml" ); - Assert.assertTrue( licenseSummaryFile.exists() ); - FileInputStream fis = new FileInputStream( licenseSummaryFile ); - List list = LicenseSummaryReader.parseLicenseSummary( fis ); + public void testReadLicenseSummary() throws IOException, SAXException, ParserConfigurationException { + File licenseSummaryFile = new File("src/test/resources/license-summary-test.xml"); + Assert.assertTrue(licenseSummaryFile.exists()); + FileInputStream fis = new FileInputStream(licenseSummaryFile); + List list = LicenseSummaryReader.parseLicenseSummary(fis); fis.close(); - ProjectLicenseInfo dep = list.get( 0 ); - Assert.assertEquals( "org.codehaus.mojo", dep.getGroupId() ); - Assert.assertEquals( "junk", dep.getArtifactId() ); - Assert.assertEquals( "1.1", dep.getVersion() ); + ProjectLicenseInfo dep = list.get(0); + Assert.assertEquals("org.codehaus.mojo", dep.getGroupId()); + Assert.assertEquals("junk", dep.getArtifactId()); + Assert.assertEquals("1.1", dep.getVersion()); List licenses = dep.getLicenses(); - Assert.assertEquals( 1, licenses.size() ); + Assert.assertEquals(1, licenses.size()); ProjectLicense lic0 = dep.getLicenses().get(0); - Assert.assertEquals( "lgpl", lic0.getName() ); - Assert.assertEquals( "http://www.gnu.org/licenses/lgpl-3.0.txt", lic0.getUrl() ); - Assert.assertEquals( "lgpl-3.0.txt", lic0.getFile() ); - Assert.assertEquals( "lgpl version 3.0", lic0.getComments() ); - + Assert.assertEquals("lgpl", lic0.getName()); + Assert.assertEquals("http://www.gnu.org/licenses/lgpl-3.0.txt", lic0.getUrl()); + Assert.assertEquals("lgpl-3.0.txt", lic0.getFile()); + Assert.assertEquals("lgpl version 3.0", lic0.getComments()); } /** @@ -66,79 +61,76 @@ public void testReadLicenseSummary() */ @Test public void testWriteReadLicenseSummary() - throws IOException, SAXException, ParserConfigurationException, TransformerFactoryConfigurationError, - TransformerException - { + throws IOException, SAXException, ParserConfigurationException, TransformerFactoryConfigurationError, + TransformerException { List licSummary = new ArrayList<>(); - ProjectLicenseInfo dep1 = new ProjectLicenseInfo( "org.test", "test1", "1.0" ); - ProjectLicenseInfo dep2 = new ProjectLicenseInfo( "org.test", "test2", "2.0" ); + ProjectLicenseInfo dep1 = new ProjectLicenseInfo("org.test", "test1", "1.0"); + ProjectLicenseInfo dep2 = new ProjectLicenseInfo("org.test", "test2", "2.0"); ProjectLicense lic = new ProjectLicense(); - lic.setName( "lgpl" ); - lic.setUrl( "http://www.gnu.org/licenses/lgpl-3.0.txt" ); - lic.setFile( "lgpl-3.0.txt" ); - lic.setComments( "lgpl version 3.0" ); - dep1.addLicense( lic ); - dep2.addLicense( lic ); + lic.setName("lgpl"); + lic.setUrl("http://www.gnu.org/licenses/lgpl-3.0.txt"); + lic.setFile("lgpl-3.0.txt"); + lic.setComments("lgpl version 3.0"); + dep1.addLicense(lic); + dep2.addLicense(lic); - licSummary.add( dep1 ); - licSummary.add( dep2 ); + licSummary.add(dep1); + licSummary.add(dep2); { - File licenseSummaryFile = File.createTempFile( "licSummary", "tmp" ); - LicenseSummaryWriter.writeLicenseSummary( licSummary, licenseSummaryFile, StandardCharsets.UTF_8, Eol.LF, - true ); + File licenseSummaryFile = File.createTempFile("licSummary", "tmp"); + LicenseSummaryWriter.writeLicenseSummary( + licSummary, licenseSummaryFile, StandardCharsets.UTF_8, Eol.LF, true); - Assert.assertTrue( licenseSummaryFile.exists() ); - FileInputStream fis = new FileInputStream( licenseSummaryFile ); - List list = LicenseSummaryReader.parseLicenseSummary( fis ); + Assert.assertTrue(licenseSummaryFile.exists()); + FileInputStream fis = new FileInputStream(licenseSummaryFile); + List list = LicenseSummaryReader.parseLicenseSummary(fis); fis.close(); - ProjectLicenseInfo dep = list.get( 0 ); - Assert.assertEquals( "org.test", dep.getGroupId() ); - Assert.assertEquals( "test1", dep.getArtifactId() ); - Assert.assertEquals( "1.0", dep.getVersion() ); + ProjectLicenseInfo dep = list.get(0); + Assert.assertEquals("org.test", dep.getGroupId()); + Assert.assertEquals("test1", dep.getArtifactId()); + Assert.assertEquals("1.0", dep.getVersion()); List licenses = dep.getLicenses(); - Assert.assertEquals( 1, licenses.size() ); + Assert.assertEquals(1, licenses.size()); ProjectLicense lic0 = dep.getLicenses().get(0); - Assert.assertEquals( "lgpl", lic0.getName() ); - Assert.assertEquals( "http://www.gnu.org/licenses/lgpl-3.0.txt", lic0.getUrl() ); - Assert.assertEquals( "lgpl-3.0.txt", lic0.getFile() ); - Assert.assertEquals( "lgpl version 3.0", lic0.getComments() ); + Assert.assertEquals("lgpl", lic0.getName()); + Assert.assertEquals("http://www.gnu.org/licenses/lgpl-3.0.txt", lic0.getUrl()); + Assert.assertEquals("lgpl-3.0.txt", lic0.getFile()); + Assert.assertEquals("lgpl version 3.0", lic0.getComments()); } { - File licenseSummaryFile = File.createTempFile( "licSummaryNoVersion", "tmp" ); - LicenseSummaryWriter.writeLicenseSummary( licSummary, licenseSummaryFile, StandardCharsets.UTF_8, Eol.LF, - false ); + File licenseSummaryFile = File.createTempFile("licSummaryNoVersion", "tmp"); + LicenseSummaryWriter.writeLicenseSummary( + licSummary, licenseSummaryFile, StandardCharsets.UTF_8, Eol.LF, false); - Assert.assertTrue( licenseSummaryFile.exists() ); - FileInputStream fis = new FileInputStream( licenseSummaryFile ); - List list = LicenseSummaryReader.parseLicenseSummary( fis ); + Assert.assertTrue(licenseSummaryFile.exists()); + FileInputStream fis = new FileInputStream(licenseSummaryFile); + List list = LicenseSummaryReader.parseLicenseSummary(fis); fis.close(); - ProjectLicenseInfo dep = list.get( 0 ); - Assert.assertEquals( "org.test", dep.getGroupId() ); - Assert.assertEquals( "test1", dep.getArtifactId() ); - Assert.assertNull( dep.getVersion() ); + ProjectLicenseInfo dep = list.get(0); + Assert.assertEquals("org.test", dep.getGroupId()); + Assert.assertEquals("test1", dep.getArtifactId()); + Assert.assertNull(dep.getVersion()); List licenses = dep.getLicenses(); - Assert.assertEquals( 1, licenses.size() ); + Assert.assertEquals(1, licenses.size()); ProjectLicense lic0 = dep.getLicenses().get(0); - Assert.assertEquals( "lgpl", lic0.getName() ); - Assert.assertEquals( "http://www.gnu.org/licenses/lgpl-3.0.txt", lic0.getUrl() ); - Assert.assertEquals( "lgpl-3.0.txt", lic0.getFile() ); - Assert.assertEquals( "lgpl version 3.0", lic0.getComments() ); + Assert.assertEquals("lgpl", lic0.getName()); + Assert.assertEquals("http://www.gnu.org/licenses/lgpl-3.0.txt", lic0.getUrl()); + Assert.assertEquals("lgpl-3.0.txt", lic0.getFile()); + Assert.assertEquals("lgpl version 3.0", lic0.getComments()); } - } @Test - public void patternOrText() - { - Assert.assertEquals( "\\Qsimple\\E", LicenseSummaryWriter.patternOrText( "simple", true ) ); - Assert.assertEquals( "\\Qone two\\E", LicenseSummaryWriter.patternOrText( "one two", true ) ); - Assert.assertEquals( "\\Qone\\E\\s+\\Qtwo\\E", LicenseSummaryWriter.patternOrText( "one two", true ) ); - Assert.assertEquals( "\\Qone\ntwo\\E", LicenseSummaryWriter.patternOrText( "one\ntwo", true ) ); - Assert.assertEquals( "\\Qone\\E\\s+\\Qtwo\\E", LicenseSummaryWriter.patternOrText( "one\n\t\ttwo", true ) ); + public void patternOrText() { + Assert.assertEquals("\\Qsimple\\E", LicenseSummaryWriter.patternOrText("simple", true)); + Assert.assertEquals("\\Qone two\\E", LicenseSummaryWriter.patternOrText("one two", true)); + Assert.assertEquals("\\Qone\\E\\s+\\Qtwo\\E", LicenseSummaryWriter.patternOrText("one two", true)); + Assert.assertEquals("\\Qone\ntwo\\E", LicenseSummaryWriter.patternOrText("one\ntwo", true)); + Assert.assertEquals("\\Qone\\E\\s+\\Qtwo\\E", LicenseSummaryWriter.patternOrText("one\n\t\ttwo", true)); } } diff --git a/src/test/java/org/codehaus/mojo/license/header/transformer/AbstractFileHeaderTransformerTest.java b/src/test/java/org/codehaus/mojo/license/header/transformer/AbstractFileHeaderTransformerTest.java index 201125a94..0d163f972 100644 --- a/src/test/java/org/codehaus/mojo/license/header/transformer/AbstractFileHeaderTransformerTest.java +++ b/src/test/java/org/codehaus/mojo/license/header/transformer/AbstractFileHeaderTransformerTest.java @@ -22,6 +22,8 @@ * #L% */ +import java.util.regex.Matcher; + import org.codehaus.mojo.license.header.FileHeader; import org.codehaus.mojo.license.model.Copyright; import org.junit.After; @@ -29,8 +31,6 @@ import org.junit.Before; import org.junit.Test; -import java.util.regex.Matcher; - import static org.codehaus.mojo.license.header.transformer.AbstractFileHeaderTransformer.COPYRIGHT_PATTERN; import static org.codehaus.mojo.license.header.transformer.FileHeaderTransformer.*; @@ -40,74 +40,58 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class AbstractFileHeaderTransformerTest -{ +public class AbstractFileHeaderTransformerTest { FileHeaderTransformer transformer; FileHeader model1, model2; @Before - public void setUp() - throws Exception - { + public void setUp() throws Exception { transformer = new JavaFileHeaderTransformer(); model1 = new FileHeader(); - model1.setDescription( "Description" ); - model1.setCopyright( Copyright.newCopyright( 2010, null, "Tony" ) ); - model1.setLicense( "License" ); + model1.setDescription("Description"); + model1.setCopyright(Copyright.newCopyright(2010, null, "Tony")); + model1.setLicense("License"); model2 = new FileHeader(); - model2.setDescription( "Description2" ); - model2.setCopyright( Copyright.newCopyright( 2010, 2012, "Tony2" ) ); - model2.setLicense( "License2" ); + model2.setDescription("Description2"); + model2.setCopyright(Copyright.newCopyright(2010, 2012, "Tony2")); + model2.setLicense("License2"); } @After - public void tearDown() - throws Exception - { + public void tearDown() throws Exception { transformer = null; model1 = null; model2 = null; } + @Test(expected = IllegalStateException.class) + public void testIllegalTransformer() throws Exception { - @Test( expected = IllegalStateException.class ) - public void testIllegalTransformer() - throws Exception - { - - new AbstractFileHeaderTransformer( "name", "description", "commentPrefix", "commentEndtag", "commentPrefix" ) - { + new AbstractFileHeaderTransformer("name", "description", "commentPrefix", "commentEndtag", "commentPrefix") { - public String[] getDefaultAcceptedExtensions() - { - return new String[]{ getName() }; + public String[] getDefaultAcceptedExtensions() { + return new String[] {getName()}; } }; } - @Test( expected = IllegalStateException.class ) - public void testIllegalTransformer2() - throws Exception - { + @Test(expected = IllegalStateException.class) + public void testIllegalTransformer2() throws Exception { - new AbstractFileHeaderTransformer( "name", "description", "commentstartTag", "commentPrefix", "commentPrefix" ) - { + new AbstractFileHeaderTransformer("name", "description", "commentstartTag", "commentPrefix", "commentPrefix") { - public String[] getDefaultAcceptedExtensions() - { - return new String[]{ getName() }; + public String[] getDefaultAcceptedExtensions() { + return new String[] {getName()}; } }; } @Test - public void testCopyrightPattern() - throws Exception - { + public void testCopyrightPattern() throws Exception { String actual; Matcher matcher; String prefix; @@ -116,209 +100,209 @@ public void testCopyrightPattern() String holder; actual = "Copyright (C) 2010 Tony"; - matcher = COPYRIGHT_PATTERN.matcher( actual ); - Assert.assertTrue( matcher.matches() ); - Assert.assertEquals( 5, matcher.groupCount() ); - prefix = matcher.group( 1 ); - Assert.assertEquals( "Copyright (C)", prefix ); - firstYear = matcher.group( 2 ); - Assert.assertEquals( "2010", firstYear ); - lastYear = matcher.group( 4 ); - Assert.assertEquals( null, lastYear ); - holder = matcher.group( 5 ); - Assert.assertEquals( "Tony", holder ); + matcher = COPYRIGHT_PATTERN.matcher(actual); + Assert.assertTrue(matcher.matches()); + Assert.assertEquals(5, matcher.groupCount()); + prefix = matcher.group(1); + Assert.assertEquals("Copyright (C)", prefix); + firstYear = matcher.group(2); + Assert.assertEquals("2010", firstYear); + lastYear = matcher.group(4); + Assert.assertEquals(null, lastYear); + holder = matcher.group(5); + Assert.assertEquals("Tony", holder); actual = "Copyright (C) 2010 - 2012 Tony"; - matcher = COPYRIGHT_PATTERN.matcher( actual ); - Assert.assertTrue( matcher.matches() ); - Assert.assertEquals( 5, matcher.groupCount() ); - prefix = matcher.group( 1 ); - Assert.assertEquals( "Copyright (C)", prefix ); - firstYear = matcher.group( 2 ); - Assert.assertEquals( "2010", firstYear ); - lastYear = matcher.group( 4 ); - Assert.assertEquals( "2012", lastYear ); - holder = matcher.group( 5 ); - Assert.assertEquals( "Tony", holder ); + matcher = COPYRIGHT_PATTERN.matcher(actual); + Assert.assertTrue(matcher.matches()); + Assert.assertEquals(5, matcher.groupCount()); + prefix = matcher.group(1); + Assert.assertEquals("Copyright (C)", prefix); + firstYear = matcher.group(2); + Assert.assertEquals("2010", firstYear); + lastYear = matcher.group(4); + Assert.assertEquals("2012", lastYear); + holder = matcher.group(5); + Assert.assertEquals("Tony", holder); // Test MLICENSE-34 (multi-line copyright holders) actual = "Copyright (C) 2010 - 2012 Tony\nAnd Yet\n Another\nLine"; - matcher = COPYRIGHT_PATTERN.matcher( actual ); - Assert.assertTrue( matcher.matches() ); - Assert.assertEquals( 5, matcher.groupCount() ); - prefix = matcher.group( 1 ); - Assert.assertEquals( "Copyright (C)", prefix ); - firstYear = matcher.group( 2 ); - Assert.assertEquals( "2010", firstYear ); - lastYear = matcher.group( 4 ); - Assert.assertEquals( "2012", lastYear ); - holder = matcher.group( 5 ); - Assert.assertEquals( "Tony\nAnd Yet\n Another\nLine", holder ); + matcher = COPYRIGHT_PATTERN.matcher(actual); + Assert.assertTrue(matcher.matches()); + Assert.assertEquals(5, matcher.groupCount()); + prefix = matcher.group(1); + Assert.assertEquals("Copyright (C)", prefix); + firstYear = matcher.group(2); + Assert.assertEquals("2010", firstYear); + lastYear = matcher.group(4); + Assert.assertEquals("2012", lastYear); + holder = matcher.group(5); + Assert.assertEquals("Tony\nAnd Yet\n Another\nLine", holder); } @Test - public void testToFileHeader() - throws Exception - { + public void testToFileHeader() throws Exception { String header; FileHeader model; - header = - "Description" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + "Copyright (C) 2010 Tony" + - LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + "License"; - model = transformer.toFileHeader( header ); - Assert.assertNotNull( model ); - assertEquals( model1, model ); - - header = "Description2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + - "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + - "License2"; - model = transformer.toFileHeader( header ); - Assert.assertNotNull( model ); - assertEquals( model2, model ); + header = "Description" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + "Copyright (C) 2010 Tony" + + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + "License"; + model = transformer.toFileHeader(header); + Assert.assertNotNull(model); + assertEquals(model1, model); + + header = "Description2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + + "Copyright (C) 2010 - 2012 Tony2" + + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + "License2"; + model = transformer.toFileHeader(header); + Assert.assertNotNull(model); + assertEquals(model2, model); } @Test - public void testToString() - throws Exception - { + public void testToString() throws Exception { String header; - header = transformer.toString( model1 ); + header = transformer.toString(model1); Assert.assertEquals( - "Description" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + "Copyright (C) 2010 Tony" + - LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + "License" + LINE_SEPARATOR, header ); + "Description" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + "Copyright (C) 2010 Tony" + + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + "License" + LINE_SEPARATOR, + header); - header = transformer.toString( model2 ); - Assert.assertEquals( "Description2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + - "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + - LINE_SEPARATOR + "License2" + LINE_SEPARATOR, header ); + header = transformer.toString(model2); + Assert.assertEquals( + "Description2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + + "Copyright (C) 2010 - 2012 Tony2" + + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + + "License2" + LINE_SEPARATOR, + header); } @Test - public void testBoxProcessTag() - throws Exception - { + public void testBoxProcessTag() throws Exception { String header; String boxedHeader; - header = transformer.toString( model1 ); - boxedHeader = transformer.boxProcessTag( header ); + header = transformer.toString(model1); + boxedHeader = transformer.boxProcessTag(header); Assert.assertEquals( - DEFAULT_PROCESS_START_TAG + LINE_SEPARATOR + "Description" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + - LINE_SEPARATOR + "Copyright (C) 2010 Tony" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + - LINE_SEPARATOR + "License" + LINE_SEPARATOR + DEFAULT_PROCESS_END_TAG + LINE_SEPARATOR, boxedHeader ); - - header = transformer.toString( model2 ); - boxedHeader = transformer.boxProcessTag( header ); + DEFAULT_PROCESS_START_TAG + LINE_SEPARATOR + "Description" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + + LINE_SEPARATOR + + "Copyright (C) 2010 Tony" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + + "License" + LINE_SEPARATOR + DEFAULT_PROCESS_END_TAG + LINE_SEPARATOR, + boxedHeader); + + header = transformer.toString(model2); + boxedHeader = transformer.boxProcessTag(header); Assert.assertEquals( - DEFAULT_PROCESS_START_TAG + LINE_SEPARATOR + "Description2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + - LINE_SEPARATOR + "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + - LINE_SEPARATOR + "License2" + LINE_SEPARATOR + DEFAULT_PROCESS_END_TAG + LINE_SEPARATOR, boxedHeader ); + DEFAULT_PROCESS_START_TAG + LINE_SEPARATOR + "Description2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + + LINE_SEPARATOR + + "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + + LINE_SEPARATOR + + "License2" + LINE_SEPARATOR + DEFAULT_PROCESS_END_TAG + LINE_SEPARATOR, + boxedHeader); } - @Test - public void testUnboxProcessTag() - throws Exception - { + public void testUnboxProcessTag() throws Exception { String header; String boxedHeader; String unboxedHeader; - header = transformer.toString( model1 ); - boxedHeader = transformer.boxProcessTag( header ); - unboxedHeader = transformer.unboxProcessTag( boxedHeader ); + header = transformer.toString(model1); + boxedHeader = transformer.boxProcessTag(header); + unboxedHeader = transformer.unboxProcessTag(boxedHeader); - Assert.assertEquals( header, unboxedHeader ); + Assert.assertEquals(header, unboxedHeader); - header = transformer.toString( model2 ); - boxedHeader = transformer.boxProcessTag( header ); - unboxedHeader = transformer.unboxProcessTag( boxedHeader ); + header = transformer.toString(model2); + boxedHeader = transformer.boxProcessTag(header); + unboxedHeader = transformer.unboxProcessTag(boxedHeader); - Assert.assertEquals( header, unboxedHeader ); + Assert.assertEquals(header, unboxedHeader); } @Test - public void testBoxComment() - throws Exception - { + public void testBoxComment() throws Exception { String header; String boxedHeader; - header = transformer.toString( model1 ); - boxedHeader = transformer.boxComment( header, true ); + header = transformer.toString(model1); + boxedHeader = transformer.boxComment(header, true); String commentLinePrefix = " * "; String commentStartTag = "/*"; String commentEndTag = " */"; - Assert.assertEquals( commentStartTag + LINE_SEPARATOR + commentLinePrefix + "Description" + LINE_SEPARATOR + - commentLinePrefix + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + - commentLinePrefix + "Copyright (C) 2010 Tony" + LINE_SEPARATOR + - commentLinePrefix + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + - commentLinePrefix + "License" + LINE_SEPARATOR + commentEndTag + LINE_SEPARATOR, - boxedHeader ); + Assert.assertEquals( + commentStartTag + LINE_SEPARATOR + commentLinePrefix + "Description" + LINE_SEPARATOR + + commentLinePrefix + + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + commentLinePrefix + + "Copyright (C) 2010 Tony" + LINE_SEPARATOR + commentLinePrefix + + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + commentLinePrefix + + "License" + LINE_SEPARATOR + commentEndTag + LINE_SEPARATOR, + boxedHeader); + + boxedHeader = transformer.boxComment(header, false); + + Assert.assertEquals( + commentLinePrefix + "Description" + LINE_SEPARATOR + commentLinePrefix + DEFAULT_SECTION_DELIMITER + + LINE_SEPARATOR + + commentLinePrefix + "Copyright (C) 2010 Tony" + LINE_SEPARATOR + commentLinePrefix + + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + commentLinePrefix + "License" + LINE_SEPARATOR, + boxedHeader); - boxedHeader = transformer.boxComment( header, false ); + header = transformer.toString(model2); + boxedHeader = transformer.boxComment(header, true); Assert.assertEquals( - commentLinePrefix + "Description" + LINE_SEPARATOR + commentLinePrefix + DEFAULT_SECTION_DELIMITER + - LINE_SEPARATOR + commentLinePrefix + "Copyright (C) 2010 Tony" + LINE_SEPARATOR + - commentLinePrefix + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + commentLinePrefix + "License" + - LINE_SEPARATOR, boxedHeader ); - - header = transformer.toString( model2 ); - - boxedHeader = transformer.boxComment( header, true ); - Assert.assertEquals( commentStartTag + LINE_SEPARATOR + commentLinePrefix + "Description2" + LINE_SEPARATOR + - commentLinePrefix + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + commentLinePrefix + - "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR + commentLinePrefix + - DEFAULT_SECTION_DELIMITER + - LINE_SEPARATOR + commentLinePrefix + "License2" + LINE_SEPARATOR + commentEndTag + - LINE_SEPARATOR, boxedHeader ); - - boxedHeader = transformer.boxComment( header, false ); + commentStartTag + LINE_SEPARATOR + commentLinePrefix + "Description2" + LINE_SEPARATOR + + commentLinePrefix + + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + commentLinePrefix + + "Copyright (C) 2010 - 2012 Tony2" + + LINE_SEPARATOR + commentLinePrefix + DEFAULT_SECTION_DELIMITER + + LINE_SEPARATOR + + commentLinePrefix + "License2" + LINE_SEPARATOR + commentEndTag + LINE_SEPARATOR, + boxedHeader); + + boxedHeader = transformer.boxComment(header, false); Assert.assertEquals( - commentLinePrefix + "Description2" + LINE_SEPARATOR + commentLinePrefix + DEFAULT_SECTION_DELIMITER + - LINE_SEPARATOR + commentLinePrefix + "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR + - commentLinePrefix + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + commentLinePrefix + "License2" + - LINE_SEPARATOR, boxedHeader ); + commentLinePrefix + "Description2" + LINE_SEPARATOR + commentLinePrefix + DEFAULT_SECTION_DELIMITER + + LINE_SEPARATOR + + commentLinePrefix + "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR + commentLinePrefix + + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + commentLinePrefix + "License2" + LINE_SEPARATOR, + boxedHeader); } @Test - public void testUnboxComment() - throws Exception - { + public void testUnboxComment() throws Exception { String header; String boxedHeader; String unboxedHeader; - header = transformer.toString( model1 ); - boxedHeader = transformer.boxComment( header, true ); - unboxedHeader = transformer.unboxComent( boxedHeader ); + header = transformer.toString(model1); + boxedHeader = transformer.boxComment(header, true); + unboxedHeader = transformer.unboxComent(boxedHeader); - Assert.assertEquals( header, unboxedHeader ); + Assert.assertEquals(header, unboxedHeader); - header = transformer.toString( model2 ); - boxedHeader = transformer.boxComment( header, true ); - unboxedHeader = transformer.unboxComent( boxedHeader ); + header = transformer.toString(model2); + boxedHeader = transformer.boxComment(header, true); + unboxedHeader = transformer.unboxComent(boxedHeader); - Assert.assertEquals( header, unboxedHeader ); + Assert.assertEquals(header, unboxedHeader); } @Test - public void testSetTrimHeaderLine() - { + public void testSetTrimHeaderLine() { Assert.assertFalse(transformer.isTrimHeaderLine()); transformer.setTrimHeaderLine(true); Assert.assertTrue(transformer.isTrimHeaderLine()); } - public static void assertEquals( FileHeader model, FileHeader model2 ) - { - Assert.assertEquals( model.getDescription(), model2.getDescription() ); - Assert.assertEquals( model.getCopyright(), model2.getCopyright() ); - Assert.assertEquals( model.getLicense(), model2.getLicense() ); + public static void assertEquals(FileHeader model, FileHeader model2) { + Assert.assertEquals(model.getDescription(), model2.getDescription()); + Assert.assertEquals(model.getCopyright(), model2.getCopyright()); + Assert.assertEquals(model.getLicense(), model2.getLicense()); } } diff --git a/src/test/java/org/codehaus/mojo/license/header/transformer/JavaFileHeaderTransformerTest.java b/src/test/java/org/codehaus/mojo/license/header/transformer/JavaFileHeaderTransformerTest.java index 539a42107..9e39e3500 100644 --- a/src/test/java/org/codehaus/mojo/license/header/transformer/JavaFileHeaderTransformerTest.java +++ b/src/test/java/org/codehaus/mojo/license/header/transformer/JavaFileHeaderTransformerTest.java @@ -31,8 +31,7 @@ * @author tchemit dev@tchemit.fr * @since 1.2 */ -public class JavaFileHeaderTransformerTest -{ +public class JavaFileHeaderTransformerTest { private static final String PACKAGE = "package org.codehaus.mojo.license.header.transformer;"; @@ -43,26 +42,23 @@ public class JavaFileHeaderTransformerTest private static final String LINE_SEPARATOR = ""; @Test - public void testAddHeader() - { + public void testAddHeader() { JavaFileHeaderTransformer transformer = new JavaFileHeaderTransformer(); transformer.setLineSeparator(LINE_SEPARATOR); transformer.setEmptyLineAfterHeader(false); String content = PACKAGE + FileHeaderTransformer.LINE_SEPARATOR + CONTENT; - transformer.setAddJavaLicenseAfterPackage( false ); + transformer.setAddJavaLicenseAfterPackage(false); - String result = transformer.addHeader( HEADER, content ); - Assert.assertEquals( HEADER + content, result ); + String result = transformer.addHeader(HEADER, content); + Assert.assertEquals(HEADER + content, result); - transformer.setAddJavaLicenseAfterPackage( true ); + transformer.setAddJavaLicenseAfterPackage(true); result = transformer.addHeader(HEADER, content); - Assert.assertEquals(PACKAGE + FileHeaderTransformer.LINE_SEPARATOR + transformer.getLineSeparator() - + HEADER + CONTENT, - result); - + Assert.assertEquals( + PACKAGE + FileHeaderTransformer.LINE_SEPARATOR + transformer.getLineSeparator() + HEADER + CONTENT, + result); } - } diff --git a/src/test/java/org/codehaus/mojo/license/header/transformer/XmlFileHeaderTransformerTest.java b/src/test/java/org/codehaus/mojo/license/header/transformer/XmlFileHeaderTransformerTest.java index 317d237b8..951313aae 100644 --- a/src/test/java/org/codehaus/mojo/license/header/transformer/XmlFileHeaderTransformerTest.java +++ b/src/test/java/org/codehaus/mojo/license/header/transformer/XmlFileHeaderTransformerTest.java @@ -33,8 +33,7 @@ * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class XmlFileHeaderTransformerTest -{ +public class XmlFileHeaderTransformerTest { protected XmlFileHeaderTransformer transformer; @@ -43,29 +42,25 @@ public class XmlFileHeaderTransformerTest private static final String HEADER = "header"; @Before - public void setUp() - { + public void setUp() { transformer = new XmlFileHeaderTransformer(); } @After - public void tearDown() - { + public void tearDown() { transformer = null; } @Test - public void testAddHeaderWithNoProlog() - { + public void testAddHeaderWithNoProlog() { String header = HEADER; String content = CONTENT; - String result = transformer.addHeader( header, content ); - Assert.assertEquals( header + content, result ); + String result = transformer.addHeader(header, content); + Assert.assertEquals(header + content, result); } - @Test - public void testAddHeaderWithProlog() - { + @Test + public void testAddHeaderWithProlog() { String header = HEADER; String prolog = ""; String content = prolog + CONTENT; @@ -76,5 +71,5 @@ public void testAddHeaderWithProlog() content = " " + prolog + CONTENT; result = transformer.addHeader(header, content); Assert.assertEquals(" " + prolog + FileHeaderTransformer.LINE_SEPARATOR + header + CONTENT, result); - } + } } diff --git a/src/test/java/org/codehaus/mojo/license/model/LicenseMapTest.java b/src/test/java/org/codehaus/mojo/license/model/LicenseMapTest.java index 339e15ba8..1dc559c25 100644 --- a/src/test/java/org/codehaus/mojo/license/model/LicenseMapTest.java +++ b/src/test/java/org/codehaus/mojo/license/model/LicenseMapTest.java @@ -22,13 +22,13 @@ * #L% */ -import static org.junit.Assert.assertEquals; - import org.apache.maven.artifact.DefaultArtifact; import org.apache.maven.artifact.handler.DefaultArtifactHandler; import org.apache.maven.project.MavenProject; import org.junit.Test; +import static org.junit.Assert.assertEquals; + public class LicenseMapTest { // licenses must be equal private static final String LICENSE_KEY = LicenseMap.UNKNOWN_LICENSE_MESSAGE; @@ -38,7 +38,7 @@ public class LicenseMapTest { private static final String ARTIFACT_ID_FIRST = "artifactId1"; private static final String ARTIFACT_ID_SECOND = "artifactId2"; - //unit test for #361 + // unit test for #361 @Test public void licenseMapOrderByName() { LicenseMap licenseMap = new LicenseMap(); @@ -48,7 +48,7 @@ public void licenseMapOrderByName() { assertEquals(2, orderedMap.get(LICENSE_KEY).size()); } - //it's a re-assurance test for default unsorted behavior + // it's a re-assurance test for default unsorted behavior @Test public void licenseMapDefaultState() { LicenseMap licenseMap = new LicenseMap(); @@ -59,7 +59,8 @@ public void licenseMapDefaultState() { private MavenProject projectForArtifact(String projectName, String artifactId1) { MavenProject project = new MavenProject(); - project.setArtifact(new DefaultArtifact("groupId", artifactId1, "1.0.0", "compile", "jar", null, new DefaultArtifactHandler())); + project.setArtifact(new DefaultArtifact( + "groupId", artifactId1, "1.0.0", "compile", "jar", null, new DefaultArtifactHandler())); project.setName(projectName); return project; } diff --git a/src/test/java/org/codehaus/mojo/license/model/LicenseRepositoryTest.java b/src/test/java/org/codehaus/mojo/license/model/LicenseRepositoryTest.java index 9e4f24619..03c90a74a 100644 --- a/src/test/java/org/codehaus/mojo/license/model/LicenseRepositoryTest.java +++ b/src/test/java/org/codehaus/mojo/license/model/LicenseRepositoryTest.java @@ -22,83 +22,73 @@ * #L% */ +import java.io.IOException; +import java.net.URL; + import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import java.io.IOException; -import java.net.URL; - /** * Tests {@link LicenseRepository}. * * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class LicenseRepositoryTest -{ +public class LicenseRepositoryTest { protected LicenseRepository repository; @Before - public void setUp() - { + public void setUp() { repository = null; } @Test - public void testJarRepository() - throws IOException - { + public void testJarRepository() throws IOException { repository = new LicenseRepository(); - URL baseURL = getClass().getResource( LicenseStore.JAR_LICENSE_REPOSITORY ); - repository.setBaseURL( baseURL ); + URL baseURL = getClass().getResource(LicenseStore.JAR_LICENSE_REPOSITORY); + repository.setBaseURL(baseURL); repository.load(); License[] licenses = repository.getLicenses(); - Assert.assertNotNull( licenses ); - Assert.assertEquals( LicenseStoreTest.DEFAULT_LICENSES.size(), licenses.length ); - - for ( String licenseName : LicenseStoreTest.DEFAULT_LICENSES ) - { - License license = repository.getLicense( licenseName ); - Assert.assertNotNull( license ); - Assert.assertNotNull( license.getHeaderURL() ); - Assert.assertNotNull( license.getLicenseURL() ); + Assert.assertNotNull(licenses); + Assert.assertEquals(LicenseStoreTest.DEFAULT_LICENSES.size(), licenses.length); + + for (String licenseName : LicenseStoreTest.DEFAULT_LICENSES) { + License license = repository.getLicense(licenseName); + Assert.assertNotNull(license); + Assert.assertNotNull(license.getHeaderURL()); + Assert.assertNotNull(license.getLicenseURL()); } - for ( String licenseName : repository.getLicenseNames() ) - { - Assert.assertTrue( LicenseStoreTest.DEFAULT_LICENSES.contains( licenseName ) ); + for (String licenseName : repository.getLicenseNames()) { + Assert.assertTrue(LicenseStoreTest.DEFAULT_LICENSES.contains(licenseName)); } } @Test - public void testUserRepository() - throws IOException - { + public void testUserRepository() throws IOException { repository = new LicenseRepository(); - URL baseURL = getClass().getResource( "/newRepository" ); - repository.setBaseURL( baseURL ); + URL baseURL = getClass().getResource("/newRepository"); + repository.setBaseURL(baseURL); repository.load(); License[] licenses = repository.getLicenses(); - Assert.assertNotNull( licenses ); - Assert.assertEquals( LicenseStoreTest.NEW_LICENSES.size(), licenses.length ); - - for ( String licenseName : LicenseStoreTest.NEW_LICENSES ) - { - License license = repository.getLicense( licenseName ); - Assert.assertNotNull( license ); - Assert.assertNotNull( license.getHeaderURL() ); - Assert.assertNotNull( license.getLicenseURL() ); + Assert.assertNotNull(licenses); + Assert.assertEquals(LicenseStoreTest.NEW_LICENSES.size(), licenses.length); + + for (String licenseName : LicenseStoreTest.NEW_LICENSES) { + License license = repository.getLicense(licenseName); + Assert.assertNotNull(license); + Assert.assertNotNull(license.getHeaderURL()); + Assert.assertNotNull(license.getLicenseURL()); } - for ( String licenseName : repository.getLicenseNames() ) - { - Assert.assertTrue( LicenseStoreTest.NEW_LICENSES.contains( licenseName ) ); + for (String licenseName : repository.getLicenseNames()) { + Assert.assertTrue(LicenseStoreTest.NEW_LICENSES.contains(licenseName)); } } } diff --git a/src/test/java/org/codehaus/mojo/license/model/LicenseStoreTest.java b/src/test/java/org/codehaus/mojo/license/model/LicenseStoreTest.java index fc8bf7715..2dad0c40c 100644 --- a/src/test/java/org/codehaus/mojo/license/model/LicenseStoreTest.java +++ b/src/test/java/org/codehaus/mojo/license/model/LicenseStoreTest.java @@ -22,109 +22,114 @@ * #L% */ -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - import java.io.IOException; import java.net.URL; import java.util.Arrays; import java.util.List; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + /** * Tests {@link LicenseStore}. * * @author tchemit dev@tchemit.fr * @since 1.0 */ -public class LicenseStoreTest -{ - - public static final List DEFAULT_LICENSES = - Arrays.asList( "agpl_v3", "apache_v2", "bsd_2", "bsd_3", "cddl_v1", "epl_v1","epl_v2", "epl_only_v1", "epl_only_v2", "eupl_v1_1", "fdl_v1_3", "gpl_v1", - "gpl_v2", "gpl_v3", "lgpl_v2_1", "lgpl_v3", "mit" ); - - public static final List NEW_LICENSES = Arrays.asList( "license1", "license2", "license3", "license4" ); +public class LicenseStoreTest { + + public static final List DEFAULT_LICENSES = Arrays.asList( + "agpl_v3", + "apache_v2", + "bsd_2", + "bsd_3", + "cddl_v1", + "epl_v1", + "epl_v2", + "epl_only_v1", + "epl_only_v2", + "eupl_v1_1", + "fdl_v1_3", + "gpl_v1", + "gpl_v2", + "gpl_v3", + "lgpl_v2_1", + "lgpl_v3", + "mit"); + + public static final List NEW_LICENSES = Arrays.asList("license1", "license2", "license3", "license4"); protected LicenseStore store; @Before - public void setUp() - { + public void setUp() { store = null; } @Test - public void testJarRepository() - throws IOException - { + public void testJarRepository() throws IOException { store = new LicenseStore(); store.init(); List repositories = store.getRepositories(); - Assert.assertNotNull( repositories ); - Assert.assertEquals( 1, repositories.size() ); - LicenseRepository repository = repositories.get( 0 ); + Assert.assertNotNull(repositories); + Assert.assertEquals(1, repositories.size()); + LicenseRepository repository = repositories.get(0); License[] licenses1 = repository.getLicenses(); License[] licenses = store.getLicenses(); - Assert.assertNotNull( licenses ); - Assert.assertNotNull( licenses1 ); - Assert.assertEquals( DEFAULT_LICENSES.size(), licenses.length ); - Assert.assertEquals( DEFAULT_LICENSES.size(), licenses1.length ); - - for ( String licenseName : DEFAULT_LICENSES ) - { - License license = repository.getLicense( licenseName ); - License license1 = store.getLicense( licenseName ); - Assert.assertNotNull( license ); - Assert.assertNotNull( license1 ); - Assert.assertEquals( license, license1 ); + Assert.assertNotNull(licenses); + Assert.assertNotNull(licenses1); + Assert.assertEquals(DEFAULT_LICENSES.size(), licenses.length); + Assert.assertEquals(DEFAULT_LICENSES.size(), licenses1.length); + + for (String licenseName : DEFAULT_LICENSES) { + License license = repository.getLicense(licenseName); + License license1 = store.getLicense(licenseName); + Assert.assertNotNull(license); + Assert.assertNotNull(license1); + Assert.assertEquals(license, license1); } - for ( String licenseName : store.getLicenseNames() ) - { - Assert.assertTrue( DEFAULT_LICENSES.contains( licenseName ) ); + for (String licenseName : store.getLicenseNames()) { + Assert.assertTrue(DEFAULT_LICENSES.contains(licenseName)); } } @Test - public void testUserRepository() - throws IOException - { + public void testUserRepository() throws IOException { - URL baseURL = getClass().getResource( "/newRepository" ); + URL baseURL = getClass().getResource("/newRepository"); LicenseRepository jarRepository = new LicenseRepository(); - jarRepository.setBaseURL( baseURL ); + jarRepository.setBaseURL(baseURL); store = new LicenseStore(); - store.addRepository( jarRepository ); + store.addRepository(jarRepository); store.init(); List repositories = store.getRepositories(); - Assert.assertNotNull( repositories ); - Assert.assertEquals( 1, repositories.size() ); - LicenseRepository repository = repositories.get( 0 ); + Assert.assertNotNull(repositories); + Assert.assertEquals(1, repositories.size()); + LicenseRepository repository = repositories.get(0); License[] licenses1 = repository.getLicenses(); License[] licenses = store.getLicenses(); - Assert.assertNotNull( licenses ); - Assert.assertNotNull( licenses1 ); - Assert.assertEquals( licenses1.length, 4 ); - Assert.assertEquals( licenses1.length, licenses.length ); - - for ( String licenseName : NEW_LICENSES ) - { - License license = repository.getLicense( licenseName ); - License license1 = store.getLicense( licenseName ); - Assert.assertNotNull( license ); - Assert.assertNotNull( license1 ); - Assert.assertEquals( license, license1 ); + Assert.assertNotNull(licenses); + Assert.assertNotNull(licenses1); + Assert.assertEquals(licenses1.length, 4); + Assert.assertEquals(licenses1.length, licenses.length); + + for (String licenseName : NEW_LICENSES) { + License license = repository.getLicense(licenseName); + License license1 = store.getLicense(licenseName); + Assert.assertNotNull(license); + Assert.assertNotNull(license1); + Assert.assertEquals(license, license1); } - for ( String licenseName : store.getLicenseNames() ) - { - Assert.assertTrue( NEW_LICENSES.contains( licenseName ) ); + for (String licenseName : store.getLicenseNames()) { + Assert.assertTrue(NEW_LICENSES.contains(licenseName)); } } } diff --git a/src/test/java/org/codehaus/mojo/license/spdx/SpdxLicenseListDataTest.java b/src/test/java/org/codehaus/mojo/license/spdx/SpdxLicenseListDataTest.java index cd2da504c..39d942c75 100644 --- a/src/test/java/org/codehaus/mojo/license/spdx/SpdxLicenseListDataTest.java +++ b/src/test/java/org/codehaus/mojo/license/spdx/SpdxLicenseListDataTest.java @@ -27,12 +27,10 @@ * * https://raw.githubusercontent.com/spdx/license-list-data/v3.5/json/licenses.json */ -public class SpdxLicenseListDataTest -{ +public class SpdxLicenseListDataTest { @org.junit.Test - public void getInstance() - { + public void getInstance() { SpdxLicenseList list = SpdxLicenseList.getLatest(); - org.junit.Assert.assertEquals( 388, list.getLicenses().size() ); + org.junit.Assert.assertEquals(388, list.getLicenses().size()); } } diff --git a/src/test/java/org/codehaus/mojo/license/spdx/SpdxLicenseListTest.java b/src/test/java/org/codehaus/mojo/license/spdx/SpdxLicenseListTest.java index f8ba7eec2..734250130 100644 --- a/src/test/java/org/codehaus/mojo/license/spdx/SpdxLicenseListTest.java +++ b/src/test/java/org/codehaus/mojo/license/spdx/SpdxLicenseListTest.java @@ -7,50 +7,48 @@ import org.junit.Assert; import org.junit.Test; -public class SpdxLicenseListTest -{ +public class SpdxLicenseListTest { @Test - public void mimeTypes() - { - for ( SpdxLicenseInfo lic : SpdxLicenseList.getLatest().getLicenses().values() ) - { - for ( UrlInfo urlInfo : lic.getAttachments().getUrlInfos().values() ) - { - if ( urlInfo.getMimeType() != null ) - { - Assert.assertNotNull( FileUtil.toExtension( urlInfo.getMimeType(), true )); + public void mimeTypes() { + for (SpdxLicenseInfo lic : SpdxLicenseList.getLatest().getLicenses().values()) { + for (UrlInfo urlInfo : lic.getAttachments().getUrlInfos().values()) { + if (urlInfo.getMimeType() != null) { + Assert.assertNotNull(FileUtil.toExtension(urlInfo.getMimeType(), true)); } } } } @Test - public void extraAliases() - { + public void extraAliases() { final Map lics = SpdxLicenseList.getLatest().getLicenses(); { - final Map urlInfos = lics.get( "Apache-2.0" ).getAttachments().getUrlInfos(); - Assert.assertTrue( urlInfos.containsKey( "https://opensource.org/licenses/apache2.0" ) ); - Assert.assertTrue( urlInfos.containsKey( "https://opensource.org/licenses/apache2.0.php" ) ); - Assert.assertTrue( urlInfos.containsKey( "https://opensource.org/licenses/apache2.0.html" ) ); + final Map urlInfos = + lics.get("Apache-2.0").getAttachments().getUrlInfos(); + Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/apache2.0")); + Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/apache2.0.php")); + Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/apache2.0.html")); } { - final Map urlInfos = lics.get( "BSD-2-Clause" ).getAttachments().getUrlInfos(); - Assert.assertTrue( urlInfos.containsKey( "https://opensource.org/licenses/bsd-license" ) ); - Assert.assertTrue( urlInfos.containsKey( "https://opensource.org/licenses/bsd-license.php" ) ); - Assert.assertTrue( urlInfos.containsKey( "https://opensource.org/licenses/bsd-license.html" ) ); + final Map urlInfos = + lics.get("BSD-2-Clause").getAttachments().getUrlInfos(); + Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/bsd-license")); + Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/bsd-license.php")); + Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/bsd-license.html")); } { - final Map urlInfos = lics.get( "CDDL-1.0" ).getAttachments().getUrlInfos(); - Assert.assertTrue( urlInfos.containsKey( "https://opensource.org/licenses/cddl1" ) ); - Assert.assertTrue( urlInfos.containsKey( "https://opensource.org/licenses/cddl1.php" ) ); - Assert.assertTrue( urlInfos.containsKey( "https://opensource.org/licenses/cddl1.html" ) ); + final Map urlInfos = + lics.get("CDDL-1.0").getAttachments().getUrlInfos(); + Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/cddl1")); + Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/cddl1.php")); + Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/cddl1.html")); } { - final Map urlInfos = lics.get( "MIT" ).getAttachments().getUrlInfos(); - Assert.assertTrue( urlInfos.containsKey( "https://opensource.org/licenses/mit-license" ) ); - Assert.assertTrue( urlInfos.containsKey( "https://opensource.org/licenses/mit-license.php" ) ); - Assert.assertTrue( urlInfos.containsKey( "https://opensource.org/licenses/mit-license.html" ) ); + final Map urlInfos = + lics.get("MIT").getAttachments().getUrlInfos(); + Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/mit-license")); + Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/mit-license.php")); + Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/mit-license.html")); } } } diff --git a/src/test/java/org/codehaus/mojo/license/utils/UrlRequesterTest.java b/src/test/java/org/codehaus/mojo/license/utils/UrlRequesterTest.java index 94e6e8cee..e3b516bb1 100644 --- a/src/test/java/org/codehaus/mojo/license/utils/UrlRequesterTest.java +++ b/src/test/java/org/codehaus/mojo/license/utils/UrlRequesterTest.java @@ -3,15 +3,13 @@ import java.io.File; import java.net.URL; -import org.codehaus.mojo.license.utils.UrlRequester; import org.codehaus.plexus.util.FileUtils; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -public class UrlRequesterTest -{ +public class UrlRequesterTest { private static final String RESOURCE_NAME = "org/codehaus/mojo/license/utils/licenses.properties"; @@ -19,34 +17,28 @@ public class UrlRequesterTest public TemporaryFolder fileRule = new TemporaryFolder(); @Test - public void testClasspathRequester() throws Exception - { - String licenseContent = UrlRequester.getFromUrl( "classpath:" + RESOURCE_NAME ); - Assert.assertEquals( "license1=This is mine!", licenseContent.trim() ); + public void testClasspathRequester() throws Exception { + String licenseContent = UrlRequester.getFromUrl("classpath:" + RESOURCE_NAME); + Assert.assertEquals("license1=This is mine!", licenseContent.trim()); } - @Test - public void testGenericRequester() throws Exception - { - URL res = getClass().getClassLoader().getResource( RESOURCE_NAME ); + public void testGenericRequester() throws Exception { + URL res = getClass().getClassLoader().getResource(RESOURCE_NAME); File testFile = fileRule.newFile(); - FileUtils.copyURLToFile( res, testFile ); + FileUtils.copyURLToFile(res, testFile); - String licenseContent = UrlRequester.getFromUrl( testFile.toURI().toURL().toString() ); - Assert.assertEquals( "license1=This is mine!", licenseContent.trim() ); + String licenseContent = UrlRequester.getFromUrl(testFile.toURI().toURL().toString()); + Assert.assertEquals("license1=This is mine!", licenseContent.trim()); } @Test - public void testClasspathIsAValidUrl() - { - Assert.assertTrue( "classpath protocol not registered", UrlRequester.isStringUrl( "classpath:" + RESOURCE_NAME ) ); + public void testClasspathIsAValidUrl() { + Assert.assertTrue("classpath protocol not registered", UrlRequester.isStringUrl("classpath:" + RESOURCE_NAME)); } @Test - public void testClasspathIsAExternalUrl() - { - Assert.assertTrue( "classpath protocol as external", UrlRequester.isExternalUrl( "classpath:" + RESOURCE_NAME ) ); + public void testClasspathIsAExternalUrl() { + Assert.assertTrue("classpath protocol as external", UrlRequester.isExternalUrl("classpath:" + RESOURCE_NAME)); } - -} \ No newline at end of file +}