Configuring bloop with Maven projects speeds up developer workflows and gives you access to a modern Scala toolchain, despite Maven traditionally lacking good Scala suppport.
However, the Maven integration has a few issues that are not being actively worked on. If you're a Maven user, please help out and introduce yourself in our Discord channel or comment on one of the open Maven tickets.
- Your build uses
Export your build
The Bloop plugin for Maven doesn't need to be installed, you can run
bloopInstall, the task to export your Maven builds to bloop, with the
$ mvn ch.epfl.scala:maven-bloop_2.13:1.5.0:bloopInstall
In some cases, when you are using generated sources in you project you might need to run:
$ mvn generate-sources ch.epfl.scala:maven-bloop_2.13:1.5.0:bloopInstall
Note that the following command uses the latest Bloop stable version 1.5.0.
Here is the list of the latest Bloop stable and development versions. If you want to be on the very latest at the cost of misbehaviors, replace the above question with the development version.
|1.5.0||28 Apr 2022 07:55||
|1.5.0-18-003e6c7b||10 May 2022 15:56||
To build with a single Scala project
foo generates two configuration files:
$ mvn ch.epfl.scala:maven-bloop_2.10:1.5.0:bloopInstall (...) Generated '/disk/foo/.bloop/foo.json'. Generated '/disk/foo/.bloop/foo-test.json'.
foodefines the main project; and,
foo-testdefines the test project and depends on
maven-bloop generates two configuration files per Maven project. One
project for the main sources and another one for the tests. Bloop will skip
config file generation for those projects that are not either Java or Scala.
Verify installation and export
Verify your installation by running
bloop projects in the root of the Maven workspace directory.
$ bloop projects foo foo-test
If the results of
bloop projects is empty, check that:
- You are running the command-line invocation in the root base directory (e.g.
- The Maven build export process completed successfully.
.bloop/configuration directory contains bloop configuration files.
If you suspect bloop is loading the configuration files from somewhere else, run
$ 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:
bloop compile --help: shows the help section for compile.
bloop compile foo-test: compiles foo's
bloop test foo-test -w: runs foo tests repeatedly with file watching enabled.
After verifying the export, you can continue using Bloop's command-line application or any build client integrating with Bloop, such as Metals.
Next steps after installation
If you need help, you can always come over our Discord channel.
Detecting Java projects
At the moment, Java projects are not being detected. Head to this ticket for a reproducible example.