Jenkins构建项目

###通过tomcat搭建

```

配置pom

cleaninstall -Pdev -Dmaven.test.skip=true

配置shell

#!/bin/bash

pid=`ps-ef | grep crPatient-t1 | grep -v grep | awk '{print $2}'`

if [-n "$pid" ]

then

   kill -9 $pid

fi

rm-rf /crdata/crPatient-t1/webapps/crPatient crPatient.war

cp-r ${WORKSPACE}/target/crPatient.war /crdata/crPatient-t1/webapps/

BUILD_ID=sh/crdata/crPatient-t1/bin/startup.sh

 ```

###通过springboot搭建

```

配置pom

-DskipTests=true-P test clean package

 

配置shell

pid=`ps-ef | grep crInquiry | grep -v grep | awk '{print $2}'`

if [-n "$pid" ]

then

   kill -9 $pid

fi

rm-rf /crdata/crInquiry/crInquiry-0.0.1-SNAPSHOT.jar

cp-r ${WORKSPACE}/target/crInquiry.jar/crdata/crInquiry/crInquiry-0.0.1-SNAPSHOT.jar

#rm-rf ${WORKSPACE}/target/*

BUILD_ID=sh/crdata/crInquiry/start.sh

``` 


###Jar 启动shell

```

#!/bin/bash

path=/crdata/crInquiry/logs/$(date+%Y-%m)

if [-d "$path" ] ; then

  echo "文件夹已经存在"

else

 mkdir "$path"

fi

logName=$(date"+%Y-%m-%d".txt)

myoutpath=$path'/'$logName

if [-f "$myoutpath" ] ; then

   echo "文件存在"

else     

touch"$myoutpath"    

fi

nohupjava -jar -Xms512m -Xmx512m crInquiry-0.0.1-SNAPSHOT.jar >$myoutpath2>&1 &

```

###Jar 停止shell

```

#!/bin/bash  # employ bash shell

PID=$(cat/var/run/crInquiry.pid)

kill-9 $PID

```

你可能感兴趣的:(Jenkins构建项目)