Hello guys, I seem to be stuck inside step number four of this exercise here:
Learn Spring | Codecademy
I have attempted it step by step multiple times but to no avail. I saw a couple of other users were also stuck on this exercise but unfortunately did not seem to receive any answers yet.
I receive multiple error messages when it comes time to run via the terminal. I am using Visual Studio Code for this exercise. I’ve tried Eclipse and STS3, but I can’t really figure out how to get a terminal to even show up on the latter.
Anyhow, the main error message I receive goes as follows:
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.0.1:run (default-cli) on project mySpringDemo: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:3.0.1:run failed: Unable to load the mojo 'run' in the plugin 'org.springframework.boot:spring-boot-maven-plugin:3.0.1' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/springframework/boot/maven/RunMojo has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
I assume I need to change a certain version of something but am unsure what. Also, there are many lines of error codes after that which seem to all point to my .jar files (e.g. [ERROR] urls[50] = file:/C:/Users/binary/.m2/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar
)
Here is my pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>mySpringDemo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>mySpringDemo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
This is my main .java file:
package com.example.mySpringDemo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MySpringDemoApplication {
public static void main(String[] args) {
SpringApplication.run(MySpringDemoApplication.class, args);
}
}
And this is the HelloController.java file:
package com.example.mySpringDemo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MySpringDemoApplication {
public static void main(String[] args) {
SpringApplication.run(MySpringDemoApplication.class, args);
}
}
Any help on this is much appreciated, as I really need to figure out Spring Boot for my course I’m in irl. If any more details are needed, please let me know. Thanks, and happy coding!