About Groovy Binary Compatibility

Important information about Groovy binary compatibility

Excerpted from “Making Java Groovy” book.

How projects in the Groovy ecosystem include Groovy

One of the dirty little secrets of Groovy is that the major versions are not always binary compatible. Code compiled with one version doesn’t necessarily work with any other.

This means that projects in the Groovy ecosystem have a choice. They can either be compiled with different versions of Groovy and make the Groovy version number part
of their own version, or they can bundle in a particular version of Groovy.

The Spock framework (discussed in chapter 6) takes the former approach. Spock versions are in the form 0.7-groovy-2.0, meaning Spock version 0.7 compiled with Groovy version 2.0.

The Grails and Gradle projects take the other approach. Grails 1.3.9, for example, includes a copy of Groovy 1.7.8, Grails 2.0.3 includes Groovy 1.8.6, and Grails 2.2.1
includes Groovy 2.0.8. To see the Groovy version included in your Gradle distribution, run the gradle –v command.


Migrating from Google Site to Octopress

I finally decided to move my static personal site from Google site to Octopress, a static blogging framework built on top of Jekyll. Though I was happy initially with Google site, it is a pain to do few things in it like customizing layout, themes, fonts, etc.

Personally I was looking for the following features in a blogging framework to bake my site quickly. To bake a site or a blog, there are plethora of frameworks out there to choose from. Though I started with Jekyll at first, I decided to go with Octopress for its easy of use.

  • simplicity
    • ease of creating content like in markdown format
  • portability
    • local copy of the site source
    • host in Amazon cloud, Github or such
  • customization of
    • themes
    • layout
    • fonts, etc.
  • plugins for
    • source code formatting
    • mathematical formulas in LaTEX
    • search the site
    • table of contents on each page (like in Wikipedia)

To get a local site up & running in Octopress:

  • Download and Install Octopress, Ruby, Python, Git (watch out of version compatibility)
  • Update all ruby gems gem update
  • To create a new page rake new_page[name]. This creates a [name].md file where your enter your content in markdown format.
  • To generate static site in html files rake generate
  • To deploy locally rake preview. This starts a local server on http://localhost:4000/.

From my feature list above, most of them were in-built in Octopress except displaying math formulas. Octopress uses ‘rdiscount‘ markdown by default which does not support math formulas via MathJax. ‘kramdown‘ markdown supports this by default, but it does not have ‘table of content’ feature.

To get around this, I found a custom version of ‘rdiscount‘. (More details)

The personal site is now baked and working locally. To host it in github, create a repository named like reponame.github.io. Running `rake deploy` from the folder where Octopress is installed, deploys the static site to the Github repo under ‘master‘ branch. Voila, the site is now successfully hosted under http://reponame.github.io.

Now you don’t want to keep your site source locally in case of any disaster. You could check in the source code as well in Github in the same repository created above under a different branch called ‘source‘ by executing the following commands.

$ rake generate
$ git add .
$ git commit -am "Some comment here."
$ git push origin source