Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aether-users] is there a way to get the parent pom from an artifactDescriptor or artifactResult?

Ryan Gardner wrote:

Is the parent of a given module available as a property on an artifact?

No.

I'm working on building out a thing for my company that will automatically
track our artifacts and show dependencies between them / etc - and having
access to the parent pom / parent pom version etc is something that I'm
interested in.

Is there some other way to get this info out?

No, at least not using stock Aether.

I suggest to take a look at the DefaultModelBuilder from maven-model-builder which is the Maven component dealing with POM inheritance, ModelBuildingResult.getModelIds() provides the data you're interested in.

The mentioned component is also used by DefaultArtifactDescriptorReader to get the dependency info. Patching that class to pass through the desired information in the ArtifactDescriptorResult might also work for you.

if there isn't currently a way to get the info, is this something that is
intentionally not part of aether

Kinda, Aether isn't meant to be the POM reading API, reading POMs is just an implementation detail of the maven-aether-provider.

That said, you're not the first to ask for getting hold of the POM info which the artifact descriptor reader internally already gathers. So it might make sense to have this data somehow present in the ArtifactDescriptorResult. Or maybe the DefaultModelBuilder just needs a more user-friendly facade. In both cases, the relevant code resides in the Apache Maven project, not Eclipse Aether.


Benjamin



Back to the top