Maven plugin

The Hydra Maven plugin smoothly integrates Hydra into Maven. The Hydra Maven plugin is feature-wise identical to the scala-maven-plugin, and it simply adds support for compiling Scala with Hydra.


  • Maven 3.0 or above
  • If using the 3.2.2 version of the Scala Maven plugin you'll need Triplequote Zinc (at least 0.6.13) if you want to use the incremental compiler with an external Zinc server.

Supported versions

Maven plugin Zinc server
4.3.1-hydra09 not applicable
3.2.2-hydra09 0.8.13


Both Hydra and the Hydra maven plugin are distributed through our public repository. Let's start by adding the Triplequote repository to your project POMs:


Finally, add the Maven Hydra plugin in your build. Assuming you are already using the scala-maven-plugin from DavidB, you only need to change the organization id, the plugin version, and add a few configuration parameters specific to Hydra:

          <!--<groupId>net.alchim31.maven</groupId>  comment DavidB Scala Maven plugin group id -->
          <version>4.3.1-hydra09</version>  <!-- you must use this version -->
            <!-- Change hydraEnabled to false if you'd like to fall back to compile with the vanilla Scala compiler -->
            <hydraCpus>4</hydraCpus> <!-- optional -->


See here for how to configure Hydra if not all team members have a license

That's all it's needed to compile Scala with Hydra. You should refer to the scala-maven-plugin documentation for the configuration of the non Hydra specific settings.

License activation

If you're using Hydra on your developer machine, you need to activate a Hydra license before you can compile with Hydra. Use the hydraActivateLicense task, passing as argument the the actual license number you obtained:

$ mvn -Dhydra.license.key="XXXXX-...-XXXXX" scala:hydraActivateLicense
License successfully activated


After having properly configured the Hydra Maven plugin on your project, type mvn compile and you should see a similar output when your project's Scala sources are compiled:

[INFO] Compiling 40 Scala sources and 6 Java sources to /Users/mirco/tmp/spark/common/tags/target/scala-2.11/classes...
[INFO] Using 4 Hydra worker to compile Scala sources.


Upon each successful compilation, Hydra extracts and pushes relevant metrics from your build to the dashboard service. Metrics are collected and pushed upstream by an external process, the MetricsService. This service is automatically started by Maven when building. Generally the defaults are good enough, but occasionally you might want to tune it:

Setting Default Description
hydraMetricsDirectory ~/.triplequote/metrics The directory where logs and metrics are stored until they are pushed to the dahsboard service
hydraMetricsServiceJvmOptions -Xmx256M Additional options to pass to the Java VM running the metrics service

Incremental compilation and Zinc server

The Maven plugin can track dependencies between sources and recompile all files that may be invalidated due to transitive changes. This is based on Zinc, the same engine that sbt is using. You can enable incremental builds by adding the <recompileMode> configuration option. If you want to use the Zinc server (see below), also add <useZincServer>.



The Zinc server (deprecated)

This is not available in the most recent version of the Scala Maven plugin. However, if you're using 3.2.2, read on.

The Zinc server is a long-running process for running the Scala compiler outside of the Maven process. The JVM used by the Zinc server will get "hot" over subsequent builds and lead to much better compilation times.

To install the server, please download and unzip the distribution from here.

Note: You need to use the Triplequote version of the server instead of the Typesafe distribution. The version number must be 0.6.13 or above.

To start the server, run

$  ../zinc-N.N.NN/bin/zinc -nailed -start
Nailgun server running with 0 cached compilers

Version = N.N.NN

Zinc compiler cache limit = 5
Resident scalac cache limit = 0
Analysis cache limit = 5

To stop the server:

$ zinc -shutdown

You can find more information about it here.

Enable Hydra only when license present

In case some members of your team are not using Hydra you may want to enable it only if a hydra.license file is present. Add the following profile to your POM:


and then, in your maven hydra plugin configuration section: