aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-10-08 17:10:38 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2014-10-08 17:10:38 +0200
commita799ea39801e72ed68595599fd2d1b8a239c69d7 (patch)
treeb0ccd56a4d969025f5470758b8f6e153cdc650ed /sonar-plugin-api
parentb0ce29966933102359d5e4c44ff1ce11ec4cb3ed (diff)
parente75946f4fec001cdf1d84624ff51366db2a02328 (diff)
downloadsonarqube-a799ea39801e72ed68595599fd2d1b8a239c69d7.tar.gz
sonarqube-a799ea39801e72ed68595599fd2d1b8a239c69d7.zip
Merge remote-tracking branch 'origin/branch-4.5'
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java10
2 files changed, 12 insertions, 2 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java
index 785937126fc..da5cc35681b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java
@@ -87,6 +87,10 @@ public final class Library extends Resource {
return false;
}
+ public static Library createFromMavenIds(String groupId, String artifactId, String version) {
+ return new Library(String.format(Project.MAVEN_KEY_FORMAT, groupId, artifactId), version);
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
index 65f6dc39d45..bc866693f9b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
@@ -26,6 +26,8 @@ import org.sonar.api.CoreProperties;
import org.sonar.api.component.Component;
import org.sonar.api.config.Settings;
+import javax.annotation.Nullable;
+
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -47,7 +49,7 @@ public class Project extends Resource implements Component {
}
};
- private static final String MAVEN_KEY_FORMAT = "%s:%s";
+ static final String MAVEN_KEY_FORMAT = "%s:%s";
private static final String BRANCH_KEY_FORMAT = "%s:%s";
public static final String SCOPE = Scopes.PROJECT;
@@ -414,7 +416,11 @@ public class Project extends Resource implements Component {
}
public static Project createFromMavenIds(String groupId, String artifactId) {
- return new Project(String.format(MAVEN_KEY_FORMAT, groupId, artifactId));
+ return createFromMavenIds(groupId, artifactId, null);
+ }
+
+ public static Project createFromMavenIds(String groupId, String artifactId, @Nullable String branch) {
+ return new Project(String.format(MAVEN_KEY_FORMAT, groupId, artifactId), branch, "");
}
@Override