There is no good/sane Maven embedding API. You really need to
reimplement relevant parts of MavenCli and DefaultMaven in your code.
You can check how we do this in m2e [1], although embedding Maven in
long-running OSGi application certainly adds its own lever of
complexity.

[1]
http://git.eclipse.org/c/m2e/m2e-core.git/tree/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/MavenImpl.java

-- 
Regards,
Igor

On Mon, May 30, 2016, at 09:33 PM, James Roper wrote:
> On 30 May 2016 at 17:39, Michael Osipov <[email protected]> wrote:
> >
> > I think, you are looking for Maven Embedder.
> >
> 
> No, really, I'm not.  I have been head deep in the maven embedder source
> code for a day now, and it does not do what you think it does.
> 
> org.apache.maven.cli.MavenCli, the class I mentioned above, is the
> primary
> interface that maven embedder provides.  This is the single public method
> it offers:
> 
> public int doMain( CliRequest cliRequest )
> 
> This is the only method I can find in maven embedder to integrate with
> maven, and as you can see, it only returns int, there is no way to ask
> for
> a list of projects for example. As far as I can see, Maven embedder is
> only
> for programmatically issuing execution requests, not for interrogating
> the
> build.  In order to interrogate the build, I have had to copy large
> swaths
> of code from maven embedder.
> 
> Is there a better way?
> 
> > >
> > > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> 
> 
> -- 
> *James Roper*
> *Software Engineer*
> 
> Lightbend <https://www.lightbend.com/> – Build reactive apps!
> Twitter: @jroper <https://twitter.com/jroper>

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

Reply via email to