0

I wonder if it is possible to get maven-metadata.xml file as a maven depenedency. What I'm trying to achieve is get build number from the nexus' maven-metadata.xml.

<metadata modelVersion="1.1.0">
  <groupId>group</groupId>
  <artifactId>artefact</artifactId>
  <version>version</version>
  <versioning>
  <snapshot>
      <timestamp>20130619.091047</timestamp>
      <buildNumber>2</buildNumber> <!--WHAT I'M TRYING TO GET-->
    </snapshot>
    <lastUpdated>20130619091047</lastUpdated>
    <snapshotVersions>
    <snapshotVersion>
      <extension>rpm</extension>
      <value>value</value>
      <updated>20130619091047</updated>
    </snapshotVersion>
    <snapshotVersion>
      <extension>pom</extension>
      <value>value</value>
      <updated>20130619091047</updated>
  </snapshotVersion>
  </snapshotVersions>
  </versioning>
</metadata>

p.s. Yeah, I know it can be retrieved through Nexus REST API, but I'm interested in the certain scenario provided above.

carlspring
  • 31,231
  • 29
  • 115
  • 197
mr.nothing
  • 5,141
  • 10
  • 53
  • 77
  • I dont think so.. also the build number in the meta data file is only an iterator and not really a build number on a CI server or so. What do you actually want to achieve? – Manfred Moser Jun 19 '13 at 19:52
  • @ManfredMoser, That's a little bit tricky :) The thing is that the project I develop is supplied via RPMs and after it is installed it is impossible to associate rpm installed on the system and artifact from the nexus. That's why I want to provide nexus build number in the RPM decription. – mr.nothing Jun 19 '13 at 21:08

1 Answers1

1

The meta data iterator you see in the maven-metadata xml is NOT a build number from a CI server and therefore does not let you create the association you are looking for between code, ci server build and deployment.

In order to do that and solve the problem you mentioned in the comments I would:

  • build with the rpm maven plugin
  • use the build number maven plugin or some parameter from the CI server to populate a properties file in your final rpm
  • have a feature in the application that can display that property file

This way any build time information can be captured in the final artifact and be made available in the deployment.

Furthermore I would look into the yum nexus plugin to expose the Maven repo to your yum based deployment machines.

If you are not building with Maven a similar approach can be done with any other build tool as well.

Manfred Moser
  • 29,539
  • 13
  • 92
  • 123