Where to place external libraries

  • 25
  • 4

Hi,

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)?

Regards,

Mirko

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.