use of org.eclipse.ceylon.cmr.api.DependencyResolver 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());
}
}
}
use of org.eclipse.ceylon.cmr.api.DependencyResolver in project ceylon by eclipse.
the class Configuration method getResolvers.
public static DependencyResolvers getResolvers(RepositoryManager manager) {
DependencyResolvers resolvers = new DependencyResolvers();
resolvers.addResolver(BytecodeUtils.INSTANCE);
DependencyResolver jsResolver = getJavaScriptResolver();
if (jsResolver != null) {
resolvers.addResolver(jsResolver);
}
resolvers.addResolver(PropertiesDependencyResolver.INSTANCE);
resolvers.addResolver(XmlDependencyResolver.INSTANCE);
if (usesMaven(manager)) {
DependencyResolver mavenResolver = getMavenResolver();
if (mavenResolver != null) {
resolvers.addResolver(mavenResolver);
}
}
resolvers.addResolver(OSGiDependencyResolver.INSTANCE);
DependencyResolver npmResolver = getNpmResolver();
if (npmResolver != null) {
resolvers.addResolver(npmResolver);
}
return resolvers;
}
use of org.eclipse.ceylon.cmr.api.DependencyResolver in project ceylon by eclipse.
the class Configuration method getResolver.
private static DependencyResolver getResolver(String className) {
try {
ClassLoader cl = Configuration.class.getClassLoader();
DependencyResolver resolver = (DependencyResolver) cl.loadClass(className).newInstance();
return resolver;
} catch (Throwable t) {
Logger.getLogger(Configuration.class.getName()).warning(String.format("Cannot add resolver %s - %s", className, t));
}
return null;
}
Aggregations