使用 ANT 查找工作区位置
我正在 Eclipse 的 Flash Builder 版本中编写构建脚本。此构建脚本需要将启动配置 .launch 文件导入到用户的工作区中。然而,似乎没有可用的 ANT var 来确定工作空间位置。在使用智能感知逐步浏览可用变量时,我注意到 ${osgi.instance.area} 确实指向我当前的工作区,但是当我尝试在正在运行的 ant 脚本中回显它时,它只是吐出“${osgi.instance.area” }”而不是路径。
任何帮助将不胜感激。谢谢你!!!
I'm working on a build script in the Flash Builder version of Eclipse. This build script needs to import launch configuration .launch files into the user's workspace. However there doesn't seem to be an available ANT var for determining the workspace location. While stepping through the available vars with intellisense I noticed that ${osgi.instance.area} does point to my current workspace but when I tried to echo it back in a running ant script it just spat out "${osgi.instance.area}" and not the path.
Any help would be greatly appreciated. Thank you!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果有人好奇我是如何实现这一点的,但是这是专门为 Flash Builder/Flex Builder 量身定制的(因为我们团队使用的是它),不幸的是我永远无法让 ${eclipse.home} 属性在 Ant 中工作,所以我必须使用 ${eclipse.pdebuild.scripts} 来获取安装目录:
If anyone is curious here is how I achieved this, however this is specifically tailored to Flash Builder/Flex Builder (as that's what our team uses) and unfortunately I could never get the ${eclipse.home} property to work in Ant so I had to use ${eclipse.pdebuild.scripts} to get at the installation directory:
FWIW,我认为这可能会为您提供与解决方案的 javascript 部分类似的功能。正则表达式对于实际使用来说可能过于简单。
供参考:Ant pathconvert 和 映射器 文档。
FWIW, I think this may give you similar functionality to the javascript part of your solution. The regular expression may be too simplistic for real-world use.
For reference: Ant pathconvert and mapper docs.
如果脚本在 Eclipse 自己的 JVM 中运行,这对我来说适用于常规 Eclipse 安装:
为了表示 Ant 脚本应该在 Eclipse 自己的 JVM 中运行,请打开“外部工具配置...”对话框,从中选择您的脚本在左侧面板中,转到“JRE”选项卡,然后选择明显的单选按钮。
阿姆农·格罗斯曼
This worked for me with a regular Eclipse installation, providing the script is run in Eclipse's own JVM:
In order to denote an Ant script should run in Eclipse's own JVM, open the "External Tools Configurations..." dialog, choose your script from the left panel, go to the "JRE" tab, and choose the obvious radio button.
Amnon Grossman