Shackelford, John-Mason wrote:
>
> If I want to make sure that the build file doesn't actually execute if
> required elements / attributes are not supplied is it an appropriate use of
> Task.init() and Task.addConfiguredXXX to ensure that required fields are
> populated?
I'd have to do a bit of trial-and-error on this issue myself, but you
can throw a BuildException from the adders/setters/creators. Many of
Ant's tasks have such complex rules for validation that its impossible
to check them until execute(), thats why you don't see any/many that do
it differently.
> I could not find any tasks that use this approach, which suggests that I am
> wrong about this, but if we wait until after the parse phase is over to
> check for missing attributes couldn't we be running a script that makes a
> big mess because it fails mid execution due to an oversight.
A big mess where? In your temporary 'build' directory? Thats what 'ant
clean' is for! :))
> Of course that is because I use a DTD. :p Which reminds me... will I find
> good source that will tell me how to make my custom tasks contribute
> accurate info to the auto generated DTD?
And how do you propose to make a DTD when you use DynamicConfigurator?
(if you are, that is) - I only made the whole DTD thing a lot tougher by
adding the DynamicConfigurator, unfortunately.
Personally, I don't use a DTD for build.xml - its too dynamic with
<taskdef>'s and all.
Erik
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>