Skip to content

Instantly share code, notes, and snippets.

@welmarr
welmarr / managing-multiple-java-versions-with-maven.md
Last active January 24, 2023 07:28
In this article, I explore the process of handling multiple versions of Java with Maven. Specifically, I focus on resolving an error that occurs when running a new Spring Boot application (version 3.0.1) when attempting to run the "mvn clean install" command line on a system with Java 11.

Managing Multiple Java Versions with Maven 🤹 (without modifying JAVA_HOME almost)

Today, I try to run a new spring boot application (<version>3.0.1</version>) on my Windows 11 but, when I perform the command line mvn clean install (mvn -version [Apache Maven 3.8.6 | Java version: 11.0.15.1]), I have the following issue 👇

Execution repackage of goal org.springframework.boot:spring-boot
-maven-plugin:3.0.1:repackage failed: Unable to load the mojo 'repackage' in the plugin 'org.springframework.boot:spring-boot-maven-plugin:3.0.1' due to an API incompatibility: org.codehaus.plexus.comp
onent.repository.exception.ComponentLookupException: org/springframework/boot/maven/RepackageMojo 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