Bass
Bass

Reputation: 5338

Eclipse unable to clean build output

I have an Eclipse (4.4.1) working set consisting of ~60 projects (the number may be relevant, as it takes more time to refresh the workspace). Occasionally, I encounter build failures because Eclipse is unable to clean the output folder before build:

Eclipse build problem

It turned out that the process which locks the file is Eclipse itself:

enter image description here

It also turned out that files being locked are always of XML content. Particularly, if I define resources with *.foo extension as XML files (via Preferences -> General -> Content Types), there's a good chance they will be locked, too, once they're copied to the output path.

I thought the problem was caused by all XML resources being validated automatically:

enter image description here

-- so I added exclusion filters 1st and even disabled XML/XSD validation entirely. The problem stopped occurring that often, but still emerges from time to time. Refreshing or closing-reopening a project isn't helpful.

The only remedy is restarting Eclipse or running Unlocker every 1/2 hour, which is not very convenient.

Any ideas how to solve or at least further diagnose this?

Upvotes: 6

Views: 7311

Answers (5)

s106mo
s106mo

Reputation: 1253

I'm not familiar with the problem, but I would tackle the problem this way:

  1. download File Leak Detector
  2. add the agentpath to your eclipse.ini (e.g., -javaagent:path/to/file-leak-detector.jar=http=19999, see documentation of File Leak Detector)
  3. when the problem happens again, see which (eclipse) class is responsible for holding a handle of the file
  4. Find out what is the purpose of the class that holds the handle

This way, you are maybe able to pin down the Eclipse feature that causes your problem.

Upvotes: 1

devops
devops

Reputation: 9187

Just my 2 cents.

Perhaps you can fix this issue by following this steps:

  1. Project -> Properties -> Builders -> New -> Program
  2. Define a custom "Cleaner"-Program, for example Unlocker or your own Java- or CMD-script
  3. Move your custom Builder-Program up. It should be the first Builder in the list

P.S. some times i have similar problems caused by Avira Antivirus Scanner...

Upvotes: 3

M The Developer
M The Developer

Reputation: 59

I have experienced similar issues. Yes, the number of projects is probably the cause. Close the projects not in use. If that cleans things up moving groups of related project into separate work spaces should help you out.

i.e File-> Close project

Upvotes: 1

Basilevs
Basilevs

Reputation: 23921

Disable third-party version control daemons. (Like TGitCache).

They only lock resources for a short while and are not visible in Process Explorer, but are the most frequent cause of such failures.

Upvotes: 2

Little Santi
Little Santi

Reputation: 8803

Assuming that XML Validation is the main cause of your problem, I suggest you extend your search for validation points in your projects' configuration, to set off all of them:

  • General preferences/Validation
  • General preferences/XML/XML files/Validation (the "honour all schema locations" option might be causing delay at validating)
  • Project preferences/Validation (check them; might be overriding the general preferences)
  • Project preferences/Builders/Validator

Hope it helps.

Upvotes: 1

Related Questions