wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes Error in a simple build file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Error in a simple build file" Watch "Error in a simple build file" New topic
Author

Error in a simple build file

ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
Dear all,
I'm a novice in using ant tools & this is my first build.xml.
I've written a simple build file, to have all my class files
from
C:\Sai\src to E:\Sai\Classes.
This is my build.xml



When I run this using the ant tool:

Why this is happening & how it could be rectified?
M'wile what is the meaning of $ we use in ${src}.

configuration details:


ANT_HOME -> C:\Ant16 (Ant version: 1.6)
path -> JAVA_HOME\bin;ANT_HOME\bin;
classpath-> JAVA_HOME\lib;


Regards.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

You've declared the default target as dist at the top of your build.xml which is then the target that Ant will call if you do not provide it with a specific one. As that target does not exist in your build.xml you get the error. Try changing default to nothing or "compile" if that's what you want to happen by default.

The usage of ${} notation is simply how you reference properties in Ant. So ${src} will be replaced by the property src (which in your case is C:\Sai\src)


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
Dear all,
See now I've removed the dist property & I've modified my source & target directories also.
But eventhough the build is successful, the class files are not there in my target folder i.e. C:\buildoutput\classes


In building:

Regards
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi there,

Try "ant compile" so that the compile target gets called explicitly
ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
Dear Martijn Verburg ,
Now it's working fine as suggested by you.
Now we've put our class file in c:\buildoutput\classes.
Is it possible to run these classes using ant.
How?
Regards
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi Ramya, yes it is, see the Java task in the Ant documetnation.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error in a simple build file
 
Similar Threads
ANT help required
Question on Ant script error in my build.xml file in the Eclipse IDE
JAVA DOC
including a file in a build
Build problem when including third party jars in classpath using ant