Search code examples
scalagradlebuildmulti-module

How to just compile only changed (or related) module in multi-module gradle project


I am having multi-module gradle project, which is having 5 modules. And these modules creates a lineage of dependency ie. A <- B <- C <- D <- E.

Here A depends on B, B depends on C and so on.

My problem is that, If i am going to change in A, it compile all the parent modules.

Is there any way to just compile only A. And if i change in B then only compile A and B.


Solution

  • Yes, @JB Nizet you are correct i was using one of the scalaCompileOption property.

      tasks.withType(ScalaCompile) {
        scalaCompileOptions.with {
          force = true
        }
    

    which force to disable scala incremental build. https://docs.gradle.org/current/userguide/scala_plugin.html#sec:scala_incremental_compilation