安装jdk
yum -y install java-1.8.0-openjdk-devel
安装maven
cd /home
wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz
tar xzvf apache-maven-3.5.0-bin.tar.gz
mv apache-maven-3.5.0 /usr/local/apache-maven
配置环境变量
编辑 /etc/profile,在最下方添加:
MAVEN_HOME=/usr/local/apache-maven
export MAVEN_HOME
export PATH=${PATH}:${MAVEN_HOME}/bin
source /etc/profile
maven的简单使用
构建
helloworld
cd /home
mvn archetype:generate -DgroupId=helloworld -DartifactId=helloworld
编译
cd /home/helloworld
mvn compile
运行
mvn exec:java -Dexec.mainClass="helloworld.App"
测试
mvn test
打包
mvn package