繁体   English   中英

如何从grunt运行ant的build.xml文件?

[英]How to run an ant build.xml from grunt?

可以运行带有grunt的ant脚本,如果可以,怎么办? 目前,我们的eclipse项目包含一个build.xml文件,该文件可以合并并缩小一些CSS和JS文件。 我想将其与Grunt Watcher结合使用,但是在研究期间,我找不到可以运行xml ant脚本的Grunt插件。

因此,在我的Gruntfile.js中,将有一个类似这样的Grunt Watch任务:

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

我还可以使用grunt配置另一个缩小任务,而不会出现任何问题,但是由于其他人尚未在计算机上配置grunt,因此我想使用已经存在的东西。

我想我找到了一个解决方案(适用于Windows):

要求:JAVA JDK

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

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

然后,我使用了Grunt Exec插件

在Gruntfile.js中,配置非常简单:

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

暂无
暂无

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

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