Gradle Snapshot Plugin

(Christopher Molozian) #1

The Gradle Roadmap outlines plans for a plugin portal and tooling to improve plugin development. I hope that in the meantime it’s ok to announce a new plugin on the forums.

I’ve been working on Java projects with Gradle supporting the build environment for quite some time. I’ve had need on occasion for a variety of different gradle plugins to capture build information and interface with compilers for different technologies and tools.

The first of a few plugins that I’d like to officially announce is the Gradle Snapshot Plugin.

Snapshot is a plugin to generate build-time metadata from Source Control Management (SCM) tools. It takes the most recent commit from the SCM repository and generates a .properties file containing this information. The plugin recognises Git repositories (via the JGit library) and Mercurial repositories (via the Hg4j library). Support for other SCM repositories will be added upon request (or even better send us your pull request! =P)

I’m using the plugin on a few different projects to bundle information in a Java project that can be accessed at runtime. For example, to display a commit id alongside a version number in the help dialog of an application.

The code for the plugin is available on GitHub:

I hope it’s useful to the Gradle community and all contributions to the documentation and the codebase are very welcome.


(Luke Daley) #2

Great work Chris.

Announcing new plugins on the forums is the way to do it right now.