How to tell mps to use my own java classes


I'm very new to MPS but I like the idea very much. I finished the "Getting startet" tutorial and now I would like to use some of my Java Classes in MPS. So that i can use them inside a generator template for example, somethin like that: MyClass.doSth("xyz");

Is this possible in MPS? Is it possible to import a jar of a framework for example?



To use external classes in generator templates you should setup the 'classpath' property in your generator's owner language.

In the language properties dialog find the 'class path:' section, put caret into the '...' field and press to add new entry. Then choose path to your classes or choose jar file. If you need more classpath entries - press again. MPS will create one stub model for each package in your classpath. Those models will have name like: @java_stub

Before using those classes in your model you have to import correspondent stub models to your model (similar to the package importing in java).

You can do that using the model properties dialog or by hitting ctrl-M in editor (providing that one of your model's node is showing in editor).


i've created the FAQ page at MPS wiki


Please sign in to leave a comment.