Ant , use it for a mini IDE ?
Posted on 2006-04-10
I am teaching a newbie. Unfortunately his home computer is rather old (Win98), slow and weak. His machine will not handle a big pig of a IDE. Ok, he can type at the command line. But, that gets old fast, as we all know. So, my idea is to use ant to save him a lot of typing. I came up with a simple build.xml file.
<project name="CompileAndRun" default="run" basedir=".">
<target name="compile" description="Compiles Test.java">
<record name="Test.txt" loglevel="debug" action="start" append="false"/>
<javac srcdir="." destdir="." />
<target name="run" depends="compile" description="runs Test.class">
<java classname="Test" classpath="."/>
I installed Apache Ant version 1.6.5 and made a directory called codeTest. Inside codeTest I placed the build.xml file, a shortcut to Command Prompt, and a file called Test.java . This works great. He writes a few lines of code in the Test.java file and he can test it by typing "ant" at the command line. Wow! He is climbing that learning curve fast now. He is happy with this. But I want him to be able to name his source code any name he chooses. I don't want him to have to name his class "Test" everytime. So, there is my problem.
I can't figure out how to put a variable or a wildcard in the classname attribute of <java> task. I tried <java classname="**/*.class" classpath="."/> , <java classname="all" classpath="."/> ,and a lot of different things but I am unsuccessful so far. Do you have any ideas ? rrz