Gradle Spring Boot plugin broken on Linux

1k views Asked by At

I have a multimodule gradle build with a single module containing a spring boot application that consumes the artifacts of the other modules. I have the spring boot plugin applied to the single spring boot module.

Everything works correctly in Windows, but once I try the build on a Linux machine if fails. I have tried multiple linux machines (Jenkins server, Ubuntu VM, even bitbucket pipeline) and it fails with this error:

Problems reading data from Binary store in /tmp/gradle2075404181876889604.bin (exist: false)

I am not entirely sure what gradle uses this binary store for, but after debugging I found that this file name is different than binary store that every other module is using while building.

I have tried multiple gradle versions(2, 3, and 4) and several spring boot versions and they all fail with the same error. The only thing that fixes this is removing the spring boot plugin.

Here is the parent build.gradle

    repositories {
        mavenCentral()
    }

    def javaLangVersion = '1.8'
    def gradleDir = "${rootProject.rootDir}/gradle"
    def realProjects = allprojects - [project(':external'), project(':delivery')]
    def javaProjects = realProjects - rootProject
    def integrationTestProjects = javaProjects

    configure(realProjects) {
        group 'com.packagename'
        version '1.0-SNAPSHOT'

        apply plugin: 'eclipse'
        apply plugin: 'idea'
    }

    configure(javaProjects) {
        apply plugin: 'java'

        targetCompatibility = javaLangVersion
        sourceCompatibility = javaLangVersion

        repositories {
            mavenCentral()
        }

        dependencies {
            compile group: 'org.slf4j', name: 'slf4j-api', version: "${slf4jVersion}"
            compile group: 'org.slf4j', name: 'log4j-over-slf4j', version: "${slf4jVersion}"

            testCompile group: 'junit', name: 'junit', version: "${junitVersion}"
            testCompile group: 'org.mockito', name: 'mockito-core', version: "${mockitoVersion}"
            testCompile group: 'nl.jqno.equalsverifier', name: 'equalsverifier', version: "${equalsverifierVersion}"
        }
    }

    configure(integrationTestProjects) {
        apply from: "${gradleDir}/integrationTest.gradle"
    }

    task wrapper(type: Wrapper) {
        gradleVersion = '3.5'
    }

Here is the spring boot module build.gradle file:

buildscript {
    ext {
        springBootVersion = '1.5.3.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootStarterVersion}")
    }
}

apply plugin: 'org.springframework.boot'
apply plugin: 'war'

war {
    baseName = "${project.name}"
    version = "${project.version}"
}

dependencies {
    compile project(':module1')
    compile project(':module2')

    compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-rest'

    compile group: 'org.apache.httpcomponents', name: 'httpcore', version: "${httpCoreVersion}"
    compile group: 'org.apache.httpcomponents', name: 'httpclient', version: "${httpClientVersion}"

    compile group: 'com.h2database', name: 'h2', version: "${h2Version}"

    testCompile project(':test-utils')
    testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test'
}

All other modules are plain java modules and only declare a dependencies block in the build file.

I have been working on this for 2 days now so any help or suggestions would be greatly appreciated. Thanks!

2

There are 2 answers

0
Zack On BEST ANSWER

Well this is super embarrasing... I had a unit test using FileUtils.getTempDirectory() and then I was cleaning that directory using FileUtils.deleteQuietly after the test and it was deleting the gradle binary store that was in the /tmp folder. The reason it wasnt showing on windows is because windows locks files.

1
Mor Lajb On

did you verify that your gradle.properties is OK on the Linux machine ?