I know there are a lot of articles about this topic but I wonder where to add the JAVA_HOME and MAVEN path variables.
I have 3 files:
The only thing to do is to add the
bin folder of the appropriate Maven distribution (
apache-maven-3.3.9/bin) to your path variable. The
JAVA_HOME location can be done either via environment variable. But the problem here is that it might influence other tools etc. So i would suggest to use
$HOME/.mavenrc file for such purposes.
.mavenrc file can look like this:
export JAVA_HOME=/...LocationYouNeed export MAVEN_OPTS="-Xmx768m ..."
By using this you can limit this only to Maven. So in the end you only need to set the location of Maven via
PATH that's it.
Starting with Maven 3.3.1 you can use the
.mvn/jvm.config to configure memory settings etc. on a per project base which will be checked in with your project. This means you can remove the
MAVEN_OPTS from your
Usually you don't necessarily need to add
JAVA_HOME/bin to your path. If you need
JAVA_HOME only to run Maven you don't need to.
If you need to support multiple Maven versions you can define a location in your path which you can change via a symbolic link.