Gradle build files (or projects) should have a property specifying the minimum JavaVersion to run the build script

(Sean Gilligan) #1

I asked about this recently (see and the best solution seems to be:

assert org.gradle.api.JavaVersion.current().isJava7Compatible()

It would be even better if this were a project property to specify this in a purely declarative manner, e.g.:

buildScriptCompatibility = 1.7

// Java version required to run the buildscript

If the ‘’‘build.gradle’’’ file itself is using features that require a particular ‘’‘JavaVersion’’’ it should be easy to declare this and a standard, easy-to-understand error message should be issued. (Look at the previous forum question for an example case)

My problem is solved, but I’m hoping someone will open a Jira issue for this feature.

(Sean Gilligan) #2

Oh, enhancement requests are ideas. Of course. Sorry about that.