Fourth, the back-end deployment of jenkins+svn+maven

Remarks: This article defaults that jenkins has been configured successfully (if you want to understand the configuration, see the third article of jenkins)

Foreword:
Configure background manual operation 2 ideas
Idea 1:
1. Package the path of svn under svn, generate jar package
2. Put the path of jar package under the path where the server needs tomcat
3. Shut down tomcat and restart tomcat
(If there is a killing process (that is, shutting down the process), paste the information of the killing process in ***-see the 4.2 accidentally killing process in Idea 2***)

Idea 2:
1. Package the path of svn under svn and generate the jar package
2.
Put the path of the jar package under the path where the server needs to be placed 3. Start the server and place the jar package under the path
(if there is a kill process (also Is to close the process), then paste the information of the killing process in ***-see the 4.2 of Idea 2 to kill the process accidentally***)

Remarks: first think about how to do it in manual mode. Jenkins actually uses code instead of manual operation (my tomcat is an ip on the svn code base, so there is no need to configure tomcat under jenkins. If yours is not, then please Configure it yourself)

Idea 1 jenkins+svn+maven, store Idea 1 configuration (Idea 1, see the preface)

1. Project configuration: svn configuration

Project management-svn configuration
Insert picture description here

2. Use maven to package the svn package

Insert picture description here

3. Put the jar package in the path to be stored

Insert picture description here

xcopy /s/y/i/f C:\Users\cmbxa-sfd-1.0.jar  D:\tomcat\webappsF\lib  /e


备注:jar包一般存放在jenkins的\.jenkins\workspace\相应的路径下

而新存放的路径地址,则是开发指定的路径地址



***只改2个路径,别的不要动

Jar address: Take the test address as an example

Path query address: the address of the jar package downloaded by svn-system management-"main directory-"webapps -> related directories
Insert picture description here
Insert picture description here
Insert picture description here

4. Close tomcat and restart tomcat

Insert picture description here

set BUILD_ID=dontKillMe
call D:\tomcat\bin\shutdown.bat
call D:\tomcat\bin\startup.bat

5. Save-Application

Insert picture description here

6. Just build directly

Insert picture description here

Idea 2 jenkins+svn+maven, store Idea 2 configuration (Idea 2, see the preface)

1. Project configuration: svn configuration

Project management-svn configuration
Insert picture description here

2. Use maven to package the svn package

Insert picture description here

3. Put the jar package in the path to be stored

Insert picture description here

xcopy /s/y/i/f C:\Users\cmbxa-sfd-1.0.jar  D:\tomcat\webappsF\lib  /e


备注:jar包一般存放在jenkins的\.jenkins\workspace\相应的路径下

而新存放的路径地址,则是开发指定的路径地址

***只改2个路径,别的不要动

4. Start the jar package

Insert picture description here

set BUILD_ID=dontKillMe  
start javaw -jar C:\Users\Administrator\.jenkins\workspace\access.jar
   
只把jar包的地址找到就行             

4.2 Accidental killing process

Insert picture description here

@echo off
setlocal enabledelayedexpansion
set port=19007
::set /p port=请输入端口号:
for /f "tokens=1-5" %%a in ('netstat -ano ^| find ":%port%"') do (
 if "%%e%" == "" (
     set pid=%%d
 ) else (
     set pid=%%e
 )
 echo !pid!
 if NOT "!pid!" == "" (
    if NOT "!pid!" == "0" (
     taskkill /f /pid !pid!
    )
 )
)
pause 

5. Save-Application

Insert picture description here

6. Just build directly

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_41665637/article/details/99588662