Apache Maven,是一个软件(特别是Java软件)项目管理及自动构建工具,由Apache软件基金会所提供。基于项目对象模型(缩写:POM)概念,Maven利用一个中央信息片断能管理一个项目的构建、报告和文档等步骤。曾是Jakarta项目的子项目,现为独立Apache项目。
1) 从网站上下载Linux版本的Maven安装包;
2) 解压apache-maven-3.0.3-bin.tar.gz进行安装;
tar -xzvf apache-maven-3.0.3-bin.tar.gz
3) 设置maven环境变量;
vim /etc/profile或者vim /etc/environment
#jesse add maven envirment
export M2_HOME=/opt/apache-maven
export M2=$M2_HOME/bin
export MAVEN_OPTS="-Xms256m -Xmx512m"
export PATH=$M2:$PATH
4) 验证maven是否安装成功。
mvn -version
root@www:/#mvn -version
Apache Maven 3.0.3(r1075438; 2011-02-28 17:31:09+0000)
Maven home:/opt/apache-maven
Java version:1.6.0_22, vendor: Sun Microsystems Inc.
Java home:/usr/lib/jvm/java-6-openjdk/jre
Default locale:zh_CN, platform encoding: GB2312
OS name:"linux", version: "2.6.38-8-server", arch: "amd64",family: "unix"
root@www:/#
echo $M2
root@www:/#echo $M2
/opt/apache-maven/bin
(1)已安装了jdk并有设置JAVA_HOME环境变量。
(2)http://tomcat.apache.org/上下载得到apache-tomcat-5.5.27.tar.gz
tar -zxvf apache-tomcat-5.5.27.tar.gz
sudo vi/usr/share/tomcat5/apache-tomcat-5.5.27/bin/catalina.sh
修改catalina.sh文件,在文件开头注释后插入
JAVA_HOME="/usr/lib/jvm/java/jdk1.6.0_12"
(3)启动tomcat
sudo/usr/share/tomcat5/apache-tomcat-5.5.27/bin/startup.sh
(4)在~/.bashrc文件里添加:
alias starttomcat='sudo/usr/share/tomcat5/apache-tomcat-5.5.27/bin/startup.sh'
alias shutdowntomcat='sudo/usr/share/tomcat5/apache-tomcat-5.5.27/bin/shutdown.sh'
alias restarttomcat='shutdowntomcat && starttomcat'
source ~/.bashrc
(5)修改server.xml
sudo vi/usr/share/tomcat/apache-tomcat-5.5.27/conf/server.xml
<Connector port="8080"....../>