Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between archetype.xml and archetype-metadata.xml in Maven

Tags:

maven

I'm trying to add additional variables to my archetype. Specifically, my archetype contains a logback.xml file, and I want to populate the log filename with the name of the project I'm generating from the archetype.

I was carrying out the instructions in the answer here Passing extra properties to maven archetype:generate, but it says to add a <requiredProperties> element to my archetype-metadata.xml. My archetype doesn't have an archetype-metadata.xml, it only has an archetype.xml (which was generated automatically when I generated my archetype from maven-archetype-archetype).

In https://maven.apache.org/guides/mini/guide-creating-archetypes.html, Maven refers to archetype.xml as an artifact-descriptor.

I googled archetype-metadata.xml, and found this - http://maven.apache.org/archetype/archetype-models/archetype-descriptor/archetype-descriptor.html. Maven calls it an archetype-descriptor as well, but its specification does not contain the id and resources elements that I see in my archetype.xml.

Are archetype.xml and archetype-metadata.xml the same thing? if not, what are their different purposes? Can I add a <requiredProperties> element to my archetype.xml file? Or should I create an archetype-metadata.xml file?

like image 308
Jibby Avatar asked Mar 31 '16 19:03

Jibby


1 Answers

Since there is no answer for the question what the difference is between archetype.xml and archetype-metadata.xml:

As specified in the documentation https://maven.apache.org/archetype/archetype-common/archetype.html archetype.xml was used for schema version 1.0.0. archetype-metadata.xml is used with schema version 1.1.0.

archetype.xml:

Maven's model for the old archetype descriptor (ie for Archetype 1.0.x). The metadata about an archetype is stored in the archetype.xml file located in the META-INF/maven directory of its jar file.

archetype-metadata.xml:

This is a reference for the Archetype descriptor used to describe archetypes's metadata. The metadata about an archetype is stored in the archetype-metadata.xml file located in the META-INF/maven directory of its jar file.

like image 172
Tiemo Vorschütz Avatar answered Oct 12 '22 11:10

Tiemo Vorschütz