Building MPS: Package com.intellij.idea does not exist

The directions for building MPS suggest installing IntelliJ community edition, and then adding two SDKs in the “Project Structure” dialog.  One is a file downloaded from build artifacts, and another I did by pointing to the IntelliJ IDEA installation directory itself… and calling it IDEA IC.  I did that, and it allowed the build to start.

However, after compiling a little while it says com.intellij.idea.Main is not found, and has other complaints about com.intellij.openapi.*.  I did check to ensure that the "Plugin DevKit" was downloaded and enabled.

Based on advice for resolving “does not exist” issues, I also tried deleting the MPS/.idea directory and invalidating caches and reindexing, but this did not help.  (also the .idea directory appears to be committed to GitHub, so perhaps that advice is outdated or not applicable)

Here's what the situation looks like:

If I hover over the “idea” and “openapi” parts of the includes, a popup shows indicating there are things in the namespaces… just not things like Main, PathManager, or SystemInfo:


 

=== UPDATE ===

I have hardly any Java experience, but I don't like giving up, so I kept poking at it.

One thing I changed that made some headway was going to the “Project” tab of the “Project Structure” dialog and changing the project SDK from the JB JDK 17 to the IDEA IC and it started finding some com.intellij.* things--proof they are in there!

It didn't find com.intellij.idea.Main … searching on a jar-lookup website it suggested that was resident in a `bootstrap.jar`.  I obtained this by building the intellij-community repository myself, and added the jar file manually to the IDEA IC classpaths.

But then there were many other things it did not find.  The next was things in the `org.eclipse.jdt` namespace, and that was in the intellij-community lib directory as `ejc-4.25.jar`.  So I thought to try switching and using the IntelliJ IDEA I'd built instead of the prebuilt one I'd downloaded, since it seemed to have “more stuff”.  Unfortunately, when I went through the same process of trying to add this new intellij-community as its own “IDEA IC”, it raised an error and silently did not add an entry to the SDK list at all.

