Programatically getting an effective POM using Maven Resolver Provider

You can create (in your project) a public class under the package: org.apache.maven.repository.internal that extends the package-accessibility class. Just use a class name that is not possible to be used in the furutre by the vendor.

package org.apache.maven.repository.internal;
public class VisibleDefaultModelResolver extends DefaultModelResolver{

    public VisibleDefaultModelResolver(RepositorySystemSession session, RequestTrace trace, String context, ArtifactResolver resolver, VersionRangeResolver versionRangeResolver, RemoteRepositoryManager remoteRepositoryManager, List<RemoteRepository> repositories) {
        super(session, trace, context, resolver, versionRangeResolver, remoteRepositoryManager, repositories);
    }

}

Then your code becomes:

ModelResolver modelResolver = new VisibleDefaultModelResolver(session, requestTrace, "context", artifactResolver, versionRangeResolver, remoteRepositoryManager, repos);

Tags:

Java

Maven

Aether