tags:

views:

34

answers:

2

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.

A: 

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.

Andrei Fierbinteanu
you need to have 'build automatically' checked in the project menu for it to do it by itself. If you do, and it still doesn't do it, you may need to add the folder containing the file to the build path. The fact that you said the output folder contains the 'old' version suggests that is it on the build path and was copied there at some point. But if you just added it, and there's no 'old' version you may need to refresh the project to see if it was moved in the output folder as well
Andrei Fierbinteanu
That's not it. The output folder gets updated occasionally. e.g. when i do a clean or when the workspace is launched. The file has been in the same location, was edited using eclipse and my Java sources in the same project are built and copied automatically.
Stroboskop
+1  A: 

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)

Thirler
it's the "often" part that bothers me, since it doesn't happen during build phase in my test environment
Stroboskop
If you're building an Eclipse plug-in, you can do a refresh from the plug-in. Take a look at the IProject interface.
Gilbert Le Blanc
@Stroboskop: For Java projects its a setting in the build menu, which is on by default. For other projects it depends on the type of project and the plugin.
Thirler
But wouldn't a "refresh" only synchronize with the filesystem and not copy the resources from source to output folder?
Stroboskop
I'd guess its officially in the automatic build that happens afterward that they get copied, but the effect is the same, the folders get updated.
Thirler