use of aQute.bnd.maven.support.CachedPom in project bnd by bndtools.
the class MavenTest method testRemote.
/**
* A test against maven 2
*
* @throws Exception
* @throws URISyntaxException
*/
public void testRemote() throws URISyntaxException, Exception {
URI repo = new URI("http://repo1.maven.org/maven2");
MavenEntry entry = maven.getEntry("org.springframework", "spring-aspects", "3.0.5.RELEASE");
entry.remove();
CachedPom pom = maven.getPom("org.springframework", "spring-aspects", "3.0.5.RELEASE", repo);
Set<Pom> dependencies = pom.getDependencies(Scope.compile, repo);
for (Pom dep : dependencies) {
System.err.printf("%20s %-20s %10s%n", dep.getGroupId(), dep.getArtifactId(), dep.getVersion());
}
}
use of aQute.bnd.maven.support.CachedPom in project bnd by bndtools.
the class MavenTest method testMavenx.
public static void testMavenx() throws Exception {
Maven maven = new Maven(null);
CachedPom pom = maven.getPom("javax.xml.bind", "com.springsource.javax.xml.bind", "2.2.0", new URI("http://repository.springsource.com/maven/bundles/release"), new URI("http://repository.springsource.com/maven/bundles/external"));
// Pom pom = maven.getPom("javax.xml.ws",
// "com.springsource.javax.xml.ws", "2.1.1", new
// URL("http://repository.springsource.com/maven/bundles/release"), new
// URL("http://repository.springsource.com/maven/bundles/external"));
System.err.println(pom.getGroupId() + " + " + pom.getArtifactId() + "-" + pom.getVersion());
System.err.println(pom.getDependencies(Pom.Scope.compile));
File artifact = pom.getArtifact();
System.err.println(artifact);
}
use of aQute.bnd.maven.support.CachedPom in project bnd by bndtools.
the class MavenCommand method view.
void view(String[] args, int i) throws Exception {
Maven maven = new Maven(executor);
OutputStream out = System.err;
List<URI> urls = new ArrayList<URI>();
while (i < args.length && args[i].startsWith("-")) {
if ("-r".equals(args[i])) {
URI uri = new URI(args[++i]);
urls.add(uri);
System.err.println("URI for repo " + uri);
} else if ("-o".equals(args[i])) {
out = IO.outputStream(Paths.get(args[++i]));
} else
throw new IllegalArgumentException("Unknown option: " + args[i]);
i++;
}
URI[] urls2 = urls.toArray(new URI[0]);
PrintWriter pw = IO.writer(out);
while (i < args.length) {
String ref = args[i++];
pw.println("Ref " + ref);
Matcher matcher = GROUP_ARTIFACT_VERSION.matcher(ref);
if (matcher.matches()) {
String group = matcher.group(1);
String artifact = matcher.group(2);
String version = matcher.group(3);
CachedPom pom = maven.getPom(group, artifact, version, urls2);
Builder a = new Builder();
a.setProperty(Constants.PRIVATEPACKAGE, "*");
Set<Pom> dependencies = pom.getDependencies(Scope.compile, urls2);
for (Pom dep : dependencies) {
System.err.printf("%20s %-20s %10s%n", dep.getGroupId(), dep.getArtifactId(), dep.getVersion());
a.addClasspath(dep.getArtifact());
}
pw.println(a.getClasspath());
a.build();
TreeSet<PackageRef> sorted = new TreeSet<PackageRef>(a.getImports().keySet());
for (PackageRef p : sorted) {
pw.printf("%-40s\n", p);
}
// for ( Map.Entry<String, Set<String>> entry :
// a.getUses().entrySet()) {
// String from = entry.getKey();
// for ( String uses : entry.getValue()) {
// System.err.printf("%40s %s\n", from, uses);
// from = "";
// }
// }
a.close();
} else
System.err.println("Wrong, must look like group+artifact+version, is " + ref);
}
}
Aggregations