How to add category and tags to artefact in mavenrepository

485 Views Asked by At

Does anyone could explain how to update these values in the Maven Repository repository for my artifact:

  • Category
  • Tags

Maven Artefact description

1

There are 1 best solutions below

0
On

I believe this is possible using the org.sonatype.plugins:nexus-staging-maven-plugin. Unfortunately I do not use it and so cannot test this, but as describe here: https://help.sonatype.com/repomanager2/staging-releases/configuring-your-project-for-deployment, it is possible to add arbitrary tags which "can be accessed via the REST interface". I believe that the correct tag key (like tag or category) may show up in the HTTP interface of mvnrepository and https://central.sonatype.dev/

As part of the configuration section for the plugin you can define tags with arbitrary key and value names. For example, you could create a tag with key localUsername and a value of the current user picked up from the USER environment variable:

...
<configuration>
...
  <tags>
    <localUsername>${env.USER}</localUsername>
    <javaVersion>${java.version}</javaVersion>
  </tags>
...

Once components are released these tags are transformed into attributes stored along the components in the release repository and can be accessed via the REST interface and, therefore, any plugin and user interface integration.