THanks for the hints, in general I'm currently cleanup/refactor Tycho but still there are places where maven-compat seems required (and the tests is such a part sadly).

Tycho requires maven-3.8.6 as a minimum and hopefully will move on to maven 3.9.x once it is released (and we got rid of the compat stuff).

I think I'll try as you suggested and get rid of org.apache.maven.repository.RepositorySystem in favor of org.eclipse.aether.RepositorySystemSession, just need to check how this new stuff all works, in the particular case we "simply" resolve an artifact with its dependencies using

@Requirement
private RepositorySystem repositorySystem;

org.apache.maven.repository.RepositorySystem.createArtifact(...)

and

org.apache.maven.repository.RepositorySystem.resolve(ArtifactResolutionRequest)

calls ...


Am 26.09.22 um 12:47 schrieb Tamás Cservenák:
Howdy,

you did not specify what is what you exactly look for.... but in general:
definitely avoid maven-compat (maven2 support).

Your best bet is to:
- NOT support older Maven then 3.1, then you save yourself from
aether/resolver package change (so no need for things like
https://github.com/apache/maven-artifact-transfer and alike)
- go directly for resolver API (org.eclipse.aether.RepositorySystemSession
and related ones) -- this is the recommended way today (as Maven itself
"lifted" minimal Maven version to 3.1+ as well, Maven 3.0 is dead and to be
completely forgotten).
- maven 4 will introduce new API (https://github.com/apache/maven/pull/703)
but only in 4+ versions (and will provide a "window" for plugins/extensions
to move from resolver-direct to API use), so several Maven 4.x versions
will support both: "direct" resolver access but also provide API as well.
At one point, maven "core" (never meant as "API") access will be shut off.

also, take a peek at this (and related) pages
https://cwiki.apache.org/confluence/display/MAVEN/Maven+Ecosystem+Cleanup

So, if you are in position to ignore Maven 3.0, then you are free to use
resolver API directly w/o issue. True, in future, migration to Maven 4 API
will be inevitable, but until core access is not shut down (no exact
timeline for it), you are fine. Again, your mileage may vary, as the
interface you refer to is really huge...


HTH
T

On Mon, Sep 26, 2022 at 12:07 PM Christoph Läubrich <m...@laeubi-soft.de>
wrote:

I'm currently writing a test for a component that requires

org.apache.maven.repository.RepositorySystem

the problem is that it seems the only implementation of this is
LegacyRepositorySystem that is part of maven-compat (and thus I'd like
to avoid adding that as a dependency)

So I see two options:

1) There is a new alterantive that implements
org.apache.maven.repository.RepositorySystem but I just don't know about?

2) I could try to refactor my code to not using
org.apache.maven.repository.RepositorySystem, but what should be the
alternative?

org.apache.maven.repository.RepositorySystem is not deprecated and I
can't see any note that something else should be used instead...

any hints?

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




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

Reply via email to