When does Eclipse copy resources to the output folder?
I noticed that "sometimes" the resources i put into a source folder in my Eclipse project will not be copied to the output folder ("bin") immediately.
E.g. i change a properties file using the eclipse editor and save... and "bin" still has the old version.Does anyone know what exactly triggers the copying (and how i can trigger that from a plugin)? I thought it happened automatically when a resource changes.
-- EDIT --
To clarify what i meant by triggering it from a plugin: I have a plugin that depends on up to date resources in the output folder, but apparently the resources are outdated when my plugin is called. And that开发者_开发技巧's why i need to better understand what happens and how i can force it when i need to.
If you don't add the resource through eclipse (but for instance through the windows explorer), eclipse wont notice some changes until you refresh your project/folder. (right click in the packater explorer for instance).
After it notices the change it will copy it to the output folder when you build (often this is done automatically upon changes)
This is a Bug in almost all Eclipse versions, it happens without any reason. My eclipse 3.5.2 and 3.6.2 both meet this problem in someday. In my case, I need to copy modified .clj clojure source files to classes directory for immediate effection in a web app, now I have to set /src before /classes in CLASSPATH of web appserver startup script, It's solve my problem temporarily.
As @Thirler said, if you don't add the resource through Eclipse, it may not notice the files until you refresh your project. However, if the Refresh/Clean doesn't work (in my case, it didn't), you have to add the files to the folder structure IN ECLIPSE.
Just drag the file from the folder where it is in the file system using Finder/Windows Explorer, drop it into the same folder in Eclipse's Project Explorer (Eclipse will ask for overwriting, just say yes) and Voila!
EDIT: An easier way is to just navigate into the folder using Project Explorer and then Refresh (F5).
As far as I know it happens when you build the project. You don't need a plug-in, you just need to tell eclipse to do a build of the project.
There is an Eclipse setting Java > Compiler > Building > Output folder > Filtered resources
.
For unknown reasons, this was set to *.launch,*.testsuite,*.deploy,*.location,*.execution,*.datapool,*.artifact,*.html,*.svg
in my workspace (while the default seems to be just *.launch
). This was the reason, why my Eclipse constantly refused to copy a classpath resource index.html
.
Late response, but I just stumbled over this question but non of the answers helped me to convince Eclipse to do its job.
This happened to me when I imported an Eclipse project as a whole, including both src
and bin
directories. The fix is to Clean
the project: Project
-> Clean...
-> select your project and press Clean
. This should re-build the project and properly locate the resources needed.
精彩评论