Reputation: 39
I'm trying to build a Gradle project in eclipse and this error is displayed when I import the project I want to work on. I have tried to create a new project it builds successfully
Eclipse workspace:
gradle -v
in a terminal:
in the Gradle build file:
if(JavaVersion.current() != JavaVersion.VERSION_1_8)
throw new GradleException("This project requires Java 8, but it's running on "+JavaVersion.current())
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
And this is the description of the error in the Eclipse error view:
The supplied phased action failed with an exception. A problem occurred configuring root project 'IntroToUnitTesting'. A problem occurred evaluating root project 'IntroToUnitTesting'. This project requires Java 8, but it's running on 18
Upvotes: 3
Views: 19141
Reputation: 9497
Your problem is that your gradle script is enforcing usage of Java 8 and is failing if it is called by any other version.
You should configure which java version is used by Eclipse to run gradle to load the build information (dependencies, ...):
When nothing is configured, it is using the Java version used to run Eclipse itself, probably java 18 in your case.
Upvotes: 0
Reputation: 39
in the Gradle build file
if(JavaVersion.current() != JavaVersion.VERSION_1_8) throw new GradleException("This project requires Java 8, but it's running on"+JavaVersion.current()) sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
And this is the description of the error
The supplied phased action failed with an exception. A problem occurred configuring root project 'IntroToUnitTesting'. A problem occurred evaluating root project 'IntroToUnitTesting'. This project requires Java 8, but it's running on 18
Upvotes: -1