SparkDependencyResolver extends AbstractDependencyResolver { public static Collection<String> inferScalaVersion(Collection<String> artifact) { List<String> list = new LinkedList<String>(); for (String a : artifact) { list.add(inferScalaVersion(a)); } return list; } SparkDependencyResolver(SparkIMain intp, SparkContext sc, String localRepoPath,
                            String additionalRemoteRepository); List<String> load(String artifact,
      boolean addSparkContext); List<String> load(String artifact, Collection<String> excludes,
      boolean addSparkContext); @Override List<ArtifactResult> getArtifactsWithDep(String dependency,
      Collection<String> excludes); static Collection<String> inferScalaVersion(Collection<String> artifact); static String inferScalaVersion(String artifact);  }
@Test public void testInferScalaVersion() { String [] version = scala.util.Properties.versionNumberString().split("[.]"); String scalaVersion = version[0] + "." + version[1]; assertEquals("groupId:artifactId:version", SparkDependencyResolver.inferScalaVersion("groupId:artifactId:version")); assertEquals("groupId:artifactId_" + scalaVersion + ":version", SparkDependencyResolver.inferScalaVersion("groupId::artifactId:version")); assertEquals("groupId:artifactId:version::test", SparkDependencyResolver.inferScalaVersion("groupId:artifactId:version::test")); assertEquals("*", SparkDependencyResolver.inferScalaVersion("*")); assertEquals("groupId:*", SparkDependencyResolver.inferScalaVersion("groupId:*")); assertEquals("groupId:artifactId*", SparkDependencyResolver.inferScalaVersion("groupId:artifactId*")); assertEquals("groupId:artifactId_" + scalaVersion, SparkDependencyResolver.inferScalaVersion("groupId::artifactId")); assertEquals("groupId:artifactId_" + scalaVersion + "*", SparkDependencyResolver.inferScalaVersion("groupId::artifactId*")); assertEquals("groupId:artifactId_" + scalaVersion + ":*", SparkDependencyResolver.inferScalaVersion("groupId::artifactId:*")); }