You open your project and find that lots of modules are shown with “(read only)” text near their names.
You try editing them and they are, in fact, read-only.
What has happened?
MPS loaded some modules from JARs rather than from their sources. MPS will only load a module once and will ignore any duplicate modules.
How could MPS load one module twice? Usually this is caused by a problem in the project setup.
For example:
- The command-line build places the built artifacts under
build/artifacts
. - You have set up your build to fetch additional project libraries but instead of placing them under
build/dependencies
(as I recommend in the linked post) you placed them underbuild/artifacts
as well. - You have added the entire
build/artifacts
directory to MPS as a project library.
If you now perform a clean checkout and open the project without building it and open it in MPS, everything is editable
and works as usual. Then you build a project from the command line. The build creates artifacts in build/artifacts
.
You open the project, and boom! MPS loads the built and packaged modules from build/artifacts
first and everything is
read-only. When it later sees the same modules as part of the project, it will silently skip over them.
To find out where a module was loaded from, open its properties by selecting the module in the project tree and pressing Alt+Enter. The path will be shown under File path. If you see a JAR file in there, like in the image below, you may have become a victim of misconfiguration or unexpected path shrinking. In that case double-check the path variables and project libraries for any invalid values.