0

Is it possible to save key/value pairs along with artifacts in Nexus?

At the moment, we are using 2.14, but I would also be interested in the situation with Nexus 3.

If so, do they need to be deployed along with the artifact, or can they be set later (by REST or something similar)?

I would like to store meta-information and wonder whether I need an additional database.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
  • In [Nexus Pro there is an option to add metadata](https://help.sonatype.com/repomanager2/using-the-user-interface/view-and-editing-artifact-metadata) (If I correctly remember via REST API)....for Nexus 3 currently does not existing such thing. The question is why do you need such things and for what purpose? – khmarbaise Sep 13 '18 at 12:14
  • I thought about using it as a poor man's database for storing some information about an artifact (like "SVN path", "contained jars in an ear",...). – J Fabian Meier Sep 13 '18 at 12:21
  • Ok so now we settled what is stored...But what about the purpose? Furthermore storing such information why? For example svn url is stored in the POM.xml already ...or you can add this kind of information into the MANIFEST.MF file ...? The most important question keeps: Why do you need those information and for what purpose? – khmarbaise Sep 13 '18 at 12:49
  • E.g. we are establishing a process that collects Jira Issues that are mentioned in svn commits and relates them to releases. This process needs to find a list of all jars in an ear and subsequently the svn revisions from which these jars were built. At the moment I am downloading the ear, unpacking it, unpacking all jars and read their properties files (we have company-standard property files in each jar that contains various information including the svn revision). This process works but is too slow to do it "live" in a UI. – J Fabian Meier Sep 13 '18 at 12:57
  • What about using JIRA plugin to connect JIRA to SVN and let JIRA add information of the commit into the JIRA issue...... – khmarbaise Sep 13 '18 at 13:05
  • Aim is to measure the change from one ear version to another, in the form: Which issues describe the change from my-ear-1.0.0 to my-ear-1.1.0? For that, we list all jars, compare their versions and look up commits in the svn. Up to now, we have no commit hooks that would directly connect jira issues and svn commits, and even if we had them, the kind of information I am looking for would not directly be produced. – J Fabian Meier Sep 13 '18 at 13:09
  • If you have a release defined in JIRA and solved a number of issues you have a list of issues which contains the related commits ? Apart from that you don't need a commit hook cause the JIRA plugin will scan the repository...The question is why not using JIRA directly for that? Don't you define a release in front of the development and afterwards all issues related have to be closed ? Maybe you get some which will be assigned to a release under work later but I don't see an issue there.. – khmarbaise Sep 13 '18 at 13:13
  • Thank you, I should definitely think about a tighter integration between Jira and SVN. – J Fabian Meier Sep 13 '18 at 13:29

1 Answers1

1

It would be best to upgrade to Nexus Repo 3 and use the new tagging API (the old Nexus 2.x custom metadata API doesn't have an upgrade path).

The Nexus Repo 3 REST API endpoint is:

POST /service/rest/v1/tags/associate/{tagName}

An example:

curl -u admin:admin123 -X POST 'http://127.0.0.1:8081/service/rest/v1/tags/associate/project-abc-142?repository=my-company&group=com.mycompany&name=project-abc&version=2.1.1'

Note however, that in both versions tagging is a pro feature, and requires a license.

Reference: https://help.sonatype.com/display/NXRM3/Tagging

rseddon
  • 5,082
  • 15
  • 11