Ant in Eclipse - copy files from one project to another project
i have two projects in eclipse and i want to copy some files from one project to the other using Ant. Now i would like to do this without relying too much on concrete folder structures of the developer, so i hoped eclipses ant would have some knowledge about the current workspace and its projects.
Is that the case and if so, how ca开发者_开发知识库n i use that in Ant?
Thanks.
The Apache Ant version integrated in Eclipse does not include any extra Tasks that are Eclipse specific. Therefore you can only use properties for defining the path to other projects using hard-coded relative pathes.
The only alternative would be to include special Eclipse related tasks like http://www.ant4eclipse.org which allows to query and process eclipse project information.
I would not rely much on eclipse either but just define a property in the ant file like
<property name="project1_dir" value="some_directory" />
and use that througout the build file. This way you can easily use ant outside from eclipse. If for some reason you have to rely on eclipse, you could also define those in the ant properties of eclipse (Window->Preferences->Ant->Runtime->Properties), but I'd rather go the build.xml properties way.
精彩评论