I need to make a small program that downloads maven projects and prints its dependencies
something like this:
MavenArtifactRepository repository = new MavenArtifactRepository("typesafe", "http://repo.typesafe.com/typesafe/releases/", ..., ..., ...);
downloadAndPrintDependencies(repository, "org.hsqldb", "hsqldb", "2.2.9");
void downloadAndPrintDependencies(repository, groupId, artifactId, version) {
MavenProject projectDescription = new MavenProject("org.hsqldb", "hsqldb", "2.2.9");
Artifact artifact = repository.getProject(projectDescription); // this would download the artificat in the local repository if necessary
List<Dependency> dependecies = artifact.getDependencies();
...
}
and, that can execute goals on a maven project, something like this:
String pomXmlFile = "/tmp/myproject/pom.xml";
Reader reader = new FileReader(pomXmlFile);
MavenXpp3Reader xpp3Reader = new MavenXpp3Reader();
Model model = xpp3Reader.read(reader);
ProjectArtifact projectArtifact = new ProjectArtifact(model);
projectArtifact.clean();
projectArtifact.install();
any feedback on the pseudo-code?
What is the correct class and function that fetches an artifact from the repository?
what is the correct class and function that executes goals (such as clean and install) on maven projects?