Where to place external libraries


i have several external libraries that i want to save somewhere as part of my language. So the path should be relative to my language ... somehow ...

How can i achieve that? Some kind of Lib-Folder within my language?

What is the best solution to handle external libraries as part of my classpath? Is there any solution for that yet (see also MPS-5681)?



Is there any solution for the library problem in MPS 2? I don't know how to include jars in my project, too. Pathes are always global in the *.mpl file.
1. You should place all your .jar files under the language or solution folder. Usually we create a lib folder, next to .mpl or .msd file.

2. Add jars in MPS.

For language:
  Language Properties -> Design Time -> Libraries -> add jars

For solution:
  Solution Properties -> External Code -> Libraries -> add jars

3. Expand <module>/all models/stubs folder in MPS. All your classes should be there.
There is one more thing. All your imported stubs become a part of the solution/language, which means their visibility is exactly the same as of any model in the module. If you need to refer .jar(s) from the language (in so-called design time) and from the runtime of the language, it is better to create a separate solution representing libraries only.

Adding runtime dependency from solution:
   Language Properties -> Runtime -> Runtime solutions -> add solution
Ah, thank you very much. The trick is not to put the lib directory into the project folder but next to the *.mpl file. Then the *.mpl file contains a relative path to the *.jar file and I can check everything to a svn repository.
How does one do this in MPS 3? Whatever I try I don't seem to be able to add jars files to a language or solution (MPS 3 EAP2) and see them in intention code.
You need to add a model root to the language. The model root can be anywhere as long as you have a path variable defined in MPS preferences that matches a prefix of the absolute path. The path variable is used to rewrite absolute paths. This works only if the path is defined before the absolute path is added. This info is for MPS3.

Please sign in to leave a comment.