How specify the required Java version in a Gradle build

后端 未结 4 943
长发绾君心
长发绾君心 2021-01-07 19:06

I would like to set in a Gradle build file the required Java version e.g. 7 or 8 without having to specify the actual path to a local JDK installation.

Is

4条回答
  •  情歌与酒
    2021-01-07 19:27

    TLDR; Thanks @franklin-yu "targetCompatibility = '1.7' -> your user can compile with 8 and run with 7."

    See Gradle, "sourceCompatibility" vs "targetCompatibility"?

    targetCompatibility = '1.7' does the trick for e.g. Java 7

    Use sourceCompatibility = '1.7' for the language level

提交回复
热议问题