maven + bat 实现快速编译打包模块代码

时间:2021-04-29 05:08:18

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>geostack</groupId>
<artifactId>parent</artifactId>
<version>2.0.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>geostack组件包/geostack-balance-core</module>
<module>geostack组件包/geostack-balance-haproxy</module>
<module>geostack组件包/geostack-core</module>
<module>geostack组件包/geostack-databasegoods</module>
<module>geostack组件包/geostack-dependence</module>
<module>geostack组件包/geostack-dictionary</module>
<module>geostack组件包/geostack-framework</module>
<module>geostack组件包/geostack-gistools</module>
<module>geostack组件包/geostack-log</module>
<module>geostack组件包/geostack-portal</module>
<module>geostack组件包/geostack-processfactory</module>
<module>geostack组件包/geostack-proxy</module>
<module>geostack组件包/geostack-quartz</module>
<module>geostack组件包/geostack-servicegoods</module> <module>独立运维组件/geostack-soms</module>
<module>独立运维组件/geostack-zabbix</module> <module>监控组件/geostack-monitor-common</module>
<module>监控组件/geostack-monitor-zabbix</module>
<module>监控组件/geostack-zabbix-api</module>
</modules>
</project>

mvn_clean.bat

@echo off
echo 是否进行maven clean操作
pause
::设置PARENT_PATH所在盘符
D:
echo 正在设置临时环境变量
set PARENT_PATH=D:\Nihaorz\Documents\work\综合运维与独立运维源代码
start /max "" %PARENT_PATH%
echo PARENT_PATH:%PARENT_PATH%
cd %PARENT_PATH%
md logs
mvn clean > logs\clean_result.txt

mvn_install.bat

@echo off
echo 是否进行maven install操作
pause
::设置PARENT_PATH所在盘符
D:
echo 正在设置临时环境变量
set PARENT_PATH=D:\Nihaorz\Documents\work\综合运维与独立运维源代码
echo PARENT_PATH:%PARENT_PATH%
cd %PARENT_PATH%
md logs
mvn install > logs\install_result.txt

mvn_deploy.bat

@echo off
echo 是否进行maven deploy操作
pause
::设置PARENT_PATH所在盘符
D:
echo 正在设置临时环境变量
set PARENT_PATH=D:\Nihaorz\Documents\work\综合运维与独立运维源代码
echo PARENT_PATH:%PARENT_PATH%
cd %PARENT_PATH%
md logs
mvn deploy > logs\deploy_result.txt

copy_jar.bat

@echo off
echo 是否进行jar包copy操作
pause
echo 正在设置临时环境变量
set PARENT_PATH=D:\Nihaorz\Documents\work\综合运维与独立运维源代码
set JAR_SUFFIX=-2.0.0.0-SNAPSHOT.jar
echo PARENT_PATH:%PARENT_PATH%
echo JAR_SUFFIX%JAR_SUFFIX%
cd %PARENT_PATH%
rd /s /q jars
md jars\
xcopy %PARENT_PATH%\geostack组件包\geostack-balance-core\target\geostack-balance-core%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\geostack组件包\geostack-balance-haproxy\target\geostack-balance-haproxy%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\geostack组件包\geostack-core\target\geostack-core%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\geostack组件包\geostack-databasegoods\target\geostack-databasegoods%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\geostack组件包\geostack-dependence\target\geostack-dependence%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\geostack组件包\geostack-dictionary\target\geostack-dictionary%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\geostack组件包\geostack-framework\target\geostack-framework%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\geostack组件包\geostack-gistools\target\geostack-gistools%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\geostack组件包\geostack-log\target\geostack-log%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\geostack组件包\geostack-portal\target\geostack-portal%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\geostack组件包\geostack-processfactory\target\geostack-processfactory%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\geostack组件包\geostack-proxy\target\geostack-proxy%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\geostack组件包\geostack-quartz\target\geostack-quartz%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\geostack组件包\geostack-servicegoods\target\geostack-servicegoods%JAR_SUFFIX% %PARENT_PATH%\jars xcopy %PARENT_PATH%\独立运维组件\geostack-soms\target\geostack-soms%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\独立运维组件\geostack-zabbix\target\geostack-zabbix%JAR_SUFFIX% %PARENT_PATH%\jars xcopy %PARENT_PATH%\监控组件\geostack-monitor-common\target\geostack-monitor-common%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\监控组件\geostack-monitor-zabbix\target\geostack-monitor-zabbix%JAR_SUFFIX% %PARENT_PATH%\jars
xcopy %PARENT_PATH%\监控组件\geostack-zabbix-api\target\geostack-zabbix-api%JAR_SUFFIX% %PARENT_PATH%\jars start /max "" %PARENT_PATH%\jars
pause