GRADLE errors when migrated from 3.1 to 5.1

1.1k Views Asked by At

below is a snippet of our gradle build script

def binDir = file("bin")
def libDir = "WebContent/WEB-INF/lib"
def testReportDir = file('testReport')
def outputDir = file("output")
def envParam = "local"


repositories {
    mavenCentral()
}

sourceSets {
    project.webAppDirName = 'WebContent'

    if (project.hasProperty("env")) {
        envParam = env
        outputDir = file("output/$envParam")
    }

    main {
        java { srcDirs = ['src/main/java'] }
        resources { srcDirs = ['src/main/resources','config/' + envParam] }
        output.classesDir = binDir
    }

    test {
        java { srcDirs = ['src/main/java', 'src/test/java'] }
        resources { srcDirs = ['src/main/resources', 'src/test'] }
        output.classesDir = binDir
        compileClasspath = sourceSets.main.compileClasspath
        runtimeClasspath = output + compileClasspath
    }
}

What this does is, build an .ear file from our project code built from Java 8. This works fine when using Gradle 3.1 but when we migrated to 5.1, the error below shows up when we run the script.

"* What went wrong: A problem occurred evaluating root project 'HKSLFDirectory'.

Could not set unknown property 'classesDir' for main classes of type org.gradl e.api.internal.tasks.DefaultSourceSetOutput."

0

There are 0 best solutions below