Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aether-users] org.apache.maven... vs. org.sonatype... classes

Max Spring wrote:

While using Aether in a Mojo I came across multiple cases where Aether
seems to duplicate Maven classes.

E.g.
org.sonatype.aether.repository.ArtifactRepository
org.apache.maven.artifact.repository.ArtifactRepository
or
org.sonatype.aether.artifact.Artifact
org.apache.maven.artifact.Artifact

I'm a bit confused about this.

Aether's API is self-contained and not dependent on Maven classes. Likewise Maven classes won't disappear from Maven API which existing plugins require just because Aether showed up. So seeing similar classes on both side of the fence is to be expected.

DefaultProjectBuildingRequest req = new DefaultProjectBuildingRequest();
req.setRepositorySession(repoSession);
ProjectBuildingResult res = projectBuilder.build(new File(pomFile),req);

Here I realized that the request is not looking up the parent POM as
intended.
I tried to add an org.sonatype...RemoteRepository to the request, but
it's the wrong type.

req.getRemoteRepositories().add(new RemoteRepository(...));

You might want to try

req.setRemoteRepositories(mavenProject.getRemoteArtifactRepositories())

BTW, this is a Maven-specific question and should best be directed at the Maven user list.


Benjamin


Back to the top