a dependency has a type, but not really a packaging: a packaging is a recipe to build a project that will produce multiple artifacts, each with its own type
see the comparison 
and default artifact handlers  gives you informations about default types.
The only misleading field IMHO is that a type does not really define a packaging: there is a typical packaging that produces the type, but anybody could attach an artifact by hand without using the packaging recipe (and if someone produces his artifact with a build tool that is not Maven, the packaging is not used at all)
----- Mail original -----
De: "Elliotte Rusty Harold" <[hidden email]>
À: "Maven Developers List" <[hidden email]>
Envoyé: Jeudi 20 Septembre 2018 22:05:42
Objet: Packaging from Aether
With Eclipse Aether I can read a pom and gather information in the
form of import org.eclipse.aether.graph.Dependency and
Is there some way from these or related objects I can gather the
information about the packaging of the dependency? That is, the type
child element of the dependency element in the original pom.xml file?
I seem to be able to get the extension of the file, but that's not
quite the same thing.
On Thu, Sep 20, 2018 at 10:34 PM, Lennart Jörelid
<[hidden email]> wrote:
> Hello Elliotte,
> I usually use the depends-maven-plugin, which collects information about
> dependencies within a property file.
> The data format within this property file (typically placed within
> target/classes/META-INF/maven/dependencies.properties is shown below - and
> the dependency type and classification can be read as the property
> [groupID]/[artifactID]/type and .../classification
That would be nice. However if I read it right that would require
everything I depend on to use it, and it doesn't. That is, I can
produce that file for my own artifacts but not for everyone else's.
Found it. The type was hiding in the properties. That is,
String type = artifact.getProperty(ArtifactProperties.TYPE, "jar");
On Thu, Sep 20, 2018 at 4:05 PM, Elliotte Rusty Harold
<[hidden email]> wrote:
> With Eclipse Aether I can read a pom and gather information in the
> form of import org.eclipse.aether.graph.Dependency and
> org.eclipse.aether.artifact.Artifact objects.
> Is there some way from these or related objects I can gather the
> information about the packaging of the dependency? That is, the type
> child element of the dependency element in the original pom.xml file?
> I seem to be able to get the extension of the file, but that's not
> quite the same thing.
> Elliotte Rusty Harold
> [hidden email]