Bloop

Bloop

  • Install
  • Docs
  • GitHub

›Build Tools

General

  • What is Bloop
  • Integration Guide

CLI

  • CLI tutorial
  • CLI --help

Build Tools

  • Overview
  • sbt
  • Maven
  • Gradle
  • Mill

IDEs

  • Overview
  • IntelliJ
  • Metals

References

  • Debugging Reference
  • Performance guide
  • Build Server
  • Built-in Launcher
  • JSON Configuration
  • Contributing Guide
Edit

Gradle

Getting Started

Configuring bloop in your Gradle projects will speed up your Scala development significantly. It is highly recommended to use Bloop in Gradle because Gradle has a pretty long development cycle and it takes a long time to do basic build operations such as compilation or running an application. Learn how to get set up by following the instructions below.

Requirements

  • At least Gradle v4.3, latest (tested) supported version is v6.1

Install the plugin

Here is a list of the latest Bloop stable and development versions.

Version Published Resolver
1.5.0 28 Apr 2022 07:55 -r sonatype:releases
1.5.0-18-003e6c7b 10 May 2022 15:56 -r sonatype:releases

Add bloop to your build.gradle with:

buildscript {
  repositories {
    // Add here whatever repositories you're already using
    mavenCentral()
  }

  dependencies {
    classpath 'ch.epfl.scala:gradle-bloop_2.12:1.5.0'
  }
}

Then, enable bloop in all your Gradle projects with:

allprojects {
  apply plugin: 'bloop'
}

For a more advanced configuration, read the Plugin Configuration below.

Export your build

The gradle command bloopInstall exports your gradle build to bloop.

The gradle plugin generates a configuration file per every source set in your build definition. By default, there are two source sets: that of compile and that of test. Bloop will skip config file generation for those projects that are not either Java or Scala.

$ ./gradlew bloopInstall

For example, a build with a single Scala project foo generates two configuration files by default:

$ ./gradlew bloopInstall
(...)
Generated '/disk/foo/.bloop/foo.json'.
Generated '/disk/foo/.bloop/foo-test.json'.

where:

  1. foo comes from the compile source set; and,
  2. foo-test comes from the test source set and depends on foo

If you have applied Bloop to all the projects in your build but some of your projects can't be understood by Bloop (for example, they are not Java or Scala projects), you will see the following log:

Ignoring 'bloopInstall' on non-Scala and non-Java project '$NON_JVM_PROJECT'

You can safely ignore such messsages.

Verify installation and export

Remember that the build server must be running in the background, as suggested by the Setup page.

Verify your installation by running bloop projects in the root of the gradle workspace directory.

$ bloop projects
foo
foo-test

If the results of bloop projects is empty, check that:

  1. You are running the command-line invocation in the root base directory (e.g. /disk/foo).
  2. The gradle build export process completed successfully.
  3. The .bloop/ configuration directory contains bloop configuration files.

Debug the export with ./gradlew bloopInstall -Si.

If you suspect bloop is loading the configuration files from somewhere else, run --verbose:

$ bloop projects --verbose
[D] Projects loaded from '/my-project/.bloop':
foo
foo-test

Here's a list of bloop commands you can run next to start playing with bloop:

  1. bloop compile --help: shows the help section for compile.
  2. bloop compile foo-test: compiles foo's src/main and src/test.
  3. bloop test foo-test -w: runs foo tests repeatedly with file watching enabled.

Next steps after installation

Use an IDE such as Metals or IntelliJ to write code or play with the CLI if you want to explore what CLI options are available.

If you need help, you can always come over our Discord channel.

Plugin Configuration

Enable bloop plugin selectively

If your build only has a handful of Scala/Java projects and you don't want to enable Bloop in all projects by default, you can selectively enable bloop with:

apply plugin: 'bloop'
← MavenMill →
  • Getting Started
  • Requirements
  • Install the plugin
  • Export your build
  • Verify installation and export
  • Next steps after installation
  • Plugin Configuration
    • Enable bloop plugin selectively
BloopBloop
Overview
What is BloopIntegrate with BloopBuild ToolsContributing
Build Tools
sbtGradleMavenMill
Social
Copyright © 2022 Bloop
Credits to @freepik for svg icons
Credits to Bazel, Babel and Metals for inspiring Bloop's website design