.. (parent)AntDocXMLReleaseNotesJindentWedSitorXPSBookmark
You are here: Programming >> Jindent
Audience
Developer

Meta

Table of contents

Jindent integration for Ant

This page presents my work concerning the integration of Jindent tool within the famous open-source tool Ant.

The motivation

For I was upset with wrong indentation in Java, I decided to search the web for a tool that would automatically do the job for me.

I know that indentation if a matter of taste, and that the practice from one developer to another may vary from the everything-in-one-line to the gruyère (an excellent Swiss and French cheese, mainly composed by holes) chuck.

This is the reason why I was looking for a customizable tool, that would take from a configuration file the way I want the Java source code to be indented, and that would yield the result. With it, over the painful head ache of reading what you have not coded yourself.

A tool that automatically indents the Java source code

After some browsing on the internet, I eventually found a tool that would fit my requirements. This tool is Jindent: it is a vendor solution provided by Software & Solutions company. OK, this is not a free tool, but I was unable to find one.

I perfectly know that some Integrated Development Environment (IDE) also integrates that feature (I think of Together Control Center V5 or IDEA V2), but they are not as much customizable. Moreover, it would cost a lot to purchase some licence just for this feature!

Integration to Ant

I downloaded an evaluation version of Jindent, and found that it was the product I had been looking for months. Since it is written in Java, I could easily call the Java beautifier from a Java process. Since I am Ant addicted, I very soon came to the idea to create a custom task, so as to integrate the tool within Ant scripts. And there it is!

You may browse the documentation , or download the binary (a jar file actually). The distribution jar file contains the HTML manual of the task.

OK, there will always be someone to note that you can always invoke Jindent via ant Ant <java> task, but this is not as fast and this is always more error-prone...


Current date: 2014.08.02 8:32:35 Number of hit: 12331