MavenRepository implements Repository { public MavenCoordinates resolve(MavenCoordinates coordinates) { if (coordinates.isResolved()) { return coordinates; } List<String> groupIds; if (coordinates.getGroupId() != null) { groupIds = ImmutableList.of(coordinates.getGroupId()); } else { groupIds = defaultGroupIds; } List<MavenCoordinates> matchedCoordinates = newArrayList(); for (String groupId : groupIds) { MavenCoordinates resolvedSpec = new MavenCoordinates(groupId, coordinates.getArtifactId(), coordinates.getVersion(), coordinates.getPackaging(), coordinates.getClassifier(), coordinates.getFileVersion()); if (toHttpUri(resolvedSpec, false) != null) { matchedCoordinates.add(resolvedSpec); continue; } if (coordinates.getVersion().contains("SNAPSHOT")) { MavenCoordinates timestampSpec = resolveSnapshotTimestamp(coordinates, groupId); if (timestampSpec != null) { matchedCoordinates.add(timestampSpec); continue; } } Matcher timestampMatcher = TIMESTAMP_VERSION.matcher(coordinates.getVersion()); if (timestampMatcher.matches()) { MavenCoordinates snapshotSpec = new MavenCoordinates(groupId, coordinates.getArtifactId(), timestampMatcher.group(1) + "-SNAPSHOT", coordinates.getPackaging(), coordinates.getClassifier(), coordinates.getVersion()); if (toHttpUri(snapshotSpec, false) != null) { matchedCoordinates.add(snapshotSpec); } } } if (matchedCoordinates.size() > 1) { throw new RuntimeException("Ambiguous spec " + coordinates + " matched " + matchedCoordinates); } if (matchedCoordinates.isEmpty()) { return null; } return matchedCoordinates.get(0); } MavenRepository(Iterable<String> defaultGroupIds, URI repositoryBase, URI... repositoryBases);  MavenRepository(Iterable<String> defaultGroupIds, Iterable<URI> repositoryBases); @Inject  MavenRepository(CoordinatorConfig config); @Override String configRelativize(String config); @Override String configResolve(String config); @Override String configShortName(String config); @Override String configUpgrade(String config, String version); @Override boolean configEqualsIgnoreVersion(String config1, String config2); @Override URI configToHttpUri(String config); @Override String binaryRelativize(String binary); @Override String binaryResolve(String binary); @Override String binaryUpgrade(String binary, String version); @Override boolean binaryEqualsIgnoreVersion(String binary1, String binary2); @Override URI binaryToHttpUri(String binary); URI toHttpUri(MavenCoordinates coordinates, boolean required); MavenCoordinates resolve(MavenCoordinates coordinates); @Override String toString();  }
@Test public void resolve() throws Exception { Assert.assertEquals(repo.configResolve("@apple:1.0"), "@prod:apple:1.0"); Assert.assertEquals(repo.binaryResolve("apple:1.0"), "food.fruit:apple:1.0"); }