1.下载maven
https://maven.apache.org/download.cgi
2.安装配置
- 解压
tar -xf apache-maven-3.6.1-bin.tar.gz
- 配置环境变量
vim /etc/profile export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk export MAVEN_HOME=/opt/apache-maven-3.6.1 export PATH=$MAVEN_HOME/bin:$PATH
- 加载
source /etc/profile
- 查看结果
mvn -v
- 配置settings.xml
cd /opt/apache-maven-3.6.1/conf [root@k8s-node1 conf]# grep -v '^$' settings.xml |grep -v '^#'/usr/local/maven/repository nexus-aliyun central Nexus aliyun http://maven.aliyun.com/nexus/content/groups/public/ jdk-1.8 1.8 nexus local private nexus http://maven.aliyun.com/nexus/content/groups/public/ true false nexus local private nexus http://maven.aliyun.com/nexus/content/groups/public/ true false
- 创建本地存储目录
mkdir -p /usr/local/maven/repository
- 项目下面配置pom.xml
4.0.0 com.example ftposs 1.0-SNAPSHOT UTF-8 UTF-8 1.8 UTF-8 UTF-8 1.8 1.8 3.0.9.RELEASE 2.0.0 1.1.0 1.2.5 javax.servlet javax.servlet-api 3.1.0 provided org.slf4j slf4j-simple 1.7.22 org.slf4j slf4j-api 1.7.22 com.aliyun.oss aliyun-sdk-oss 2.8.2 maven-assembly-plugin true com.yik.gdbq.ftposs.Main jar-with-dependencies make-my-jar-with-dependencies package single
- 打包
cd 项目路径 mvn clean package
- 查看jar包
cd 项目/target/



