I am taking a udemy course "Selenium Webdriver with Java for Beginners" and have done all of the setup from the course, but I cannot for the life of me get rid of this warning in eclipse. I verified I have java18.0.1.1 installed on my mac, edited the build path in eclipse to point to the 18.0.1.1 jdk. The issue is, the JRE system library keeps reverting to JavaSE-17, which afaik isnt installed on my machine. It happens every time I click update maven project.
In my pom.xml file, I have the below maven plugin, specifying java18...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>18</source>
<target>18</target>
</configuration>
</plugin>
Build path specifies execution environment JavaSE-17. There are no JREs installed in the workspace that are strictly compatible with this environment.
CodePudding user response:
Try to check this block in your pom.xml.
<properties>
...
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
</properties>
If it doesn't work check the official manual about Maven's POM.xml here
Make sure that you also have a correct Maven path at your Mac.
CodePudding user response:
Use of Java 18 requires both Eclipse 2022-03 and this patch from the Marketplace. 2022-03 came out a week before Java 18 (March 16th vs. March 22nd), so it can not officially claim to support it. The patch should be uninstalled before updating to 2022-06 later this month.