\_/
\(_)/
-(_)-
/(_)\

Ant Pretty Build

© 2003-2008 Charbel BITAR. All rights reserved.
\_/
\(_)/
-(_)-
/(_)\





Quick Links


SourceForge.net Logo

Welcome to the Ant Pretty Build homepage!


Ant Pretty Build is a utility to easily show and run Ant buildfiles directly from within a browser window.

It consists of a single XSL file that will generate, on the fly, in the browser, from the .xml buildfile, a pretty interface showing project name, description, properties and targets, etc. sorted or unsorted, allowing to load/modify/add properties, run the whole project, or run selected set of targets in a specific order, with the ability to modify logger/logfile, mode and add more libs or command line arguments.

It was designed for users running Internet Explorer or Mozilla-based browsers that perform on-the-fly rendering of .xml documents using an XSL stylesheet.
Ant Pretty Build is fully customizable. Users can even specify external xsl, js or css files to extend features.
Since version 3.0.0, a signed Java applet is used to run Ant (instead of an activeX system control).
So Ant Pretty Build is now cross-platform/cross-browser tool!

To use this pretty tool, you need to import the 'antprettybuild-x.y.z.xsl' stylesheet in the 'build.xml' file or in another xsl stylesheet replacing core parameters or templates. You don't need an XSLT processor.
You will also need to put 'antprettybuild-x.y.z.jar' on the same directory of the stylesheet. (Anyway setting the codebase param in .xsl allow changing the .jar location).
The downloads include latest Ant Pretty Build version and some basic samples.

The idea is to add a single XML processing instruction in the Ant buildfile, just under

<?xml version="1.0"?>
that references a stylesheet the traditional way:

<?xml-stylesheet type="text/xsl" href="antprettybuild.xsl"?>

and before the <project> element. Now you only have to double click on the buildfile (opening/rendering it with IE or default browser) to see the cool interface!

Didn't catch it yet? Okay, assume you have the buildfile 'util.xml' that looks like:

<?xml version="1.0"?>
<project name="Util" default="xslt">
<description>Some utilities...</description>
<property name="version" value="1.2.3"/>
<target name="xslt" description="XSLT Tansformation">
<input message="IN: " addproperty="in"/>
<input message="OUT: " addproperty="out"/>
<input message="Style: " addproperty="style"/>
<style in="${in}" out="${out}" style="${style}" force="true"/>
</target>
<target name="unjar" description="Unjars a file to specified location">
<input message="Jar filename:" addproperty="jarfilename"/>
<input message="Target location:" addproperty="targetlocation"/>
<unjar src="${jarfilename}" dest="${targetlocation}"/>
</target>
</project>

After putting the XSL stylesheet 'antprettybuild.xsl' say in the folder where is located the 'util.xml' file, and probably modify within it environment variables (This is only needed if you didn't set system environment variables) to match (e.g. PATH, JAVA_HOME, ANT_HOME, so take a look to the source ;-), edit the buildfile adding the processing instruction under xml declaration, so your buildfile will look like:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="antprettybuild.xsl"?>
<project name="Util" default="xslt">
  <description>Some utilities...</description>
  <property name="version" value="1.2.3"/>
  <target name="xslt" description="XSLT Transformation">
    <input message="IN: " addproperty="in"/>
    <input message="OUT: " addproperty="out"/>
    <input message="Style: " addproperty="style"/>
    <style in="${in}" out="${out}" style="${style}" force="true"/>
  </target>
  <target name="unjar" description="Unjars a file to specified location">
    <input message="Jar filename:" addproperty="jarfilename"/>
    <input message="Target location:" addproperty="targetlocation"/>
    <unjar src="${jarfilename}" dest="${targetlocation}"/>
  </target>
</project>

Now, launch 'util.xml' by double clicking on it, this will open and renders the file in the browser. Depending on your security settings, a message may show the signing certificate asking whether to grant permission to the applet.
Even if the applet is not signed by an authority, don't be afraid, it will only run Ant on your buildfile.
You may see the project name, description, properties, etc. and the active parts, properties table where you can change/add properties, targets table, a table listing main/sub/all targets where you can run targets individually by clicking on small pretty buttons, click the 'Run' button to execute the default target or select a sequence of targets before clicking on the 'Run' button.

Note also that adding the xml-stylesheet instruction will have NO EFFECT on running buildfiles from command line or from other IDEs that integrate Ant.

The features you may modify in 'antprettybuild.xsl' or another importing stylesheet (see samples for implementation) are xsl parameters. Don't hesitate to customize the way you like...
For example, set <xsl:param name="showproperties">true</xsl:param> to show properties table.
- Show properties table.
- Show imports table.
- Show taskdefs table.
- Show targets table.
- Show tasks of each target.
- Show run form.
- Show source.

- Sort properties.
- Show property description.
- Show target properties.
- Load properties from files.
- Allow modify properties.
- Allow add properties.

- Sort targets.
- Show sub targets.
- Show target depends.
- Show target tasks.
- Link to tasks documentation.
- Allow add classpath libraries.
- Allow run targets.

And much more...

This documentation is too short but I think that it gives an overview of a cool idea to interact with buildfiles without external runner and the easy way. Improvements, suggestions and comments are welcome. Hope you enjoy it!



Resources


Visits:       PageRank




  Current Version: 3.2.0, Last Update: 2008-04-01