(Last updated on Oct 20, 2021)

The problem

You have created a language based on the mbeddr platform, MPS Extensions, or KernelF (or all of the above). Now the time has come to create a build script for your language to package it for delivery to the users. However, after creating the build script you get an error message saying Error: dependency on a module not visible from current build project:

Dependency on a module not visible from current build project

What is going on here?

The solution jetbrains.mps.samples.theSimplestLanguage.sandbox depends on a module1 (here org.iets3.core.base) but the build script doesn’t have the information required to locate this module.

Even though you can build the project successfully from MPS, the build language is designed to describe your project on a lower level. Rather than depending on libraries or plugins, build scripts depend on other build scripts. Build scripts produce artifacts in a certain layout and the build scripts that depend on them expect to find these artifacts in a certain location in this exact layout.

Is the dependency required?

Before continuing, check (or ask yourself) whether the dependency is indeed intentional and required. You could have added it by accident (it’s very easy to just press Enter in response to a pop-up dialog that MPS shows when importing models). Or perhaps it was required by an intermediate version of the code but is no longer necessary in the final version.

To check, open the properties of the depending module. If the dependency is grayed out, it means it is unused and you can remove it.

Adding missing dependencies

Switch from plugins to project libraries

If you have installed your dependencies from the JetBrains Marketplace as plugins, you will need to switch to using project libraries:

  1. Download the corresponding distribution from GitHub or itemis Nexus.
  2. Unpack the distribution into a folder. I recommend using a subdirectory of your MPS project directory, such as deps.
  3. Add the unpacked distribution as a project library. You can also add the entire deps directory instead.

Add the dependency to the build script

  1. Open the build script of your project and go to the dependencies: section.
  2. Press Enter to add a new entry.
  3. Import the model containing the build script you want to add. Do it either by using the usual Ctrl/Cmd+R shortcut and typing the build script name or by using Ctrl/Cmd+M and searching for the model containing the build script.
  4. Type ( to have the (artifacts location .) text appear. Replace the . with the location of the distribution. Example: ./deps/org.iets3.opensource.

The result should look like this:

Dependency on org.iets3.opensource added

After adding the dependency use the Reload modules from disk intention to update the module dependencies and the error should disappear.

Here are the build scripts you need to depend on for some of the popular libraries (as of October 2021). The build script link opens the script in MPS:

Project Build Script Containing Model
KernelF/iets3.opensource org.iets3.opensource org.iets3.opensource.build
mbeddr Platform com.mbeddr.platform com.mbeddr.mpsutil.dev.build
MPS extensions de.itemis.mps.extensions de.itemis.mps.extensions.build

More Resources

  • Kolja Dummann has recorded a Twitch stream on the topic of setting up the build of an MPS project. The video is part of the “Heavy Meta” series of videos about MPS.

  1. This is of course just an artificial dependency added to theSimplestLanguage sample project for demonstration purposes. ↩︎