From d1f5dd22a1a89f2085ea2d8390df551112bc1b29 Mon Sep 17 00:00:00 2001 From: Alberto Otero Lorenzo Date: Wed, 18 Nov 2020 10:01:22 +0100 Subject: [PATCH 1/3] feat: add remoteRepoUrl option/property implementation --- src/main/java/io/snyk/maven/plugins/SnykMonitor.java | 7 +++++++ src/main/java/io/snyk/maven/plugins/SnykTest.java | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/main/java/io/snyk/maven/plugins/SnykMonitor.java b/src/main/java/io/snyk/maven/plugins/SnykMonitor.java index dbfa15c..745d6ce 100644 --- a/src/main/java/io/snyk/maven/plugins/SnykMonitor.java +++ b/src/main/java/io/snyk/maven/plugins/SnykMonitor.java @@ -67,6 +67,9 @@ public class SnykMonitor extends AbstractMojo { @Parameter private String org = ""; + @Parameter(property = "snyk.remoteRepoUrl") + private String remoteRepoUrl = ""; + @Parameter private String endpoint = Constants.DEFAULT_ENDPOINT; @@ -176,6 +179,10 @@ private HttpResponse sendDataToSnyk(JSONObject projectTree) private JSONObject prepareRequestBody(JSONObject projectTree) { JSONObject body = new JSONObject(); + if (!remoteRepoUrl.equals("")) { + projectTree.replace("name", remoteRepoUrl); + } + JSONObject meta = new JSONObject(); String groupId = project.getGroupId(); String artifactId = project.getArtifactId(); diff --git a/src/main/java/io/snyk/maven/plugins/SnykTest.java b/src/main/java/io/snyk/maven/plugins/SnykTest.java index c466bc4..67f99de 100644 --- a/src/main/java/io/snyk/maven/plugins/SnykTest.java +++ b/src/main/java/io/snyk/maven/plugins/SnykTest.java @@ -67,6 +67,9 @@ public class SnykTest extends AbstractMojo { @Parameter private String org = ""; + @Parameter(property = "snyk.remoteRepoUrl") + private String remoteRepoUrl = ""; + @Parameter private String failOnSeverity = "low"; @@ -140,6 +143,10 @@ private void executeInternal() throws MojoFailureException, IOException { JSONObject projectTree = new ProjectTraversal( project, repoSystem, repoSession, remoteRepositories, includeProvidedDependencies).getTree(); + if (!remoteRepoUrl.equals("")) { + projectTree.replace("name", remoteRepoUrl); + } + HttpResponse response = sendDataToSnyk(projectTree); parseResponse(response); } From 1e2be8310c64b9b270cbbb445176973b11f3bc60 Mon Sep 17 00:00:00 2001 From: Alberto Otero Lorenzo Date: Wed, 18 Nov 2020 10:04:30 +0100 Subject: [PATCH 2/3] feat: add remoteRepoUrl option/property documentation --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ee57c25..2c689cd 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ The following are elements in the `` section of t - **org** (optional): The **org** configuration element sets under which of your Snyk organisations the project will be recorded. Leaving out this configuration will record the project under your default organisation. - **includeProvidedDependencies** (optional): The **includeProvidedDependencies** configuration element allows to include dependencies with `provided` scope. Default value is `true`. - **skip** (optional): The **skip** configuration element allows to skip plugin's execution when setting it to `true`. Default value is `false`. +- **remoteRepoUrl** (optional): The **remoteRepoUrl** configuration element allows to override the Project group name in the Snyk UI. Leaving out this configuration will record the project under the default group name `groupId:artifactId`. ## Features From 5641f7d3ba2aeb2986966050d04ffdeecd9c296c Mon Sep 17 00:00:00 2001 From: Alberto Otero Lorenzo Date: Wed, 18 Nov 2020 10:08:23 +0100 Subject: [PATCH 3/3] feat: bump plugin version to 1.2.10-SNAPSHOT --- README.md | 2 +- pom.xml | 2 +- src/it/settings.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2c689cd..0c99227 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ The Snyk Maven plugin tests and monitors your Maven dependencies. io.snyk snyk-maven-plugin - 1.2.9 + 1.2.10-SNAPSHOT snyk-test diff --git a/pom.xml b/pom.xml index 9e24c20..0729251 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ io.snyk snyk-maven-plugin - 1.2.9 + 1.2.10-SNAPSHOT maven-plugin Snyk.io Maven Plugin diff --git a/src/it/settings.xml b/src/it/settings.xml index 1f16e10..bd30daa 100644 --- a/src/it/settings.xml +++ b/src/it/settings.xml @@ -8,7 +8,7 @@ true - 1.2.9 + 1.2.10-SNAPSHOT