Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add meta data to a maven pom

I have a maven pom which is deployed to a repo -And I want to add extra meta data to the tags..... For example, date created, git md5, etc...

Most importantly , I want this meta data to be seen in the pom itself, (and also embedded in the jar/zip artifact, but that is easy to do).

Can I add more (nonidentifying) xml fields to a pom declaration, which can be used for browsing but not necessarily required for defining the pom resource ?

If not, what is a simple way to annotate information about a resource in a maven deployment server (I'm using archiva, which is similar to nexus)-- of course, there is the "version" field, but I don't want to have to cram all my metadata into just one field.

like image 526
jayunit100 Avatar asked May 04 '13 14:05

jayunit100


2 Answers

There are some fields in the pom.xml that can be used that are found under More Project Information in the Pom reference.

You could probably squeeze some information into the description tag and parse the way you like.

Or you could even use <properties/> and create some useful tags there that fulfill your requirements. It may not be the recommended way to use properties for this but it is still an option.

By using properties it would be very easy to get those values into the MANIFEST.MF file by using filtering techniques in combination with the Maven Jar Plugin.

like image 147
maba Avatar answered Oct 18 '22 06:10

maba


An alternative approach is to use features offered by your chosen Maven repository manager:

  • Custom metadata in Nexus
  • Properties in Artifactory

Don't know if Archiva has these features, but they enable you to add custom information to artifacts but more importantly they also allow you to search on these tags.

Hope this helps.

Update

Sonatype support question on metadata

like image 32
Mark O'Connor Avatar answered Oct 18 '22 06:10

Mark O'Connor