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)
- 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.
- 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.
- 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.
- Make sure thatJAVA_HOMEis set to the location of your JDK, e.g.export JAVA_HOME=/usr/java/jdk1.7.0_51.
- Run mvn --versionto verify that it is correctly installed.
时间: 2024-10-27 04:54:55