Ubuntu install Maven

  1. Go to the maven official website to download the latest maven installation package apache-maven-3.0.4-bin.tar.gz, and extract it to the /usr/local/ directory, or optionally modify the maven user: sudo chown -R user:group apache-maven-3.0.4
  2. Add M2_HOME environment variable: add in /etc/profile or ~/.bashrc file
    1. export M2_HOME=/usr/local/apache-maven-3.0.4  
    2. export PATH=$PATH:$M2_HOME/bin  
    3. #optional  
    4. export MAVEN_OPTS="-Xms256m -Xmx512m"  
  3. Make sure JAVA_HOME is configured and $JAVA_HOME/bin is in the PATH environment variable
  4. source / etc/profile makes environment variables take effect immediately
  5. Run mvn --version to verify that maven was installed successfully.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326445406&siteId=291194637