20071204 Tuesday December 04, 2007

Adding Java Nature to an Eclipse Project

An overzealous configuration management (CM) guy recently decided to "restructure" our CVS repository without telling anyone in advance (I won't call him the more reverent term of "build meister" because of this). It needed to happen eventually, the project structure was unweildy and starting to get in the way, but it should have been done in coordination with the developers. Anyway, I digress...

The end result when I checked out the new project was that Eclipse no longer recognized it as a Java project. It took me a while to remember how to turn a regular project into a Java one, then I remembered something called the "Java Nature". I looked at an existing Eclipse project file (named ".project" in any project folder) that I knew was a Java project and saw this:

    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>

When I looked at the .project file that Eclipse created in the new project, I saw the following:

 <buildSpec>
 </buildSpec>
<natures>
 </natures>

...hmmm. Shut down eclipse, copy and pasted the <buildSpec/> and <nature/> stuff into the other file, restarted Eclipse, and viola!, I had a Java project again. A few more minutes of setting up source folders and library paths, and I was back in business. I think I'll let the CM guy fix the ant build file.

Posted by rickg ( Dec 04 2007, 10:46:32 AM PST ) Permalink Comments [0]