Do I have a way to check the existence of a directory in Ant (not a file)?

前端 未结 6 1784
离开以前
离开以前 2020-12-04 15:10

How do I check for the existence of a folder using Ant?

We can check the existence of a file, but can we do the same for a folder as well?

6条回答
  •  萌比男神i
    2020-12-04 15:55

    Here's a small example incorporating the available element into an if test.

    
    
      
      
        
      
      
        
      
    
    

    Warning: you need ant-contrib.jar in your ANT_HOME\lib directory otherwise you won't have access to the if elements, and your script will fail with this error:

    Problem: failed to create task or type if
    Cause: The name is undefined.
    Action: Check the spelling.
    Action: Check that any custom tasks/types have been declared.
    Action: Check that any / declarations have taken place. 
    

提交回复
热议问题