HowTo: Integrate Jalopy for code beautifying
Jalopy is a code beautifier that can help you to format generated code. This article shows how Jalopy can be integrated in an Ant build process.
- Download Jalopy from the project's homepage - take the Ant-Distribution (the first listed plugin) and unzip it; Jalopy is already contained within
- Start Jalopy Preferences GUI from bin/
- Build your own configuration using the GUI
- Export the configuration (there is an Export button on the "General" page)
- edit your oaw ant script like follows and call the target after generating (e.g. using the antcall task)
Writing the target that calls Jalopy
<target name="beautify-jalopy" description="Code beautifying with Jalopy" if="JALOPY_HOME">
<taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
<classpath>
<fileset dir="${JALOPY_HOME}/lib">
<include name="*.jar" />
</fileset>
</classpath>
</taskdef>
<jalopy convention="${JALOPY_CONFIG}">
<fileset dir="${GEN_OUT}" includes="**/*.java"/>
</jalopy>
</target>
Calling the target after code generation
<target name="generate"...>
<generate ...>
...
</generate>
<!-- now call Jalopy to format the generated code -->
<antcall target="beautify-jalopy"/>
Properties to define
- JALOPY_HOME: Installation path of Jalopy
- JALOPY_CONFIG: URL to your code convention config (we've actually placed it on our internal WebServer and point to it)
- GEN_OUT: the output path where the generated sources are

