diff --git a/utils/license-maven-plugin/pom.xml b/utils/license-maven-plugin/pom.xml index 565c120..44009ff 100644 --- a/utils/license-maven-plugin/pom.xml +++ b/utils/license-maven-plugin/pom.xml @@ -3,12 +3,12 @@ 4.0.0 org.eclipse.set license-maven-plugin - 1.0.1 + 1.1.1 maven-plugin - 17 - 17 + 21 + 21 UTF-8 @@ -16,30 +16,30 @@ org.apache.maven maven-plugin-api - 3.9.3 + 3.9.9 provided org.apache.maven.plugin-tools maven-plugin-annotations - 3.9.0 + 3.15.0 provided org.apache.maven maven-core - 3.9.3 + 3.9.9 provided org.apache.maven.plugins maven-dependency-plugin - 3.6.0 + 3.8.1 org.eclipse.dash license-tool-plugin - 1.0.3-SNAPSHOT + 1.1.1-SNAPSHOT diff --git a/utils/license-maven-plugin/src/main/java/org/eclipse/set/licensemavenplugin/ExtraDependencies.java b/utils/license-maven-plugin/src/main/java/org/eclipse/set/licensemavenplugin/ExtraDependencies.java index 9a7f200..59dfb9b 100644 --- a/utils/license-maven-plugin/src/main/java/org/eclipse/set/licensemavenplugin/ExtraDependencies.java +++ b/utils/license-maven-plugin/src/main/java/org/eclipse/set/licensemavenplugin/ExtraDependencies.java @@ -13,6 +13,7 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; +import java.io.InputStreamReader; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -40,7 +41,7 @@ private static IDependencyListReader getReader(Path path) throws FileNotFoundExc File input = path.toFile(); if (input.exists()) { if ("package-lock.json".equals(input.getName())) { - return new PackageLockFileReader(new FileInputStream(input)); + return new PackageLockFileReader(new InputStreamReader(new FileInputStream(input))); } return new FlatFileReader(new FileReader(input)); } else { diff --git a/utils/license-maven-plugin/src/main/java/org/eclipse/set/licensemavenplugin/LicenseCheckMojo.java b/utils/license-maven-plugin/src/main/java/org/eclipse/set/licensemavenplugin/LicenseCheckMojo.java index 09761fe..28c4a17 100644 --- a/utils/license-maven-plugin/src/main/java/org/eclipse/set/licensemavenplugin/LicenseCheckMojo.java +++ b/utils/license-maven-plugin/src/main/java/org/eclipse/set/licensemavenplugin/LicenseCheckMojo.java @@ -49,9 +49,9 @@ import org.eclipse.dash.licenses.maven.AbstractArtifactFilteringMojo; import org.eclipse.dash.licenses.maven.MavenProxySettings; import org.eclipse.dash.licenses.maven.MavenSettings; +import org.eclipse.dash.licenses.projects.ProjectService; import org.eclipse.dash.licenses.review.CreateReviewRequestCollector; import org.eclipse.dash.licenses.review.GitLabSupport; -import org.eclipse.dash.licenses.validation.EclipseProjectIdValidator; import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; import com.google.inject.Guice; @@ -72,6 +72,13 @@ public class LicenseCheckMojo extends AbstractArtifactFilteringMojo { */ @Parameter(property = "dash.projectId") private String projectId; + + + /** + * Optionally specify the Eclipse Project repository that is the source of the request + */ + @Parameter(property = "dash.repo") + private String repo; /** * Output a summary to the given file. If not specified, then a dependencies @@ -187,7 +194,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { // Validate the user-given dash license tool settings ISettings settings; try { - settings = new MavenSettings(batch, foundationApi, clearlyDefinedApi, licenses, confidence, projectId, iplabToken); + settings = new MavenSettings(batch, foundationApi, clearlyDefinedApi, licenses, confidence, projectId, iplabToken, repo); } catch (IllegalArgumentException e) { throw new MojoExecutionException("Invalid setting: " + e.getMessage()); } @@ -212,12 +219,8 @@ public void execute() throws MojoExecutionException, MojoFailureException { String source = a.getGroupId().startsWith(P2_GROUPID_PREFIX) ? "orbit" : "mavencentral"; // TODO could get duplicates here if two artifact coords differ only by // classifier - IContentId id = M2EDependencyMapper.mapDependency(ContentId.getContentId(type, source, a.getGroupId(), a.getArtifactId(), a.getVersion())); - id = SETSnapshotDropper.mapDependency(id); - deps.add(id); + deps.add(ContentId.getContentId(type, source, a.getGroupId(), a.getArtifactId(), a.getVersion())); }); - - deps.addAll(ExtraDependencies.getExtraDependencies()); List collectors = new ArrayList<>(); @@ -231,7 +234,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { Injector injector = Guice.createInjector(new LicenseToolModule(settings, createProxySettings())); if (settings.getProjectId() != null) { - var validator = injector.getInstance(EclipseProjectIdValidator.class); + var validator = injector.getInstance(ProjectService.class); if (!validator.validate(settings.getProjectId(), message -> getLog().error(message))) { throw new MojoExecutionException("Invalid project id."); } @@ -296,4 +299,4 @@ protected IProxySettings createProxySettings() { proxyServer.getPassword(), securityDispatcher, getLog()); } -} +} \ No newline at end of file