On Ubuntu 16.04
Default state:- installation directory is: /usr/share/maven
- version is 3.3.9
- download newest version of maven (bin tar.gz) from https://maven.apache.org/download.cgi
- unpack to /opt folder (the folder for installing unbundled independent applications)
sudo tar xvf apache-maven-*.tar.gz --directory /opt
- add environmental variables (see also: official reference):
- create script file to set the variables system wide:
sudo gedit /etc/profile.d/maven.sh
- add these lines and save it (change jdk path if needed):
## Environmental variables needed by Maven export JAVA_HOME=/usr/lib/jvm/jdk-11.0.2/
- set the file executable
sudo chmod +x /etc/profile.d/maven.sh
- log out and log in again to see its effect
- update alternatives for the specific new version (change path if needed)
sudo update-alternatives --install "/usr/bin/mvn" "mvn" "/opt/apache-maven-3.6.0/bin/mvn" 100 sudo update-alternatives --set mvn /opt/apache-maven-3.6.0/bin/mvn
On Windows 10
- download newest version of maven (bin zip) from https://maven.apache.org/download.cgi
- unpack zip to "C:\Program Files\Apache\"
- add "C:\Program Files\Apache\apache-maven-3.6.0\bin\" to Path environmental variable, or replace older maven version in Path variable with new one
- log out and log in for the environmental variable to take effect
Note: the M2_HOME and MAVEN_HOME environmental variables are not needed.
No comments:
Post a Comment