maven-2continuous-integrationbuildforge

checking for maven snapshot dependency changes on continuous integration server


There is a cruisecontrol plugin that checks for changes to snapshot dependencies, triggering a build if required. This involves using the Maven embedder to download the dependencies, then checking the timestamps of the snapshot files in the local repository. This works ok, but involves downloading all the parents and dependencies to check some timestamps.

I'm working on a distributed CI system (e.g. Bamboo/Buildforge) and would like to avoid downloading the entire dependency hierarchy to check if a build is required. It is possible to determine the build date of a snapshot dependency by checking the maven-metadata.xml on the remote repository.

Are there any plugins or tools to streamline this process?


Solution

  • It looks like Mercury provides the higher level API I was looking for.

    Mercury provides an implementation-neutral way to access GAV-based repositories, including AV repositories, like OSGi. OSGi access is not implemented yet. By access I mean reading artifacts and metadata from repositories and writing artifacts to repositories, metadata is updated by writes.

    All the calls accept a collection of requests as an input and return an object that hides getResults, that normally is a map< queryElement, Collection > response. The response object has convenience methos hasExceptions(), hasResults(), getExceptions(), getResults()

    One of the key building blocks is a hierarchy of Artifact data:

    • ArtifactCoordinates - is truly the 3 components GAV
      • ArtifactBasicMetadata - is coordinates plus type/classifier plus convenience methods like hash calculation and such
    • ArtifactMetadata adds a list of dependency objects, captured as ArtifactBasicMetadata
    • DefaultArtifact implements Artifact interface and adds pomBlob (byte[]) and file, that points to actual binary