Summary of WAR package deployed by jenkins+sonar+ to WINDOWS

Under WINDOWS, pull down the code through SVN, configure MAVEN to package war in JENKINS, then publish it to sonarqube for code quality, and finally publish some script configurations under TOMCAT:


1) Set to check H/30 every 30 minutes * * * *

2) Check the box before selecting Prepare SonarQube Scanner environment

3) MAVEN packaging settings package -Dmaven.test.skip=true
4) In the build link, sonarqube is written as:
sonar.projectKey=EBS
sonar.projectName= EBS
sonar.language=java
sonar.sources=src
sonar.java.binaries=target/EBS/WEB-INF/classes
sonar.java.source=1.7
sonar.sourceEncoding=UTF-8

5) By executing the WINDOWS script, then by WMI way, kill the process under TOMCAT, and then copy the WAR to start, this is very strange, WIN10 and some versions are possible, but some servers are not,
set OLD_BUILD_ID=%BUILD_ID%
echo %OLD_BUILD_ID%
set BUILD_ID=DONTKILLME
d:\ killtomcat.bat
set BUILD_ID=%OLD_BUILD_ID%
echo %BUILD_ID%

其中killtomcat的脚本为:
title ABC
SET CATALINA_HOME=D:\apache-tomcat-7.0.54
call "%CATALINA_HOME%\bin\shutdown.bat"
ping -n 6 127.1 >nul
wmic process where name="java.exe" get processid,commandline |findstr /i "d:\apache-tomcat-7.0.54" >#     
setlocal enabledelayedexpansion
for /f "delims=*" %%i in (#) do (     
   set var=%%i
   set var=!var:start  =#!     
   for /f "tokens=2 delims=#" %%a in ("!var!") do (
     set tomcatpid=%%a
    )
)
del # >nul     
if defined tomcatpid taskkill /pid !tomcatpid!
ping -n 3 127.1 >nul
call "%CATALINA_HOME%\bin\startup.bat"



You can also use the TOMCAT installation version under WINDOW:
NET STOP Tomcat7
ping www.baidu.com
whoami
dir
cd "E:\tomcat7\webapps"

cd C:\Users\NatalieQiu\.jenkins\workspace\EBS\target
xcopy C: \Users\NatalieQiu\.jenkins\workspace\EBS\target\EBS.war "E:\tomcat7\webapps" /Y /s
ping www.baidu.com
whoami
cd "E:\tomcat7\webapps"

NET START Tomcat7

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326322500&siteId=291194637