Incremental Gradle Build Not Specified UP-TO-DATE

Gradle, being an incremental build system, must detect when no changes to the source or output have been made, and skip tasks when necessary to save build time.

However, in my assembly, subsequent executions of the gradle task, without changes between them, this incremental function does not work. compileJava, jar, etc. performed with each assembly, and not just when changes are made.

Our build is quite complicated (switching to gradle from a very old, very dirty ant build), so I’ll just show a small fragment:

buildDir = 'build-server'
jar {
    sourceSets.main.java.srcDirs = ['src', 
                '../otherProject/src']

    sourceSets.main.java {

        include 'com/ourCompany/pkgone/allocation/**'
        include 'com/ourCompany/pkgone/authenticationmngr/**'
                      ...

        //Excludes from all VOBs
        exclude 'com/ourCompany/pkgtwo/polling/**'
    }

    sourceSets.main.resources.srcDirs = ['cotsConfig/ejbconfig']
    sourceSets.main.resources {
        include 'META-INF/**'
    }

}

dependencies {
    compile project(':common')
}

Execution gradle jarin this project twice in a row leads to the following conclusion:

P:\Project>gradlew jar
:common:compileJava
:common:processResources UP-TO-DATE
:common:classes
:common:jar
:clnt:compileJava
:clnt:processResources UP-TO-DATE
:clnt:classes
:clnt:jar

BUILD SUCCESSFUL

Total time: 1 mins 46.802 secs
P:\Project>gradlew jar
:common:compileJava
:common:processResources UP-TO-DATE
:common:classes
:common:jar
:clnt:compileJava
:clnt:processResources UP-TO-DATE
:clnt:classes
:clnt:jar

BUILD SUCCESSFUL

, , ? ?

+4
2

--info, Gradle , .

+8

,

  • , gradle 2.1.
  • :

    tasks.withType(JavaCompile) { options.incremental = true // one flag, and things will get MUCH faster }

: https://blog.gradle.org/incremental-compiler-avoidance

+1

All Articles