简体   繁体   中英

Gradle Build Failing Due to Gradle Version I Do Not Have and Source 8

I am trying to build and run a project I am getting theses errors / warnings. The docs say that it needs JVM 10 and Gradle 6:

D:\GIT\geo\spring-boot>.\gradlew  bootRun

> Task :compileJava FAILED
D:\GIT\geo\spring-boot\src\main\java\module-info.java:1: error: modules are not supported in -source 
8
module Geo {
^
  (use -source 9 or higher to enable modules)
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more 
log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1s
1 actionable task: 1 executed

I see this message: use -source 9 or higher to enable modules However, it looks like it am using java 10

D:\GIT\geo\spring-boot>java -version
openjdk version "10" 2018-03-20
OpenJDK Runtime Environment 18.3 (build 10+44)
OpenJDK 64-Bit Server VM 18.3 (build 10+44, mixed mode)

I also see this message: Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. But it looks like I am using Gradle 2.2

D:\GIT\geo\spring-boot>.\gradlew -v

------------------------------------------------------------
Gradle 6.2.2
------------------------------------------------------------

Build time:   2020-03-04 08:49:31 UTC
Revision:     7d0bf6dcb46c143bcc3b7a0fa40a8e5ca28e5856

Kotlin:       1.3.61
Groovy:       2.5.8
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          10 ("Oracle Corporation" 10+44)
OS:           Windows Server 2016 10.0 amd64

You need to set the version in your build script

compileJava {
    options.release = 10
}

https://docs.gradle.org/6.8.1/userguide/building_java_projects.html#sec:java_cross_compilation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM