Archive December 2008

Toggle view

eclipse and corrupt WTP metadata

Yesterday night I had spent an hour or so tracking down a bug that has been bothering me for a while.
The effect of this bug is that projects created with the m2eclipse plugin seem to be missing some important metadata required by the WTP plugins. As a result references to other projects (in workspace) do not show up as JavaEE (J2EE) module dependencies or sometimes even the project properties dialog for JavaEE module dependencies only shows an error.
I had analysed this bug a while ago already but never documented this, some more investigation is still required to figure out what causes this missing metadata and report it to the m2eclipse developers.

Anyway here is how to fix it. Let’s say we have a web project A and a utility project B. You face the situation that project B does not show up as JavaEE module dependency. Open B in the navigator view (so you can see all the metadata files .project, .settings/… etc.).
Look for a file .settings/org.eclipse.wst.common.component! Does it exist? If no just create it, its contents should be like



    
        
        
    

Next check the .project file



	PROJECTNAME
	

	
	
		
			org.eclipse.wst.common.project.facet.core.builder
			
			
		
		
			org.eclipse.jdt.core.javabuilder
			
			
		
		
			org.maven.ide.eclipse.maven2Builder
			
			
		
		
			org.eclipse.wst.validation.validationbuilder
			
			
		
	
	
		org.eclipse.jdt.core.javanature
		org.maven.ide.eclipse.maven2Nature
		org.eclipse.jem.workbench.JavaEMFNature
		org.eclipse.wst.common.project.facet.core.nature
		org.eclipse.wst.common.modulecore.ModuleCoreNature
	

In my case the file was missing some builders (should not be relevant for the bug)

  • org.maven.ide.eclipse.maven2Builder
  • org.eclipse.wst.validation.validationbuilder

and some natures (these really hurt)

  • org.eclipse.wst.common.modulecore.ModuleCoreNature
  • org.eclipse.jem.workbench.JavaEMFNature

green red blue grey