Hydra smoothly integrates with several development tools. Follow the appropriate link to get started with Hydra.
- Get started with sbt.
- Get started with Maven.
- Get started with Gradle.
- Get started with IntelliJ IDEA.
- Get started with the CLI.
Navigate to the project on which you want to use Hydra and add the following inside the file
project/plugins.sbt (if the file isn't there, create it):
resolvers += Resolver.url("Triplequote Plugins Releases", url("https://repo.triplequote.com/artifactory/sbt-plugins-release/"))(Resolver.ivyStylePatterns) addSbtPlugin("com.triplequote" % "sbt-hydra" % "2.1.10")
If sbt fails to resolve the Hydra artifacts please read this section for how to troubleshoot the problem.
If you're using Hydra on your developer machine, you need to activate a Hydra license before you can compile with Hydra. See the License section for how to do this on other build tools. Inside Sbt, type the following, using the actual license number you obtained:
> hydraActivateLicense XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX [info] Activating using https://activation.triplequote.com/algas/. This may take some time.. [info] License successfully activated
Read here to claim your Hydra trial license.
Compiling with Hydra¶
Now that Hydra is installed, let's check how it works. Enter the sbt shell and execute the
$ sbt [info] ... > compile [info] Compiling 80 Scala sources to ... [info] Using 4 Hydra workers to compile Scala sources. [info] Starting MetricsService in /home/john/.triplequote/metrics [success] ... >
When executing the
compile task you should notice the message
[info] Using 4 Hydra workers to compile Scala sources. (the number of workers may differ, as it depends on how many physical cores your machine has and how many Scala sources need to be compiled).
Congratulations, you have successfully installed Hydra!
While compiling your Scala source files, Hydra also collects compilation metrics that help you keep compile time under control. With the help of a modern web-based dashboard, you can track how compilation time evolves on your project, commit after commit. Even more importantly, you can prevent unexpected compile time deteriorations to land in the development branch before hampering everyone's productivity.
In the sbt output above you might have noticed the message
[info] Starting MetricsService in /home/john/.triplequote/metrics
This informs you that Hydra will try to push compilation metrics to a service that is expected to run on localhost (note that Hydra will work just fine also if you decide not to install the dashboard).
If you're evaluating Hydra via the Sbt
hydraStartTrial command and have Docker installed, the dashboard should already be running. To set-up the dashboard in other scenarios, please read the installation instruction.
Know your memory requirements¶
Hydra has slightly higher memory requirements than regular Scala, so make sure you keep an eye on the JVM behavior. If compiling your codebase using Hydra doesn't deliver the desired speed up, try to launch sbt with more memory:
$ sbt -mem 4096 [info] ...
If your project has a
.jvmopts file then the value passed to
-mem is ignored. In this case, simply increment the heap value (
-Xmx) declared in the
Also, see tuning memory for how to make the sbt memory configuration part of your project.
Benchmarking how Hydra performs on your project couldn't be easier. Simply enter the sbt shell and execute the
$ sbt [info] ... > hydraBenchmark 10 ... // Hold on, benchmark is running!
hydraBenchmark command will compare the performance of Hydra versus vanilla Scala for all projects in your build, producing a detailed report with the speedup delivered by Hydra. Read Benchmark for the glorious details on how the
hydraBenchmark command works.