eclipse: Project not built due to "Could not read file ... ~$somefile.xlsx"

eclipse, excel, java

Solution

Go to:

Project > Properties > Resource -> Resource Filters -> Add

Select:

- Exclude all

- Files

- All children (recursive)

Name matches: ~*

That should prevent eclipse picking up MS office tmp files.

Problem

I've got a excel file(somefile.xlsx) in my maven project. A temp file `~$somefile.xlsx` would be generated automatically, if I modify this file. It also disappear automatically if I close the file. With the existence of this temp file, eclipse failed to build my project. The problem window said: `The project was not build due to "Could not read file :D:\myworkspace\src\main\java\com\mycompany\suites\~$somefile.xlsx".` How to resolve this kind of problems? Should I try to tell eclipse or maven to ignore this temp file -- is there such a way?

Original source