在Java / Eclipse中构建时复制数据文件 [英] Copying data files upon build in Java/Eclipse
问题描述
除了我的java源码,我有一些数据文件,我想在源代码构建时复制到构建目录。目前,我没有使用任何构建工具(例如maven或ant),而是仅在Eclipse中开发和运行单元测试。
我可以以某种方式请求Eclipse在构建我的java代码时复制这些数据文件?
Along with my java source, I have some data files that I would like to copy to the build dir when the source is build. Currently I am not using any build tools (e.g. maven or ant), but develop and run unit tests solely from within Eclipse. Can I somehow ask Eclipse to copy these data files when it builds my java code?
推荐答案
首先创建一个新的源文件夹调用它像res,你可以使用这个文件夹来存储你的数据文件。接下来打开项目属性(从项目的上下文菜单)中的
First Create a new source folder call it something like res, you can use this folder to store your data files. Next open the Java Build Path section of the project properties (from the context menu of the project). Select the Source tab. In this tab you can control the output folders of each of the source folders. By default eclipse copies all the non-java files int the source folder to output directory during the build.
这篇关于在Java / Eclipse中构建时复制数据文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!