Skip to content
Quick and dirty commandline tool for indenting java code. Uses Eclipse code formatter.
Branch: master
Clone or download
Pull request Compare This branch is 6 commits ahead, 9 commits behind jrialland:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Build Status

This project evolved from a Quick and dirty commandline tool that formatted java source code to something more evoluted.

It scans source code directories and beautifies/formats/transforms the files it can, I add support for new tools when I them.

Disclaimer : The tool is made to fit the settings I like and the way I code. It works by convention, not by configuration.


  • java : Uses the Eclipse code java formatter (and its default behavior by default) on all .java files
  • xml : beautifies xml using the javax.xml.transform api on xml, xhtml, svg files
  • css : beautifies using js-beautify ( on every .css files
  • html : beautifies using js-beautify (.html only)
  • js, json : beautifies using js-beautify (.js, .json files)

Header in java files

  • It can also add a commented text header at the beginning of java files (copyright infos, etc...) -> See -H option


It also features some extra tasks :

  • coffeeScript 1.10 compilation ( (turning .coffee into .coffee.js)
  • compass compiler ( (detect files named compass.rb as configuration file and run them)
  • freemarker : runs freemarker on all files with the .ftl extension
  • css/js minifier : if the file has ".minify" in its name, the file is minified and into .min

An example : If you want to have some coffeeScript files that need to be minified :


Create a file named with the following content :

<#include "" parse=false>
<#include "" parse=false>

The compilation mechanism will apply this way :

  1. The .ftl extension means that freemarker will be executed, producing a file named
  2. The .coffee extension will trigger the coffeeScript compiler, and produce the all.minify.js
  3. The fact that there is .minify in the name will run jsmin, and produce all.min.js

By specifying the file names properly, the following chain will trigger each time : * merging several files into one * compiling coffeeScript into javascript * minifying the javascript

#download the formatter script
curl > javaformatter

#allow to run it
chmod +x javaformatter

#will cleanup the current dir
./javaformatter src/main/java
You can’t perform that action at this time.