On Mon, May 4, 2020 at 4:10 PM Elliotte Rusty Harold <[email protected]>
wrote:

> 1. Is there an API somewhere for locating the local maven repository
> that is often but not always stored in ~/.m2/repository?
>

I didn't find a good code for that. It looks like MavenCli and related
classes are doing most of the job, but they're not so useful as API because
a lot of their goodness is private.
See how we do it in LemMinX-Maven in the meantime: reading settings, then
fallback to system property, then fallback to default location:
https://github.com/eclipse/lemminx-maven/blob/master/lemminx-maven/src/main/java/org/eclipse/lemminx/maven/MavenPlugin.java#L117...L129

2. Is it possible to boostrap the resolver without using the internal
> class MavenRepositorySystemUtils?


If you need a RepositorySystemSession, best seems to be creatin a
MavenExecutionRequest, and then
`container.lookup(DefaultRepositorySystemSessionFactory.class).newRepositorySession(mavenRequest)`.

This is what's used both by Eclipse m2e and LemMinX-Maven, with some
success.

Reply via email to