在Java / Eclipse中构建时复制数据文件 [英] Copying data files upon build in Java/Eclipse

查看:109
本文介绍了在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,你可以使用这个文件夹来存储你的数据文件。接下来打开项目属性(从项目的上下文菜单)中的构建路径部分。选择标签。在此选项卡中,您可以控制每个源文件夹的输出文件夹。默认情况下,eclipse将在构建过程中将源文件夹中的所有非java文件复制到输出目录。

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屋!

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