【问题标题】:How to run an ant build.xml from grunt?如何从 grunt 运行 ant build.xml?
【发布时间】:2016-10-19 22:10:35
【问题描述】:

是否可以使用 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,我想使用已经存在的东西。

【问题讨论】:

    标签: java xml ant gruntjs


    【解决方案1】:

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

    要求:JAVA JDK

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

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

    然后我用了咕噜Exec Plugin

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-01-16
      • 1970-01-01
      • 2014-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多