Wednesday, May 13, 2015

XText hiccups on Luna SR2 and XText 2.7.3

It's not every day that you set up a new XText project. For me, I end up dabbling with my own DSL once in a few months and unfortunately most of the times the setup of the project is fraught with hiccups.

Today, I tried to set up a new XText project on Ubuntu 14.04 + Eclipse Luna SR2 (4.4.2) and XText 2.7.3. The first thing I encounter is a failure stating a failed plugin dependency on org.eclipse.equinox.common.

To fix this, I had to open up MANIFEST.MF and add the dependency in the Require-Bundle section:

Require-Bundle: org.eclipse.xtext;visibility:=reexport,
org.eclipse.xtext.xbase;resolution:=optional;visibility:=reexport,
org.eclipse.xtext.generator;resolution:=optional,
org.apache.commons.logging;bundle-version="1.0.4";resolution:=optional,
org.eclipse.emf.codegen.ecore;resolution:=optional,
org.eclipse.emf.mwe.utils;resolution:=optional,
org.eclipse.emf.mwe2.launch;resolution:=optional,
org.eclipse.xtext.util,
org.eclipse.emf.ecore,
org.eclipse.emf.common,
org.eclipse.xtext.xbase.lib,
org.antlr.runtime,
org.eclipse.xtext.common.types,
org.objectweb.asm;bundle-version="[5.0.1,6.0.0)";resolution:=optional,
org.eclipse.equinox.common;bundle-version="3.6.200"

This seems to solve the problem. You can also do it via the dependencies tab in the plugin editor (once you open plugin.xml with the plug-in manifest editor.)

Important thing to remember is not to add equinox.common as a project class path dependency. Remember that this XText project will run as a plugin in eclipse and it will try to resolve its dependencies via the MANIFEST.MF.

BTW, once I satisfied the equinox.common dependency, the MWE2 wanted to patch the version of ANTLR. This was driven through a console input request - so keep a lookout for it too.


Update - 14/May/2015 3:35 PM

The above was in the morning.. It turned out to be a day of scalp scratching stuggle with Eclipse and XText. Damn it, there is so much of backward and forward compatibility problems with XText and PDE!

It turned out that although the above got the MW2 compiler to start working and seemingly do everything right, the language would not open up the XText editor in eclipse. Bah! Struggled with it for nearly three hours and finally updated my XText plugin from 2.7.3 to 2.8.2.

2.8.2 works like a breeze. Seems like quite a few hiccups have been fixed on the way. Keeping my fingers crossed for a smooth sailing here on.

No comments: