Friday, August 15, 2008

SNAPSHOTs are my Kryptonite

I've been playing around with building my own SNAPSHOT of Apache Geronimo GShell . For those of you not familiar with Maven SNAPSHOTs they are the artifacts generated during a Maven build on a project's SNAPSHOT branch (this is defined in the project's pom file).

SNAPSHOTs are a necessary step in the development of project code. Not every build of a project's source code can be considered a point release. To add new features, fix reported bugs, refactor code, or just improve internal documentation, among other things, developers need to build the source and test the modified modules. The process of iterating through successive build/test cycles allow for a higher quality finished release.

So far so good, how could this cause development pains?

Allow me to elaborate. When building larger applications developers will rely on features from other projects, sometimes these features only exist in SNAPSHOT form as the next point release containing the required feature have not yet been made (and may be days, weeks, or months away from release). So to continue onwards with their own project developers will include dependencies on SNAPSHOT builds. Something to keep in mind however is that SNAPSHOT builds may or may not be available for a given project's repository or mirrors at all times (resulting in an Artifact not found message, and failed build)...

So back to my above statement, why are SNAPSHOTs my Kryptonite?

By depending on a SNAPSHOT one becomes dependent upon the continual successful build of an unstable code branch. These dependencies deepen as relied upon projects also include their own SNAPSHOT requirements. The possible non-availability of particular SNAPSHOTs can result in you not being able to build the project your currently interested in. Sure you can checkout the source code to your dependencies and build your own SNAPSHOTs, and repeat the process until you can build your entire project... this process normally works, it just takes time :S

Is there any solution to this problem?
Considering the nature of SNAPSHOTs there probably isn't much that we can do to ensure that we don't spend too much time building dependencies, forward progress in development can not always be with a stable code base. In practice we have to assume that SNAPSHOTs will be available from some repository, those that are not will hopefully be a quick svn co <branch>, mvn install away.

It's taken several hours now to build up the dependencies I required for my SNAPSHOT of GShell. Now that I have these artifacts in my .m2/repository I can continue on developing as per normal. I just wanted to share a little of my adventure in the process, and relieve some of the sudden headache I develop every time I build a project and get artifact unavailable in all defined repositories - then see the word <ProjectName>-SNAPSHOT.jar.


1 comment:

Jonathan Anstey said...

Yeah, SNAPSHOTs should never make it into releases... but, as you've found they sometimes do. Its a bug IMO that should be addressed or at least release-noted.

Really though its just a side effect of staying on the bleeding edge of things - so I think the problem won't be going away soon :)