Is it possible to check if a command exists as part of an ant task. For example, I want to ensure the "yasm" command is present as part of the ant task. Is this possible? If so, can you provide an example?
相关问题
- How can I have my ant task pass or fail based on t
- Ant inheriting Maven properties
- How can I zip multiple folders individually with a
- Class in jar not found at runtime, but was used to
- Regex to select last line in a multi-line string
相关文章
- Passing command line arguments to Java via ant bui
- ANT - Could not load a dependent class com/jcraft/
- library resolve to a path with no project.properti
- ant file that depends on another ant file
- android-sdk/tools/ant/build.xml:698: null returned
- ant jar's mainclass
- Integrate Ant builder into Eclipse: Error “Variabl
- How can I avoid this Ant Build error?
The best way I can think of to do this is by using the
available
task combined with anif
in a subsequent target. If you take a look at that task page you will see that you can check to see if something exists then set a property. For example:Then in the target you would say something like
<target name='foo' if='file.present'>
That doesn't check for executable permissions but it will get much closer. If a task exists to check for the executable permission specifically you would still probably combine it with the
if
in the target.Original answer
It is better to use the ant copy task instead of trying to execute
cp
yourself. This keeps its platform independent.More usage on the Ant documentation for the copy task.
The following idiom can be used to find an executable somewhere in the environment's PATH.