-
-
ant编译
-
wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz tar xf apache-maven-3.6.3-bin.tar.gz -C /usr/local ll /usr/local/apache-maven-3.6.3/ ln -s /usr/local/apache-maven-3.6.3/ /usr/local/maven ll /usr/local/maven/ vim /etc/profile #文件结尾添加两行 export M2_HOME=/usr/local/maven export PATH=${M2_HOME}/bin:$PATH source /etc/profile mvn -v
- 更改maven源
vim /usr/local/maven/conf/settings.xml #将所有内容复制到<mirrors>之间 <mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror>
tar xf SpringBootWeb.tar.gz -C /opt/
-
编译war包
cd /opt/SpringBootWeb mvn package #执行完毕! [INFO] Packaging webapp [INFO] Assembling webapp [SpringBootWeb] in [/opt/SpringBootWeb/target/SpringBootWeb] [INFO] Processing war project [INFO] Copying webapp resources [/opt/SpringBootWeb/src/main/webapp] [INFO] Webapp assembled in [327 msecs] [INFO] Building war: /opt/SpringBootWeb/target/SpringBootWeb.war [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:00 min [INFO] Finished at: 2020-03-24T23:32:36+08:00 [INFO] ------------------------------------------------------------------------ [root@web01 /opt/SpringBootWeb]# ls pom.xml src target [root@web01 /opt/SpringBootWeb]# cd target/ [root@web01 /opt/SpringBootWeb/target]# ls classes generated-sources maven-archiver maven-status SpringBootWeb SpringBootWeb.war <--war包 [root@web01 /opt/SpringBootWeb/target]# mv SpringBootWeb.war /app/tomcat/webapps/ROOT.war #将war包放如tomcat的webapps/下面重启tomcat