ubuntu配置maven环境变量

export JAVA_HOME=/home/lhp/mysoft/jdk1.7.0_71
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export M2_HOME=/home/lhp/mysoft/apache-maven-3.2.5
export PATH=${JAVA_HOME}/bin:${M2_HOME}/bin:$PATH
export MAVEN_OPTS="-Xms256m -Xmx512m"

安装maven要有jdk的支持,配置好后,可以通过 mvn --version来验证是否配置成功

官网的文档:

Unix-based Operating Systems (Linux, Solaris and Mac OS X)

  1. Extract the distribution archive, i.e.apache-maven-3.2.5-bin.tar.gzto the directory you wish to install Maven 3.2.5. These instructions assume you chose/usr/local/apache-maven. The subdirectoryapache-maven-3.2.5will be created from the archive.
  2. In a command terminal, add unpacked distribution‘sbinto your PATH environment variable, e.g.export PATH=$PATH:/usr/local/apache-maven/apache-maven-3.2.5/bin.
  3. Optional: Add theMAVEN_OPTSenvironment variable to specify JVM properties, e.g.export MAVEN_OPTS="-Xms256m -Xmx512m". This environment variable can be used to supply extra options to Maven.
  4. Make sure thatJAVA_HOMEis set to the location of your JDK, e.g.export JAVA_HOME=/usr/java/jdk1.7.0_51.
  5. Run mvn --versionto verify that it is correctly installed.

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。