jenkins 打包 命令

 

 

 

项目根目录需要一个 version.txt 

 

 

jenkins 打包 命令 

   
 

 

 

    jar 包

#!/bin/bash
set -x
# Initialize enviroment\
SVN_URL=http://127.0.0.1/opp/Project/07MavenSrc/JAVADemo/trunk
SVN_USER=baoyou
SVN_PSWD=baoyou
BASE_PATH=`pwd`


# Workspace directories
DIR_SRC=/root/workspace/JAVADemo
PAK_PATH=${DIR_SRC}/target


cd ${DIR_SRC}

VERSION=`cat version.txt |grep VERSION |cut -d = -f2`
BUILD_NUMBER=`cat version.txt |grep BUILDNUM |cut -d = -f2`

mvn clean install assembly:assembly findbugs:findbugs -Dmaven.test.skip=true

if [ ! $? = 0 ]
then
   echo "make compile  failed ,Please help to check "
   exit 1
fi
cd ${PAK_PATH}
PACKAGE=`ls |grep  *tar.gz`
echo " DNS_PACKAGE=$DNS_PACKAGE"
PACKAGE_FINAL=JAVADemo${VERSION}-`date +%Y%m%d%H%M`-${BUILD_NUMBER}.tar.gz
echo " PACKAGE_FINAL=$PACKAGE_FINAL"
mv $PACKAGE $PACKAGE_FINAL

finalVer=`expr $BUILD_NUMBER + 1`

 echo " finalVer=$finalVer"
 cd ${DIR_SRC}
 
sed -i "s/${BUILD_NUMBER}/${finalVer}/g"   version.txt


# Put the apk on ftp Server.
#Put apk from local to ftp server
if ping -c 3 127.0.0.1;then
echo "Ftp server works normally!"
else
echo "Ftp server is down again!"
exit 1
fi
#ftp login
ftp -nv <<EOC
open 127.0.0.1
user baoyou baoyou 
prompt
binary
cd /opp/local
cd ./JAVADemo
mkdir `date +%Y%m%d`
cd "`date +%Y%m%d`"
lcd ${PAK_PATH}
mput *.tar.gz

close
bye
EOC

echo "-> Done: Put aoe package file successfully!"

svn ci --username $SVN_USER --password $SVN_PSWD -m "OCT\nREM packaging $finalVer." $DIR_SRC/version.txt

 

war 包

   

mvn clean install war:war findbugs:findbugs -Dmaven.test.skip=true

 

 

 

 

 

 

 

 

 

 

捐助开发者 

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(支持支付宝和微信 以及扣扣群),没钱捧个人场,谢谢各位。

 

个人主页http://knight-black-bob.iteye.com/



 
 
 谢谢您的赞助,我会做的更好!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值