VSCode Task可以在任何地方运行ant buildfile [英] VSCode Task to run ant buildfile located anywhere

查看:327
本文介绍了VSCode Task可以在任何地方运行ant buildfile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个跨多个源目录的大型项目,该项目是在最近15年间开发的,它使用eclipse和自定义外部工具配置从源目录中任何位置的build.xml文件启动ant任务(我知道这很混乱!)

I have a huge project spread across multiple source directories which was developed the last 15 years using eclipse with custom external tools configurations to launch ant tasks from build.xml files anywhere inside the source directories (a big mess, I know!).

由于日常工作主要基于xml和JavaScript,因此我认为VSCode是一种轻量级的替代方案(因为eclipse例如无法在不超过HeepSpace的情况下处理大型xml文件). 任务运行器在我看来是将ant构建集成到编辑器中的一种好方法,它们也是宣传为能够运行ant构建:

As the everyday work is mostly xml and JavaScript based, I thought of VSCode as a lightweight alternative (as eclipse is e.g. unable to deal with large xml files without exceeding HeepSpace). Task Runners look to me like a great way to integrate the ant builds into the editor, they are also advertised as capable of running ant builds:

例如Make, Ant ,Gulp,Jake,Rake和MSBuild等.

Examples are Make, Ant, Gulp, Jake, Rake and MSBuild to name only a few.

我能够使用root文件夹中的build.xml运行ant builds.但是,这不是项目的结构.

I am able to run ant builds with the build.xml in the root folder. This is however not how the project is structured.

是否可以从不同于工作区根目录的目录中运行任务命令(以我为例)?

我想到了git的GIT_WORK_TREE环境变量或执行两个命令的方式(例如cd {{build.xml folder}} && ant).我当前的task.json是

I think of something like git's GIT_WORK_TREE environment variable or a way to perform two commands (like cd {{build.xml folder}} && ant). My current tasks.json is

{
    "version": "0.1.0",
    "command": "ant",
    "isShellCommand": true,
    "showOutput": "silent",
    "args": ["all", "jar"],
    "promlemMatcher": "" // I'm also not sure what to put here,
                         // but that's another question
}

(我在Windows上,顺便说一句-但来自linux/osx,对此处的工作方式有点陌生.)

(I'm on windows, btw -- but come from linux/osx and am kinda new to the ways thinks work here.)

推荐答案

您可以定义要使用的cwd目录.这样做是这样的:

You can either define the cwd directory to be used. This is done like this:

{
    "version": "0.1.0",
    "command": "ant",
    "isShellCommand": true,
    "options": {
         "cwd": "My folder to run in"
    }
}

请参见 https://code.visualstudio.com/Docs/editor/tasks_appendix以获取tasks.json文件的定义.

See https://code.visualstudio.com/Docs/editor/tasks_appendix for a definition of the tasks.json file.

这篇关于VSCode Task可以在任何地方运行ant buildfile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