openArchitectureWare.org

oAW has moved to Eclipse.

At this site you will find information about the outdated version openArchitectureWare 4, only.
Please read our letter of intent for further information.

 
   

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.

  1. Download Jalopy from the project's homepage - take the Ant-Distribution (the first listed plugin) and unzip it; Jalopy is already contained within
  2. Start Jalopy Preferences GUI from bin/
  3. Build your own configuration using the GUI
  4. Export the configuration (there is an Export button on the "General" page)
  5. 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
HowTo: Integrate Jalopy for code beautifying | 0 comments | Create New Account
The following comments are owned by whomever posted them. This site is not responsible for what they say.