Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What exactly is the artifact descriptor in Maven?

Tags:

maven

I lately had some issues with some Maven dependencies and came across the error: "Failed to read artifact descriptor ...".

My question is not really about the error but more about the artifact descriptor itself. I would like to know what the actual problem is or what's creating the problem and I did not really find an explanation for what artifact descriptors are, so I wondered if someone could help me.

like image 224
Patrick Malik Avatar asked Jan 24 '17 14:01

Patrick Malik


People also ask

What is artifact descriptor in Maven?

Provides information about an artifact that is relevant to transitive dependency resolution. Each artifact is expected to have an accompanying artifact descriptor that among others lists the direct dependencies of the artifact.

What is artifact name in Maven?

artifactId is the name of the jar without version. If you created it, then you can choose whatever name you want with lowercase letters and no strange symbols. If it's a third party jar, you have to take the name of the jar as it's distributed.

What is an artifact in spring boot?

Artifact: project coordinates (id of the artifact, as referred by the artifactId attribute in Apache Maven). Also infers the name of the project. Name: display name of the project that also determines the name of your Spring Boot application.


1 Answers

In other words, it's the POM. The POM is the Maven specific file that describes an artifact.

Maven 3.3.9 uses Eclipse Aether behind the scenes (which has been incorporated into Maven 3.5.0 itself as part of the Maven Resolver API), and it provides the class ArtifactDescriptorReader, explaining:

Provides information about an artifact that is relevant to transitive dependency resolution. Each artifact is expected to have an accompanying artifact descriptor that among others lists the direct dependencies of the artifact.

The Javadoc of its sole readArtifactDescriptor method is:

Gets information about an artifact like its direct dependencies and potential relocations.

So when you have an error that goes like "Failed to read artifact descriptor...", it means that the POM could not be read, or could not be resolved. Typically, it follows from network issues where the downloaded POM was corrupted, where Internet access is proxied and Maven isn't rightly configured, etc.

like image 129
Tunaki Avatar answered Sep 18 '22 00:09

Tunaki