I have a project structure like this:
1. Core-solution with java-stubs for my core java functionality
2. Implementation-solution with java-stubs for my custom java functionality (classes implement interfaces from "core" library)
3. Language describing how to work with core functionality (depends on core-solution)
4. Working-solution (depends on language and implementation-solution)
My working-solution "connects" language that works with interfaces with a stub-solution that contains actual classes implementing these interfaces. So later there may be multiple different implementation-solutions, and multiple working-solutions for each implementation-solutions.
In my language I have a concept that has a reference of type ClassConcept
. Language checks it against interfaces A
from core-solution, and working-solutions specify any class from implementation-solution that implements A
But my language at design-time needs to create an instance of actual class, specified by working-solution, to get some data from it, describing what user can or cannot write.
Can I specify a .jar
dependency (runtime/design-time) to my implementation-solution or working-solution, so that when it instantiates a concept - language will be able to see the specified class, and to instantiate it?
Thanks in advance!
I use MPS 3.2.3, and I already tried this:
I added my core-java-library to my core-solution as "java dependency" (Module properties -> Java -> Libraries
as "default") and now language successfully executes Class.forName
for one of core classes, but it's cuz language is directly depends on core-colution.
Then I tried to add my implementation-java-library as "java dependency" to my implementation-solution, so I thought when working-solution (depending on implementation-solution) will call a language concepts - java classes will be in the classpath, and available to the language.
For reference (sorry for X-Files, work-project):
But when language tries to execute Class.forName
for one of the implementation classes - it gets jetbrains.mps.classloading.ModuleClassNotFoundException: Unable to load class: storyengine.dx.specs.service.IssueOrder using ModuleClassLoader of storyengine.storyteller module
But it works fine, if I add implementation-java-library to my core-solution, or language itself. It seems like when language tries to find a class, it uses only its own classpath, without libraries added to a solution that actualy calls
I thought I will be able to create a build of my language depending on core-java-library and solution with its stubs, and then just include it to builds of specific solutions, depending on specific java-libraries. But either I do something completely wrong, or I'll have to create a separate build of my language with each new specific java-library.
(Sorry for longpost, wanted to be sure I mentioned all the details, since they might be important.)