centos 7 安装maven 和 自动编译

wget http://mirrors.shuosc.org/apache/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz
tar -xzf apache-maven-3.5.2-bin.tar.gz
mv apache-maven-3.5.2 /usr/local/apache-maven

cat > /etc/profile.d/maven.sh << EOF

export JAVA_HOME=/data/jdk1.8.0_144  
export JRE_HOME=/data/jdk1.8.0_144/jre   
export MAVEN_HOME=/usr/local/apache-maven
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$MAVEN_HOME/bin:$PATH

EOF

编译脚本参考

#!/bin/bash

source /etc/profile

cd /data/dev/project1/

#环境变量设置
export JAVA_HOME=/data/jdk1.8.0_144  
export JRE_HOME=/data/jdk1.8.0_144/jre   
export MAVEN_HOME=/usr/local/apache-maven
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$MAVEN_HOME/bin:$PATH

#如果需要全新安装项目依赖请先执行下面一行
#mvn clean install dependency:resolve

#编译
mvn prepare-package war:exploded

来自:悠游悠游,2017-11-16,原文地址:https://yoyo.play175.com/68.html