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

I asked about this recently (see http://forums.gradle.org/gradle/topics/is_there_an_built_in_or_elegant_way_to_require_a_minimum_jvm_version_for_running_a_build_script) 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.

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