3.5. Importing an existing project¶
Follow this quick start guide to change an existing Java project such that you can use Metaborg languages in it.
Open the project in IntelliJ IDEA.
Go to the Project Structure dialog, either through the File → Project Structure... menu item, or by pressing Ctrl+ Alt+Shift+S.
Go to the Facets tab.
Click the button and select Metaborg from the drop-down menu.
Select the module to add the facet to, and click OK.
In the Modules tab, select the module.
Go to the Dependencies tab.
Select the Metaborg SDK as the module’s SDK.
If the Module SDK displays <None> and you can’t select the Metaborg SDK, then you need to add it first.
Click the New... button next to the Module SDK field.
Select Metaborg SDK.
You may get a warning if you have no Java JDK configured. Click OK and configure the JDK’s home location. The suggested home directory is usually correct. Click OK.
Select a home directory for the Metaborg SDK. The default is the Spoofax plugin’s
lib/folder, which is sufficient as it contains all the core dependencies.
Click OK to apply the changes.
The Java project will have the Metaborg facet, indicating that the
project uses Metaborg languages. It will also have a
which specifies the language dependencies of the project.