Browse files

429204 fixed run-as-maven workspace version range resolution

Change-Id: Ifa4dd003be400af245519ab924c781755ac4e8ab
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
  • Loading branch information...
1 parent 608ed13 commit 9509896ef113f1a4f77f15f85594dad328485ad6 @ifedorenko ifedorenko committed Feb 26, 2014
View
22 org.eclipse.m2e.cliresolver/src/main/java/org/eclipse/m2e/cli/WorkspaceState.java
@@ -12,6 +12,9 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
import java.util.Properties;
import org.apache.maven.artifact.Artifact;
@@ -79,4 +82,23 @@ public static File findArtifact(String groupId, String artifactId, String type,
return file;
}
+ public static List<String> findVersions(String groupId, String artifactId) {
+ Properties state = getState();
+ if(state == null) {
+ return Collections.emptyList();
+ }
+
+ String prefix = groupId + ':' + artifactId + ':';
+
+ List<String> versions = new ArrayList<String>();
+ for(Object obj : state.keySet()) {
+ String key = (String) obj;
+ if(key.startsWith(prefix)) {
+ versions.add(key.substring(key.lastIndexOf(':') + 1));
+ }
+ }
+
+ return versions;
+ }
+
}
View
3 ...m2e.cliresolver30/src/main/java/org/eclipse/m2e/cliresolver30/EclipseWorkspaceReader.java
@@ -9,7 +9,6 @@
package org.eclipse.m2e.cliresolver30;
import java.io.File;
-import java.util.Collections;
import java.util.List;
import org.codehaus.plexus.component.annotations.Component;
@@ -50,7 +49,7 @@ public File findArtifact(org.sonatype.aether.artifact.Artifact artifact) {
}
public List<String> findVersions(org.sonatype.aether.artifact.Artifact artifact) {
- return Collections.emptyList();
+ return WorkspaceState.findVersions(artifact.getGroupId(), artifact.getArtifactId());
}
}
View
7 ...m2e.cliresolver31/src/main/java/org/eclipse/m2e/cliresolver31/EclipseWorkspaceReader.java
@@ -9,12 +9,13 @@
package org.eclipse.m2e.cliresolver31;
import java.io.File;
-import java.util.Collections;
import java.util.List;
-import org.codehaus.plexus.component.annotations.Component;
import org.eclipse.aether.repository.WorkspaceReader;
import org.eclipse.aether.repository.WorkspaceRepository;
+
+import org.codehaus.plexus.component.annotations.Component;
+
import org.eclipse.m2e.cli.WorkspaceState;
@@ -50,7 +51,7 @@ public File findArtifact(org.eclipse.aether.artifact.Artifact artifact) {
}
public List<String> findVersions(org.eclipse.aether.artifact.Artifact artifact) {
- return Collections.emptyList();
+ return WorkspaceState.findVersions(artifact.getGroupId(), artifact.getArtifactId());
}
}
View
BIN org.eclipse.m2e.launching/org.eclipse.m2e.cliresolver30.jar
Binary file not shown.
View
BIN org.eclipse.m2e.launching/org.eclipse.m2e.cliresolver31.jar
Binary file not shown.

0 comments on commit 9509896

Please sign in to comment.