1

Is there a way to determine that a new SNAPSHOT version of a dependency is available in a Nexus? Ideally it would be a command line that would take as input a group/artifact/version and would return true if it is the case.

Say I have mygroup.b1:1.0.0-SNAPSHOT which has as dependency mygroup.a1:1.0.0-SNAPSHOT, both version controlled and managed by my continuous deployment environment. I would like for a build of mygroup.b1:1.0.0-SNAPSHOT to be triggered when a new SNAPSHOT of mygroup.a1 has been deployed in Nexus.

In my case, the continuous environment is GOCD Thoughtworks and I would like to trigger a pipeline based on the dependencies defined in a pom.xml file (that of mygroup.b1), some of which are SNAPSHOTs (such as mygroup.a1) that other pipelines could deploy.

I have looked at https://github.com/jenkinsci/maven-dependency-update-trigger-plugin which seems to do this by checking a dependency is downloaded when it is resolved. Since this is a Jenkins plugin it is not exactly what I am looking for.

I have also looked at https://github.com/aresok/go-maven-poller but the process seems tedious: is it required to define all dependent packages so that GOCD can poll Nexus?

Another thing is the usage of the versions:display-dependency-updates goal of the versions-maven-plugin http://www.mojohaus.org/versions-maven-plugin/display-dependency-updates-mojo.html but it does not seem to allow filtering on gav.

EDIT: added an example

EDIT: added information on the usage of the maven-versions-plugin

cooltea
  • 1,113
  • 7
  • 16
  • what do you eventually want to do with that newer version SNAPSHOT? – Naman Feb 07 '17 at 19:22
  • I would take a look at the metadata.xml file which is corresponding to your GAV. This contains the information about the newest artifacts...which can be parsed simply by using some groovy code ? – khmarbaise Feb 07 '17 at 19:24
  • @nullpointer decide whether to run a new build – cooltea Feb 07 '17 at 19:32
  • @khmarbaise so trigger a download of the current metadata and then parse it if I understand correctly? that requires running a mvn-dependency-plugin goal, is that correct? – cooltea Feb 07 '17 at 19:34
  • a newer build would anyway run on the latest SNAPSHOT, should this rather not be on a release version that you try and trigger? – Naman Feb 07 '17 at 19:34
  • @nullpointer "a newer build would anyway run on the latest SNAPSHOT" that is correct (assuming every is set-up correctly). The point is: how do I trigger the downstream pipeline (mygroup.b1) based on a new version of the dependency (mygroup.a1) having been deployed (by an upstream pipeline for instance)? I would like to avoid building mygroup.b1 at a fixed rate and only build it if (i) the source has changed or (ii) a dependency has been updated. – cooltea Feb 07 '17 at 19:40
  • 1
    `mvn versions:display-dependency-updates` shall work if you follow this on released versions + from released to SNAPSHOTS can also work if you use the flag `-DallowSnapshots=true` – Naman Feb 07 '17 at 19:43
  • @nullpointer I have looked into that but since the plugin does not allow filtering on gav it shows ALL dependencies with updated versions which is not strictly what I am looking for (added the mention to the question though) – cooltea Feb 07 '17 at 19:56

0 Answers0