This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Exactly where is line 55 in your build.xml? Exactly how did Ant get there? I ask because I have experienced similar things via an 'antcall' (properties set in the build script are not being propagated to the antcall). Try running with the -v option, that might give you a clue as to exactly where the problem is.
Of course this was cross-posted :-) I use all the best forums...
Line 55 is the javac call
<javac srcdir="${src.dir}" destdir="${build.dir}" listfiles="no" debug="true" classpathref="build.classpath" fork="true" memoryInitialSize="128m" memoryMaximumSize="512m" />
edit:
If I clean the project via eclipse - the compile works. Otherwise, if I delete a class file or even entire bin folder manually - it fails.
The compile task is called from several tasks. In all cases it works fine if I clean the project via eclipse first.
Are you running the Ant build from within Eclipse? I ask because Eclipse adds a bunch of settings to the build.
It sounds to me like your Ant build script is not very well written - deleting a class file, or not running a 'clean' should not effect the build's success.
Did you try using -v like I suggested?
Azriel Abramovich
Ranch Hand
Joined: Dec 10, 2003
Posts: 38
posted
0
Yes, I am running from eclipse.
edit2: -v option: where shall I add it? I guess the answer is 'from command line' and I'll try it asap. see next message
Sorry, I can write Java and C++ code, I can do a handstand... but ant is a bit of a mis(t)ery still (I can rant for long periods about such tools).
edit:
To make life easier (now that I've realised that in the long time I was gone from this forum - upload is supported :-)) I've uploaded the properties and the build.xml file.
Comments are welcome on other things as well... as I am just starting to grind my teeth against the
cannot upload as any format I choose is ignored
Thanks,
A'z
Azriel Abramovich
Ranch Hand
Joined: Dec 10, 2003
Posts: 38
posted
0
First: Here is the contents of my build.xml file. See how many faults you find :-)
Right, I've ran Ant from command line with the -v option.
Here are some things which ant reports as it starts
So you can see it initially complains about the missing lib.dir, it does load the properties file.
Then I see it is adding all expected classes to the build list
i.e.
And as a prize I get the following ant exception (which I fail to learn anything new from):
Azriel Abramovich
Ranch Hand
Joined: Dec 10, 2003
Posts: 38
posted
0
I have resolved this by realising that I better not have the build.dir, lib.dir and src.dir properties as properties. This should sit within the build.xml file
Suggestion: Do not use back-slashes in paths in Ant - the back-slash is too often taken as an escape character.
The problem is that you load the properties file from within a target, but the classpath is initialized globally. Thus lines 19..26 are performed before lines 6..10. You should either do all initialization within targets (I prefer this for complicated build scripts) or load the properties file globally (not within a target). I usually always load the properties file globally.
However your decision to move the properties into the build script is the correct decision. All project-relative paths should be defined within the build script itself. Use the properties file for external directory locations and other settings that can change from machine to machine or user to user.
By the way, if you are new with Ant, grab Ant in Action - I have the first edition of that book and found it to be invaluable.
Azriel Abramovich
Ranch Hand
Joined: Dec 10, 2003
Posts: 38
posted
0
Thanks Peter!
I guess I got what I deserve.
I took an Ant build file written by someone else, and just ripped some parts apart.
I'll learn now how to initialize the classpath as part of a task, and load the properties globally.