How to correctly use Aether in Gradle?

I need for the some functional from Aether, I had found a embedded package ‘org.gradle.mvn3.org.sonatype.aether’, but I cannot success do anything with it. How to correctly obtain instance of RepositorySystem in Gradle? I tried to use DefaultPlexusContainer like this: new DefaultPlexusContainer().lookup(RepositorySystem) but this crashed: > org.gradle.mvn3.org.codehaus.plexus.component.repository.exception.ComponentLookupException: Component descriptor cannot be found in the component repository

role: org.gradle.mvn3.org.sonatype.aether.RepositorySystem

roleHint:

classRealm: none specified

I tried to use service locator directly:

DefaultServiceLocator serviceLocator = new DefaultServiceLocator() serviceLocator.addService(VersionResolver, DefaultVersionResolver) serviceLocator.addService(ArtifactDescriptorReader, DefaultArtifactDescriptorReader) serviceLocator.addService(VersionRangeResolver, DefaultVersionRangeResolver) RepositorySystem system = serviceLocator.getService(RepositorySystem)

but then all repository transport is broken and I cannot access to any repository via any protocol (eg http and file).

We embed this for our maven support internally. It’s not exposed as a Gradle feature so its use is unsupported.

You might have more look bootstrapping your own version of aether.

Hello Sergey, the package org.gradle.mvn3.org.sonatype.aether is considered to be private and not public gradle api. if you need to use aether (would you mind to describe your usecase for that) you should add dependencies to the according aether libraries from maven central to your build logic.

cheers, René

Oh, ok, I’ll use a public version from maven central, thanks!