Basma Ashraf
Basma Ashraf

Reputation: 39

The supplied phased action failed with an exception in Eclipse

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: Error Message

gradle -v in a terminal: Java and Gradle versions

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

Answers (2)

Jmini
Jmini

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, ...):

Gralde page in the preferences

When nothing is configured, it is using the Java version used to run Eclipse itself, probably java 18 in your case.

Upvotes: 0

Basma Ashraf
Basma Ashraf

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

Related Questions