Skip to main content

Gradle

Gradle is a build tool that can be used easily with a large number of programming languages including Scala. With it you can easily define your builds for Groovy or Kotlin, which enables for a high degree of customization. You can look up all the possible features on the Gradle website.

Automatic installation

The first time you open Metals in a new Gradle workspace you will be prompted to import the build. Select "Import Build" to start the automatic installation. This will create all the needed Bloop config files. You should then be able to edit and compile your code utilizing all of the features.

Manual installation

In a highly customized workspaces it might not be possible to use automatic import. In such cases it's quite simple to add the capability to generate the needed Bloop config.

First we need to add the Bloop plugin dependency to the project. It should be included in the buildscript section:

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'ch.epfl.scala:gradle-bloop_2.12:1.5.17'
}
}

Secondly, we need to enable the plugin for all the projects we want to include. It's easiest to define it for allprojects:

allprojects {
apply plugin: bloop.integrations.gradle.BloopPlugin
}

Now we can run gradle bloopInstall, which will create all of the Bloop configuration files.

This will enable us to work with Metals and all features should work.