My Profile Photo


Integration anytime any place anywhere.

Battling with builds in Windows

Getting gradle builds in windows working.

More and more we are using build tools to assist in the creation of Interlok artefacts, until recently there were a few scenarios that didn’t work in windows this meant we had to use WSL to run our builds.

The reasons for the build failures were unrelated to anything we’d done but related to the way gradle builds its classpath and limitation in windows:

Caused by: Cannot run program "...\java.exe" (in directory "...\build"): CreateProcess error=206, The filename or extension is too long

In order to fix this, we created a temporary jar that contained the classpath, this manifests itself as (pun intended):

task tempLauncherJar(type: Jar) {
    appendix = "launcher"
    manifest {
        attributes ("Class-Path": configurations.runtime.collect { "file:///" + it.getCanonicalPath() }.join(' '))

task interlokVersion(type: JavaExec, dependsOn: processConfig) {
    dependsOn tempLauncherJar
    workingDir = new File("${buildDir}")
    classpath = files(tempLauncherJar.archivePath)
    main = ''
    args "-version"