use of org.eclipse.ceylon.cmr.maven.MavenDependencyResolver in project ceylon by eclipse.
the class ResolverTestCase method testMavenDependecyResolver.
@Test
public void testMavenDependecyResolver() throws Exception {
final MavenDependencyResolver resolver = new MavenDependencyResolver();
doTest(new Tester() {
public void run(CmrRepository repository, final File artifact) {
ModuleInfo infos = resolver.resolve(new TestArtifactResult(repository, "org.apache.camel:camel-core", "2.9.2", artifact), null);
Assert.assertNotNull(infos);
Assert.assertEquals(String.valueOf(infos), 3, infos.getDependencies().size());
}
});
}
use of org.eclipse.ceylon.cmr.maven.MavenDependencyResolver in project ceylon by eclipse.
the class CMRTests method testMavenFileResolver.
@Test
public void testMavenFileResolver() throws ZipException, IOException {
CeylonRepoManagerBuilder builder = CeylonUtils.repoManager();
RepositoryManager repository = builder.buildManager();
String groupId = "javax.el";
String artifactId = "javax.el-api";
String version = "3.0.0";
String coord = groupId + ":" + artifactId;
File artifact = repository.getArtifact(MavenArtifactContext.NAMESPACE, coord, version);
Assert.assertNotNull(artifact);
try (ZipFile zf = new ZipFile(artifact)) {
String descriptorPath = String.format("META-INF/maven/%s/%s/pom.xml", groupId, artifactId);
ZipEntry entry = zf.getEntry(descriptorPath);
Assert.assertNotNull(entry);
try (InputStream is = zf.getInputStream(entry)) {
DependencyResolver resolver = new MavenDependencyResolver();
ModuleInfo info = resolver.resolveFromInputStream(is, coord, version, null);
Assert.assertNotNull(info);
// FIXME: find one with dependencies
System.err.println(info.getDependencies());
}
}
}
Aggregations