7

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.

jayunit100
  • 17,388
  • 22
  • 92
  • 167

2 Answers2

2

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.

maba
  • 47,113
  • 10
  • 108
  • 118
1

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

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

Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • Does the current artifactory support properties? In my UI, I do not see a "Configuration" or "Properties" tab. Rather, I only see Find Search Find Artifact Browse Manage Reports Audit Log Report User Management User Roles Appearance Upload Artifact Delete Artifact Administration Repository Groups Repositories Proxy Connectors Legacy Support Network Proxies Repository Scanning Database System Status – jayunit100 May 09 '13 at 14:30
  • @jayunit100 Perhaps it's a permissions issue? Sorry I'm more familiar with Nexus – Mark O'Connor May 09 '13 at 19:38
  • http://stackoverflow.com/questions/16486967/archiva-setting-metadata-properties <-- I've added a related question. – jayunit100 May 10 '13 at 16:39
  • So what you are saying, is that this is not standardized but vendor-specific? – Thorbjørn Ravn Andersen Oct 20 '14 at 13:50
  • @ThorbjørnRavnAndersen Yup, although Nexus is made by Sonatype the inventors of Maven :-) – Mark O'Connor Oct 20 '14 at 20:35
  • @MarkO'Connor In that case they should have made it a standard feature in Maven so it would be useful everywhere. – Thorbjørn Ravn Andersen Oct 20 '14 at 20:41
  • @ThorbjørnRavnAndersen One nice thing about their approach is that the data gets indexed so that it's searchable. That is one definate improvement over storing data within the POM and you're quite correct would be a welcome addition to the Maven repository standard. See also my update above. – Mark O'Connor Oct 20 '14 at 20:47