使用批处理命令打包java项目,给我们发布war或jar包带来了很大的便利,附上代码,以作留存。
::huap-parent ::common-parent ::market-parent ::cust-parent ::entcust-parent ::custserv-parent ::workdesk-parent ::psncust-parent ::entmarket-parent ::psnmarket-parent ::icrm set targetWarPath=E:Pro_2016_XXXX项目 6.开发10.安装包 @echo off #关闭显示 @echo 查找目录... @echo 当前目录为:%cd% @echo build huap-parent... cd ../huap-parent call mvn clean install @echo build common-parent... cd ../common-parent call mvn clean install @echo build market-parent... cd ../market-parent call mvn clean install @echo build cust-parent... cd ../cust-parent call mvn clean install @echo build entcust-parent... cd ../entcust-parent call mvn clean install @echo build custserv-parent... cd ../custserv-parent call mvn clean install @echo build workdesk-parent... cd ../workdesk-parent call mvn clean install @echo build psncust-parent... cd ../psncust-parent call mvn clean install @echo build entmarket-parent... cd ../entmarket-parent call mvn clean install @echo build psnmarket-parent... cd ../psnmarket-parent call mvn clean install @echo build icrm... cd ../icrm call mvn clean install cd target/ set nowDate=%date:~0,4%%date:~5,2%%date:~8,2% #获取当前日期并设置到nowDate变量中 set newFileName=icrm[%nowDate%].war copy icrm.war %newFileName% #复制文件 @echo 文件路径为: %cd%\%newFileName% move %cd%\%newFileName% %targetWarPath% #移动文件 @echo 已成功生成[%newFileName%]安装部署包,文件路径为:【%targetWarPath%%newFileName%】 pause #暂停,阻止程序退出