A life without SNAPSHOT versions

I’m currently working for a project consisting of 100+ Maven artifacts and the whole concept of SNAPSHOT versions causes a lot of trouble at this scale.

Some of the problems are the following:

  • The developers need to have all projects in the workspace to make sure the dependency resolution of the IDE works. Especially Eclipse and the m2e Plugin do not properly update SNAPSHOT dependencies from the remote repository.
  • Manually versioning 100+ projects means a lot of effort. You don’t want to do that! Using modules is also no solution at this project scale, because checking out the parent would pull all artifacts into the workspace.
  • It is not possible to reproduce the exact state of a project to any given time, when you depend on SNAPSHOT versions.
  • SNAPSHOT versions make a fully automatized deployment complicated, since you need a manual versioning step instead just pushing the latest build onto your servers. This point really hurts in a agile environment with continuous integration and nightly deployments.

Since we couldn’t find any existing solution for that problems (astonishingly enough!), I ended up with writing my own Maven plugin to automatically update the artifact versions during the build on the continuous integration server. Once an hour the versions of all artifacts, which have changed due to a commit or a dependency version update, are updated, built and deployed to the remote Maven repository. And once a night the latest build is deployed to the integration server. If everything is ok, the same build is pushed to the test server and even to the production environment. No manual interaction is necessary. No manual versioning, no manual alternating between a SNAPSHOT version and “real” version. And you don’t need tags either, since a version represents the exact state in time.

But the best thing is, the developers only need the few artifacts they are currently working on in their workspace. This dramatically increases the build and deploy time.

If you’re facing similar problems, the Maven plugin we’re using is now available on GitHub: https://github.com/nonblocking/nonsnapshot-maven-plugin