简体   繁体   English

如何在指定文件夹中的文件上执行Ant任务?

[英]How do i execute an ant task on files in a specified folder?

I have to preprocess some state machine (.sm) files using a compiler to generate java code before compiling the rest of my project, and using an ant task to do it. 在编译项目的其余部分之前,我必须使用编译器预处理一些状态机(.sm)文件,以生成Java代码,并使用ant任务来完成它。 At this moment i have to add each file i need to parse manually in the ant target. 此时,我必须添加需要在ant目标中手动解析的每个文件。

How can i use ant to go through a directory i specify and execute the task on all files it finds with .sm extension? 如何使用ant遍历我指定的目录并在以.sm扩展名找到的所有文件上执行任务?

The task needs the filename as a parameter and i don't know how to read that automatically and pass it to the task call. 该任务需要文件名作为参数,我不知道如何自动读取该文件名并将其传递给任务调用。

 <target name="smc-gen" >
        <smc target="java" smfile="${srcPath}/someSmFile.sm" destdir="${ControlPanel.Controller}" smcjar="${smc.jar}" />          
    </target>

Apply任务将处理给定文件夹中具有指定扩展名或名称/扩展名模式的所有文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM