在Eclipse为Ant动态BASEDIR [英] Dynamic basedir for Ant in Eclipse
问题描述
标题可能不是最好的,所以让我解释什么,我试图做的。
The title might not be the best so let me explain what I am trying to do.
我做了一个Ant构建,这将有助于我Maven目标。它是如此容易得多不得不范围Ant视图,选择什么,我想做的事情。这样做的最大好处是,我可以在几乎任何项目中使用它。我是否部署到Tomcat或JBoss的或酒井(:部署)或我处理在同一台服务器的多发instaces或跳过测试......最坏的情况下我只是改变一些路径属性。
I have made an Ant buildfile that will help me with Maven goals. It's so much easier having to scope to Ant view and choose what I want to do. The biggest benefit with this is that I can use it in almost any project. Whether I deploy to tomcat or jboss or sakai(:deploy) or I handle mutiple instaces of the same server or skip tests... worst case I just change some path properties.
现在的缺点是,我要保持这种生成文件的副本保存在每一个项目。
The drawback right now is that I have to keep a copy of this buildfile in every project.
我所试图做的是只有1构建文件,在工作区,dinamicaly optain,从日食,我的工作就当前项目。被它模块或父母,我可以以后完善。
所以基本上改变BASEDIR基于Eclipse中选定的项目的Ant任务。
What I am trying to do is have only 1 buildfile, in the workspace, and dinamicaly optain, from eclipse, the current project that I am working on. Be it module or parent I can refine that later. So basically change the basedir for ant tasks based on the selected project in eclipse.
我已经试过蚂蚁运行属性,但对于像
I have tried Ant Runtime Properties but for some reason properties like
$ {} project_path
${project_path}
不给我其描述说什么。我得到这样的:
fail to give me what their description say. I get this:
变量引用空选择:$ {} project_path
Variable references empty selection: ${project_path}
我希望这是清楚我想要做的事。所以我的问题,我知道这是可能的,我只是失去了一些东西,我希望你们中的一些可以帮助我。
I hope it is clear what I am trying to do. So my question, I know it's possible, I'm just missing something and I hope some of you can help me with this.
我相信麻烦的是在Ant运行属性。我不是100%肯定,我应该如何使用它们。
I believe the trouble is in the Ant Runtime properties. I'm not 100% sure how I should use those.
感谢您!
推荐答案
修改意见,并作进一步调查。经过结果
让作为BASEDIR属性像蚂蚁PROJECTDIR:结果窗口> preferences>蚂蚁>运行>属性
结果
并创建一个名为BASEDIR与价值属性之一:结果
EDIT after comment and further investigation..
Make the projectdir available as basedir property for ant like that :
Window > Preferences > Ant > Runtime > Properties
and create a property named basedir with value either :
$ {project_loc}
结果
或结果 $ {workspace_loc} / $ {PROJECT_NAME}
搜索
和
<project basedir="${basedir}">
<echo>$${basedir} = ${basedir}</echo>
</project>
将如预期,意味着月食呼应/ yourworkspace / PROJECTDIR
will work as expected, means echoing eclipse/yourworkspace/projectdir
也许还有其他的方式,比如通过蚂蚁插件Ant4Eclipse 的,其目的是使可供蚂蚁Eclipse的设置,从未使用过它。
Maybe there are other ways, i.e. via Ant Addon Ant4Eclipse, which aims to make Eclipse settings available for ant, never used it.
这篇关于在Eclipse为Ant动态BASEDIR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!