Search code examples
eclipse-plugineclipse-emfemfxcore

'GenModel cannot be resolved' errors


Suddenly there are build error in all of my Xcore model files. I don't know what I changed in my projects to deserve this.

The error message is the one in the title of the post:

GenModel cannot be resolved.

The errors are from the GenModel annotation on the package declarations of the XCore files:

@GenModel(modelDirectory="/com.organisation.project/src-gen")
package com.organisation.project.package;

Details

  • The plug-ins do specify the org.eclipse.emf.ecore.xcore.lib required bundle. PDE reports no errors for the require bundle clause in the manifest file.
  • The Target Platform State view in Eclipse contains the org.eclipse.emf.ecore.xcore.lib bundle.
  • If I add the following line in the Xcore files then the build errors disappear:

    annotation "http://www.eclipse.org/emf/2002/GenModel" as GenModel
    
  • Xcore SDK version: 1.4.0
  • EMF SDK version: 2.12.0
  • Eclipse for RCP and RAP Developers version: 4.6.2

Solution

  • I think I had this problem because Eclipse was confused about the target platform somehow.

    Possibly the reason was that I had the EMF source code project opened in my workspace. When I closed them Eclipse did not understand that it again had to used EMF from the target platform.

    Setting the target platform to Running Platform, then setting it back again resolved the issue. (The same technique that is recommended at Vogella.)