Along the lines of....
http://marc.theaimsgroup.com/?l=ant-user&m=107429941032345&w=2
Is it possible to create targets dynamically, deferring creation
until such time as it is found that the project doesn't have the
target already defined? My use-case is using <subant> to iterate
over sub-builds calling a target on each one. My current strategy is
to define <patternset>s for each type of project. For instance, I
add all web projects to a particular patternset and then reference
that patternset when calling <subant>....
<subant target="war" inheritAll="false">
<fileset dir=".">
<patternset refid="war.patternset"/>
</fileset>
</subant>
As further fallback, individual builds may implement empty targets
just so that they don't fail, just in case...
<target name="war">
<echo message="Unimplemented target"/>
</target>
However, ideally, I'd like to be able to create the above target
dynamically in the case that it isn't implemented already by the
build. This would have 2 benefits:
1. I wouldn't have to bother creating the patternsets. I'd just
call all the build files and let them either build the war file or
echo the "Unimplemented target" message.
2. Individual builds that aren't web projects wouldn't have to have
to know what a web project is. If the only artifact generated is a
simple jar library, it seems odd to have to implement a dummy "war"
target simply because some external master build file might call "war" on it.
Instead of Ant failing with the following message...
BUILD FAILED
Target `war' does not exist in this project.
...I'd like Ant to just run the above dynamically created target (not
just the "war" target, but any target that might not exist), report
the "Unimplemented target" message, and continue on.
So, is this possible? Where/how do I hook into Ant to know the
target isn't implemented and create it myself via a scriptdef before
Ant gives me the build failure?
Jake
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]