I have 2 different versions of maven installed on my MacBook. One is through a company tooling.
% mvn -v
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384m; support was removed in 8.0
Colorizing...
Listening for transport dt_socket at address: 5005
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 08:22:22-0700)
Maven home: /Users/abc/.bootstrap/packages/maven3.1.1/apache-maven-3.1.1
Java version: 1.8.0_181, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"
One of my projects needs maven version >3.2.5 and I have a newer version through brew
% brew list maven
/opt/homebrew/Cellar/maven/3.9.1/bin/mvn
/opt/homebrew/Cellar/maven/3.9.1/bin/mvnDebug
/opt/homebrew/Cellar/maven/3.9.1/bin/mvnyjp
/opt/homebrew/Cellar/maven/3.9.1/libexec/bin/ (4 files)
/opt/homebrew/Cellar/maven/3.9.1/libexec/boot/ (2 files)
/opt/homebrew/Cellar/maven/3.9.1/libexec/conf/ (3 files)
/opt/homebrew/Cellar/maven/3.9.1/libexec/lib/ (75 files)
If I try to use this directly, I get the following error:
% /opt/homebrew/Cellar/maven/3.9.1/bin/mvn -v
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384m; support was removed in 8.0
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
Error occurred during initialization of VM
agent library failed to init: jdwp
How do I fix it? How do I switch to the new version when building my old project? Maybe I can delete the 3.1.1 version? How would I do that? Please help. Thanks!