On 13/02/2012, at 12:09 AM, Dennis Lundberg wrote:

> Hi
> 
> I'm working on a stand-alone tool (not invoked via Maven) that currently
> reads POM files using the MavenXpp3Reader. Now there is a need to use
> interpolated models instead of the plain file content. So I started
> looking at MavenProjectBuilder in Maven 2.2.1 and ModelBuilder in Maven
> 3.0.4.
> 
> After some experimenting I end up needing either Repositories (M2) or
> ModelResolvers (M3). Does anyone know of any examples of how to use any
> of these in a stand-alone tool?

I would recommend using the M3 model builders, since that avoids hassles around 
the permanent memory consuming cache using in M2.

But here are examples of both:
M2: 
https://github.com/brettporter/centrepoint/blob/master/centrepoint/modules/maven-importer/src/main/java/com/effectivemaven/centrepoint/maven/repository/CentralRepositoryService.java
M3: 
https://github.com/apache/archiva/blob/trunk/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java

The tricky part is going to be getting the components instantiated, and depends 
on what other libraries you are using.

- Brett

--
Brett Porter
[email protected]
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter
http://twitter.com/brettporter






---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to