如何从 g运行t 运行 一只蚂蚁 build.xml?

How to run an ant build.xml from grunt?

是否可以 运行 带有 g运行t 的 ant 脚本,如果可以 - 如何?目前,我们的 eclipse 项目包含一个 build.xml 文件,该文件合并并缩小了一些 css 和 js 文件。我想将它与 g运行t 观察器结合使用,但在我的研究过程中,我找不到可以 运行 xml ant 脚本的 g运行t 插件。

所以在我的 Gruntfile.js 中会有这样一个 G运行t Watch 任务:

watch: {
        dev:{
            files: [
                //my_files
                ...
            ],  
            tasks: ['<some task that runs the build.xml ant script>'],
            options : { 
                nospawn : true                  
            }
        },
}

我也可以用 g运行t 配置另一个缩小任务,没有任何问题,但因为其他人没有在他们的计算机上配置 g运行t,我想使用已经存在的。

我想我找到了解决方案(Windows):

要求:JAVAJDK

我为 windows 安装了 ant:https://ant.apache.org/manual/install.html

已将下载的文件复制到一个目录并设置路径。

然后我使用了 Grunt Exec Plugin:

在 Gruntfile.js 中配置就是这么简单:

exec: {
    'run_build_script': 'cd <navigate to the build script directory> && ant'
},