Jindent - Java Source Code Formatter http://www.jindent.com
 



title

7.6 Apache Ant


Introduction to Apache Ant


Apache Ant is a very popular Java-based build tool. In theory, it is kind of like Make, but without Make's wrinkles.
This tool is free and can be downloaded at:

http://ant.apache.org/



Manual installation of Jindent as Apache Ant task


If you have already used the Jindent installer to install the Jindent plugin for Apache Ant then you can skip this section.

If not please proceed the following steps:
That's all! The Apache Ant plugin is installed now and you can make use of Jindent in your Ant tasks.



Usage of Jindent's Apache Ant Task


In the Ant build file script which makes use of this task, first dynamically load the task definition before using it.

Parameters

Note that if a parameter is not used or omited, Jindent default behaviour is applied.


Attribute Description Type Required
respect Whether or not the original folder hierarchy should be respected when yielding the result. Defaults to "false". Boolean No
d Folder where to write the formatted source files to. If the folder does not exist, all the necessary folders are created of possible. Path No
p The Jindent settings file. File No
mute The mute attribute. If set to "true", it supresses output of normal messages and errors to console. Boolean No


Example
	<taskdef
		name="JindentTask"
		classname="org.ed.pack.ant.JindentTask"
	/>
	<JindentTask
		respect="true"
		d="new_source"
		p="jin/MyStyle.xjs"
		mute="false"
	>
		<fileset dir="source">
			<include name="my_package1/*.java"/>
			<include name="my_package1/*.sqlj"/>
			<exclude name="my_package2/sub/*.java"/>
		</fileset>
	</JindentTask>
	

Copy and paste this example into your Ant build file to start with something you just have to customize very basically.