20231011 Gradle Hacks

20231011  Gradle Hacks
Photo by Ivan Henao / Unsplash

This post lists several hacks that can be applied during the development of Scala programs with Gradle.

Override advanced compiler options

The following snippet overrides any Scala compiler options set by other Gradle plugins. It can be helpful to iterate faster during the initial experimentation/prototyping phase.

// do not commit delete following 
tasks.withType(ScalaCompile).configureEach {
  it.scalaCompileOptions.additionalParameters = [
  ]
}

Adding Maven Local

By updating build.gradle with the following in the repositories section, the local Maven snapshots can be resolved as dependencies. It is particularly useful in the context when few of the dependencies are required to be tested locally, for the consistency of the system.

repositories {
  mavenLocal()
  // other repositories 
}