当前位置: 代码迷 >> CVS/SVN >> 基于Maven+SVN自动封装
  详细解决方案

基于Maven+SVN自动封装

热度:7116   发布时间:2013-02-26 00:00:00.0
基于Maven+SVN自动打包

?

目前我在新公司推行使用maven进行工程构建和管理,但是目前所有的测试环境和生成环境任然是WINDOWS,所以以前写的linux下自动构建打包的脚本无用了,今天写了个bat的的打包脚本,主要是用于测试人员,直接通过脚本自动打包测试用。免去开发人员打包在传文件的麻烦无聊事情,这里记录下。

?

@echo offrem Package project with maven+svn for test team.rem Just need your computer install JDK(1.6)+MAVEN(3)+SVN-Clientrem @author: zhangpurem @date: 2013-2-4echo [INFO] Package project with maven+svn for test team.if "%JAVA_HOME%" == "" goto java_env_errorif "%M2_HOME%" == "" goto maven_env_errorset workspace=%~dp0FOR /F "delims=" %%I IN ("svn.exe") DO (if exist %%~$PATH:I ( set svn_export=1 &break ))if %svn_export% equ 1 (goto pre_svn_export) else (goto do_ignore_svn):pre_svn_exportset svn_url=%1set svn_username=%2set svn_password=%3if "%svn_url%" == "" ( echo [INFO] Please input project svn url: &set /p svn_url=)if "%svn_username%" == "" ( echo [INFO] Please input your svn-username: &set /p svn_username=)if "%svn_password%" == "" ( echo [INFO] Please input your svn-password: &set /p svn_password=)if "%svn_url%" == "" (echo [WARN] project svn url does not exsit!! &goto :do_ignore_svn)if "%svn_username%" == "" (echo [WARN] username not exsit!! &goto :do_ignore_svn)if "%svn_password%" == "" (echo [WARN] password not exsit!! &goto :do_ignore_svn)echo [INFO] Project_SVN_URL: %svn_url%echo [INFO] SVN_USERNAME: %svn_username%goto do_svn_export:do_svn_exportif exist %workspace%\src (rd /s /q %workspace%\src &echo [INFO] clean and delete src)if exist %workspace%\target (rd /s /q %workspace%\target &echo [INFO] clean and delete target)if exist %workspace%\pom.xml (del /q %workspace%\pom.xml &echo [INFO] clean and delete pom.xml)svn export -q --force --username %svn_username% --password %svn_password% %svn_url% %workspace%echo [INFO] Finished export source from svn server.goto do_mvn_package:do_ignore_svnecho [WARN] SVN-Client is not found or svn parameters error, ignore source export from svn server, package directly. &goto do_mvn_package:do_mvn_packagecall mvn clean package -Dmaven.test.skip=truegoto okEnd:java_env_errorecho [ERROR] The JAVA_HOME environment variable is not defined correctlygoto paramsError:maven_env_errorecho [ERROR] The M2_HOME environment variable is not defined correctlygoto paramsError:okEndecho [INFO] Finished Auto-Package(SVN Auto Export + Maven Package):paramsErrorpause

?