Search code examples
eclipserad

Eclipse creates too many (millions) of local history files?


My Eclipse environment continually creates local history files, and I cannot figure out why. Over the course of a month, I end up with several million files in .metadata/.plugins/org.eclipse.core.resources/.history

Almost all of them are small files, copies of some MANIFEST.MF. All are the same.

I am using RAD 7.5, with the m2eclipse plugin (maven), and ClearCase. I use the following setup:

Project | Build Automatically is turned off Preferences | Workspace | Local History is set to keep only 1 history version, and to keep the file for only 1 day.

I had one project alive for several months, and there were more than 20 million local history files created. This many little files is a serious problem for Windows -- I even got a blue screen when I attempted to delete them.


Solution

  • I found a problem with the projects that seem to be continually creating these history files. Each project that had this problem contained an empty configuration file

    org.eclipse.wst.common.component
    

    Actually, the file was not quite empty. It's contents looked like this

    <?xml version="1.0" encoding="UTF-8"?>
    <project-modules id="moduleCoreId" project-version="1.5.0"/>
    

    Since these projects are all JSF projects, the component file should look something like this. I manually editted the file (in MyWebApp/.settings/org.eclipse.wst.common.component), restarted Eclipse, and immediately noticed that the system was much faster, and history files were no longer being created.

    <?xml version="1.0" encoding="UTF-8"?>
    <project-modules id="moduleCoreId" project-version="1.5.0">
      <wb-module deploy-name="MyWebApp">
        <wb-resource deploy-path="/" source-path="WebContent"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
        <property name="context-root" value=".MyWebApp"/>
        <property name="java-output-path" value="WebContent/WEB-INF/classes"/>
        <property name="jsf.base" value="7.5.0.0"/>
        ... the above property (I think) is RAD specific
        ... many more property elements with name="jsf.*" 
      </wb-module>
    </project-modules>
    

    If you use maven, you have to be careful with the source-path attributes. The default by maven is probably "/src/main/webapp", but for my project (and in the above configuration), I needed the Eclipse default of "WebContent" (Sometimes the default is "Web Content").