CodexBloom - Programming Q&A Platform

Eclipse 2023-09: implementing Gradle Build Path Not Recognizing Lambda Expressions in Java 17

👀 Views: 70 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-12
eclipse gradle java-17 spring-boot java

I've hit a wall trying to I've been struggling with this for a few days now and could really use some help. I'm working on a project and hit a roadblock. I'm currently working on a Spring Boot application using Eclipse version 2023-09 and Gradle 7.5, and I'm working with a frustrating scenario where my project does not recognize lambda expressions, resulting in compilation errors. Whenever I attempt to use a lambda, like so: ```java List<String> names = Arrays.asList("Alice", "Bob", "Charlie"); names.forEach(name -> System.out.println(name)); ``` I receive the following behavior message: `behavior: lambda expressions are not supported in -source 1.8 (use -source 11 or higher to enable lambda expressions)`. I've checked my `build.gradle` file, and it has the following configurations: ```groovy plugins { id 'org.springframework.boot' version '2.7.5' id 'io.spring.dependency-management' version '1.0.13.RELEASE' id 'java' } group = 'com.example' version = '0.0.1-SNAPSHOT' sourceCompatibility = '17' targetCompatibility = '17' repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter' testImplementation 'org.springframework.boot:spring-boot-starter-test' } ``` I've confirmed that the project is set to use Java 17 in Eclipse (under Project Properties -> Java Compiler), but it seems like Eclipse is still identifying the build path as Java 8 for some reason. I've tried cleaning the project, refreshing Gradle dependencies, and even deleting and re-importing the project, but nothing has resolved the scenario. Is there a specific setting in Eclipse or Gradle that I might be missing, or could this be a bug in the current version? Any insights or suggestions would be greatly appreciated! This is part of a larger CLI tool I'm building. Has anyone else encountered this? This is part of a larger service I'm building. Is there a better approach? This is part of a larger web app I'm building. How would you solve this? This is happening in both development and production on Debian. I'd be grateful for any help.