currently, I'm working on a small tool, that needs some information of a POM 
and its parent POM. I didn't want to parse them with a XML reader, so I found 
that the DefaultModelBuilder can build a complete effective POM for me. Based 
on a stackoverflow answer 
  I build following example:

DefaultModelBuilderFactory factory = new DefaultModelBuilderFactory();
 final DefaultModelBuilder defaultModelBuilder = factory.newInstance();
 ModelBuildingRequest buildRequest = new DefaultModelBuildingRequest();
 final ModelBuildingResult modelBuildingResult = 

It works fine for simple POM (simple means a POM without a parent reference). 
But if I set a POM with a parent reference in buildRequest.setPomFile, I get 
following exception:

Exception in thread "main" java.lang.IllegalArgumentException: no model 
resolver provided, cannot resolve parent POM groupId:artifactId:1 for POM 
groupId:artifactId:version (/path/to/a/pom.xml)

Another example on Stackoverflow 
 mentions to use RepositoryModelResolver from Apache Archiva as an 
implementation ModelResolver. But I don't want to introduce a dependency to 
Apache Archiva in my tool. 

So my questions are, is the usage of DefaultModelBuilder the best way to get an 
effective POM of my project outside of a Maven Plugin? If so which 
implementation I should use for the ModelResolver? If not what is the best way 
to get the effective POM outside of a Maven Plugin.

Thank you and best regards,

Sandra Parsick

To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to