I said previously that ANT as a build system was my favourite NetBeans 4.x feature. Here’s a little example why. Note this is inspired by Tim Boudreau. Here’s how to run jEdit (the IDE) from the source in minutes (seconds if you’re really quick).
– Download the just released jEdit 4.3pre2 and uncompress it.
– Start NetBeans 4.x (I used 4.1 beta).
– “New Project” -> “Java Project with Existing Ant Script”
– point to the jEdit directory
– see how it picks-up the build.xml
file, project name, and targets (except for the “run” target I’ll recreate real quick) and create the project
– double-click on the build.xml node and add the following simple ANT task (using code-completion):
<target name="run" depends="dist">
<java jar="jedit.jar" fork="true"/>
</target>
(I don’t really know why the “run” target dissapeared, it used to be there in 4.2 I think)
– execute using the “Run Main Project” button or menu (you can safely ignore the 35 or so compilation warnings).
– that’s it!
Try any other application with an ANT script and let me know how it goes. Note a good ANT script needs to explicitly set the “source” and “target” arguments for the compiler and remember that you can use the ANT debugger if needed.
Next step: see how I can improve the compile time using Peter’s javac tuning tricks.
4 thoughts on “What does NetBeans’s ANT buy me?”
Comments are closed.
I followed your link about installing the Ant debugger, and the instuctions on the debugger page about using the NetBeans Update Centre tool to install the debugger don’t work – the debugger doesn’t appear on the list of modules available for install, in fact I don’t see the “Debugging folder” at all…
ANT Debugger is available in NetBeans 4.1 beta in the “Development Update Center”. Are you using NB 4.1 beta?
-Alexis
Isn’t it faster to do this?
tar xvfz jedit43pre2source.tar.gz
cd jEdit
ant
java -jar jedit.jar
:-)
then
<code>
java -jar jedit43pre2install.jar
</code>
may be even faster ;-)
-Alexis