Eclipse projects – The nature of things

Did you ever wounder what defines if a project is “pure” Java project or a Plugin project?

Have a look at the “.project” file. This file contains the description of your project. It contains a XML tag “natures” where the nature of the project is described. A plugin project has the nature “org.eclipse.pde.PluginNature” and a java project has the nature “org.eclipse.jdt.core.javanature”.

These tags will also steer some behavior of the development environment, e.g. a project with PluginNature will update the java class path if you change the dependency information in a plugin project. For example if you add the “org.eclipse.pde.PluginNature” to an existing Java project you get the PDE menu for your project.

 
Tags:
Filed under: Eclipse

Comments

  1. André Dietisheim Says:

    I struggled a few times with this already ;-)
    There are a few gotchas when modifiying the .project file while the project’s already present & active in the workspace. I usually tried this when importing maven projects I checked out in a first step (checkout maven project with m2eclipse has a bug, the wizard is not usable). The import stalled several times or even failed, leaving incomplete project that do not have the java nature. I then tried to add the java nature by hand. Unfortunately eclipse couldn’t manage this change. Even closing and reopen the project does not help. I had to delete an reimport.

  2. Lars Vogel Says:

    @André Seems like Maven introduces sometimes also problems. ;-)

Leave a Reply