In the spirit of experimentation, I tried going back to the pre-built IDEA that I had downloaded and asked it to use the intellij-community I built as its “IDEA IC”.  But when using that platform SDK as the Project SDK it stopped being able to find java.util.list and other basics--which it was somehow able to inherit even when using the prebuilt IDEA as a platform SDK.  :-(

So I went back to the prebuilt IDEA and just kept hunting for .jar files.  The next things I hit were problems of missing all sorts of things in the kotlin namespace.  I cloned Kotlin and tried to build it, and I could find jar files for some things…but it was a whack-a-mole situation where every time I would get one thing resolved I'd just find another thing that wouldn't resolve.

Through all this I'm learning by osmosis some things about using the IntelliJ environment.  But it certainly can't be intended to be this difficult…any suggestions on what's going wrong?

0
8 comments
If you are using IDEA 2023.3 you should install the Ant plugin. MPS needs it to download its dependencies before compilation. This is a new thing in IDEA and I have yet to update the documentation.
0

All right then… I installed the ant plugin.  It seems that instead of using the "Build" menu I have to go to View=>Tool-Windows=>Ant, then go to the shown window and select MPS and “Run Build”.

I could see it downloading dependencies like the Kotlin libraries (which I had tried adding in a painful manual process).  However when it gets to building `java.compile.modules.java.cycle.2` I got:

    java.lang.OutOfMemoryError: Java heap space

I tried increasing the amount of memory with Help=>Change-Memory-Settings.  It was set at something around 2600 at first and it said that was the maximum.  I ignored the maximum and tried 4000 and 8000 but this did not help.  (I'm running on a laptop with 64 GB memory inside a Virtual Machine with 44GB memory.)  I didn't know if it made sense to keep bumping it considering it told me 2600 was the maximum at the outset.

So I tried installing the command line version of ant, and that was able to do the build.  Once the build was finished, I wasn't sure what to do.  The IDE still thinks the solution has undefined symbols (so com.intellij.idea does not exist, and the symbols are red).  "Run" in the IDE brings up a popup that says “Edit Configuration”.  When I picked the EXE target in the Ant view and chose “Run Target” it built (or rebuilt?) packages for the various platforms vs. running.

I found 222.3345.SNAPSHOT-linux.tar.gz in the build artifacts.  When I unzipped it, it had an mps.sh and I could run that...bringing up the MPS splash screen and then running MPS.

So that's some level of success!!  But I'd like to have the IntelliJ IDE resolving symbols and be able to debug the executable…how are the MPS developers doing that?

Thanks!

0

"It seems that instead of using the "Build" menu I have to go to View=>Tool-Windows=>Ant,"

Why is that? Does the “Rebuild project” action in the Build menu not work for you?

0

I was using “Build Project”, not “Rebuild Project".  I started a new VM just to check the process from scratch, and the build command now triggers Ant, but still isn't working correctly.

Here are my sequence of steps on Kubuntu 22.04, freshly done:

Step 1: Install IntelliJ IDEA Community Edition using JetBrains Toolbox
(Help=>About : Build #IC-233.11799.300, built on December 12, 2023)

Step 2: Download JetBrains Runtime to ~/jbrsdk/
jbrsdk-linux-x64.tar.gz @ MBMPS_20233_Distribution_GetResources/4414078

Step 3: Use IDE Setup SDK option to Add SDK

Step 4: Confirm Environment Works by Running Tour's Welcome.java
`AVERAGE of array [5, 6, 7, 8] is 26.0` [sic]

Step 5: Install "Plugin DevKit" Plugin from Settings
233.11799.300

Step 6: Install Ant Plugin from Settings
233.11799.196

Step 7: Clone MPS Sources to ~/MPS
git clone https://github.com/JetBrains/MPS --depth 1

Step 8: Open MPS Sources

Step 9: In Project Structure, Rename jbr-17 SDK as “JB JDK 17”

Step 10: In Project Structure Add Platform Plugin SDK “IDEA IC”
/home/ae1020/.local/share/JetBrains/Toolbox/apps/intellij-idea-community-edition
Select "JB JDK 17" as SDK to use here

The Project Structure => SDK now looks like this:

The “Problems (2)" say:

There are circular dependencies between:
'kernel' module, 'project' module, 'constraints-runtime' module, 'behavior-runtime' module
'kotlin-stub' module, 'persistence' module
'kernel-resources' module, 'make-runtime' module
'intentions-runtime' module, 'editor-runtime' module, 'actions-runtime' module
Tests of 'pattern-runtime' module, tests of 'textgen' module, tests of 'editorlang-runtime' module, tests of 'java-stub' module, tests of 'mps-platform' module, tests of 'misc-tests' module, tests of 'persistence' module, tests of 'mps-workbench' module, tests of 'editor-runtime' module, tests of 'make-runtime' module, tests of 'generator-engine' module, tests of 'kernel' module, tests of 'testbench' module

Library Runtime classpath has broken classes paths:   /home/ae1020/MPS/lib/jetbrains-annotations.jar   /home/ae1020/MPS/lib/intellij-coverage-agent-1.0.723.jar [Fix]

At this point, the Run |> button says “Update gensources.iml and compiler.xml”

Since I'm not sure if I should do that, I first try “Build Project”.  It goes for a while and says “Build succeeded with 9 warnings” but only seems to have built “MPS Dependencies”.  Several symbols are undefined:

“Rebuild Project” does the same thing over.  Trying the Run |> button now, it says:

Analyzing MPS modules...
Building gensources module 1/2...
Building gensources module 2/2...
Saving...
Done.
Add compiler excludes...
Done.

Process finished with exit code 0

The build menu looks like:

When I build the mps `<default target>` it does the packaging like I got in the command line Ant build:

So I guess it is working.  But the IDE still has undefined symbols, only this time it's Java things instead of the com.intellij.* things?

And I still don't see how to run it under the debugger…

0

You seem to have done all the steps correctly in order to build the project.

Does your Run menu in IDEA offer you the ability to run/debug the project?

When you select “MPS”, does it start MPS or does it give you some errors?

0

Selecting to Debug MPS seems to have switched that section in the titlebar that previously said: “Update gensources.iml and compiler.xml” so it then said “MPS”.

Apparently that is a drop down combo box, from which MPS could be selected.  Once it was, then instead of that “Analyzing MPS modules…Building gensources module 1/2…Building gensources module 2/2…"  stuff, it executed!

(So I guess there's either a missing step to select MPS from the “Run/Debug Configurations”…or perhaps there's some way of making MPS the default configuration instead of “Update gensources.iml…” ?)

Executing it seemed to cause all the missing symbols to light up!  Though the console output from debugging gives a fair number of warnings:

  https://gist.github.com/AE1020/9c1217d4df997373f861070a6e6a6032

It runs, and gives a message about the Ant plugin requiring com.intellij.modules.java to be installed:

Is there anything I should tend to in those warnings or can they be ignored?  I'm also curious about the “Problems” mentioned in the Project Structure about cyclic dependencies…is that normal?

Thanks!

0

It is good to hear that things started working for you. I'll revisit the guidelines and add more details about choosing the right run configuration.

You can safely ignore the warnings. They report internal problems in the MPS code that we are gradually looking into.

As for the missing dependency of the Ant plugin, this to me looks like some misconfiguration or a temporary problem. I do not get that on a fresh IDEA installation. You can most likely ignore it.

0

Encounter an error while building MPS (Meta Programming System) due to the absence of the "com.intellij.idea" package. Troubleshoot by ensuring that the required IntelliJ IDEA dependencies are correctly configured and accessible within the MPS project structure. Document your troubleshooting steps and findings with branded pens, facilitating organized record-keeping and communication as you address and resolve issues related to package dependencies during the MPS building process.

0

Please sign in to leave a comment.