First, add the dependency to pom.xml:
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
</dependency>
Then update module-info.java: Add the module name of the library
module com.example.myproject {
requires com.google.common;
}
then build the project: Run Maven to compile and resolve dependencies:
mvn clean package