开发者

eclipse projects and compiled data

开发者 https://www.devze.com 2023-01-19 20:22 出处:网络
in my Java Eclipse project that contains JUnit tests, I also have a package \"resource\" that contains all input data used for the tests. But when compiling JUnit te开发者_运维百科sts, the Java compil

in my Java Eclipse project that contains JUnit tests, I also have a package "resource" that contains all input data used for the tests. But when compiling JUnit te开发者_运维百科sts, the Java compile also data available in resources, so I find the same data in the "bin" folder. Is there a way to avoid this?

thanks.


If you have a particular package within the source path you want to exclude (your resources folder for example), you can right click on the package and select: Build Path > Exclude.

This will tell Eclipse that you don't want to include that package as part of the build.

This is making a couple of assumptions: that you're using Eclipse Helios (because the option might be different in older versions), and that the resources are stored in the same folder as your regular java source files (because if resources is in a folder by itself, you can remove that entire folder from the build by using Build Path > Configure Build Path -> Source tab.

Update:

After the discussion in the comments regarding why you would or would not want to copy resources into the bin directory:

  • The contents of your bin directory should be ignored and not checked into to a version control system (when using CVS, bin should be an entry in the .cvsignore file)
  • The resources are only duplicated on your local machine, which is fast and hard discs are big. I'm not sure you should be worrying about this
  • If you're using Class.getResource to access those resources, they need to be on the classpath somewhere. The bin directory is as good a place as any

So, realistically (barring some unknown, like the files are hundreds of gigabytes or something), I don't think you need to be concerned about excluding these files from the build.

0

精彩评论

暂无评论...
验证码 换一张
取 消