1

I've been trying to develop a relatively simple application (used as pre-cursor to a custom build process) which will process some POMs and resolve all the dependencies in advance (transitevely) from a remote repo.

I've succesfully been able to extract various properties from the POM (which I'm making use of elsewhere), but the dependency resolution is proving to be rather difficult.

I have experimented using various classes from org.apache.maven and also looked into Aether. I've poured over many resources online regarding dependency resolution with org.apache.maven, however they all seem to cover Maven plugins (which hook into the Plexus container with annotations) rather than a standalone application, where I don't [believe I] have access to that container and so cannot use the sorts of objects I need, such as an ArtifactResolver or ArtifactRepositoryFactory.

Is there a way to get the Plexus container when not being executed as part of Maven? If so, are there any good resources for explaining this? If not, are there any implmentations of the key classes which don't require the Plexus container?

Tom
  • 251
  • 2
  • 13

2 Answers2

2

Two open source projects that may answer your questions are Ivy and Leiningen. Both connect to maven repos to do dependency management, but don't seem to use the maven command line. Note that Leiningen is for Clojure projects, so it may be difficult to understand if you don't know Clojure. I have never looked at its source though. For all I know, it's written in Java.

Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356
1

Have a look at Eclipse Aether, there is an example that does just that.

Renaud
  • 16,073
  • 6
  • 81
  • 79