In order to practice CI / CD, I set up Jenkins to generate Artifacts and deploy it to the application server.
The source code and server construction are described in this Preparation. If you want to automatically deploy the Spring Boot application to the JVM server, refer to Spring Boot App.
Select Git from ** Manage source code **, and check out the Github repository prepared in the preparation section. [^ 2] For branch, specify * / master.
Select ** Run Shell ** and run it with the ./mvnw
command.
The build uses maven, but it runs in the Maven Wrapper included in the repository instead of the Mave task. Since there are two projects in the repository, I move the current directory to WebSpringBoot before executing it.
cd WebSpringMvc
./mvnw clean package
When you run Maven, web-spring-mvc.war will be generated in the / WebSpringMvc / target folder.
Select ** Run Shell ** and run Tomcat's manager command in curl to deploy the war file.
# path=/You can specify the context path of the application with the app parameter
curl --upload-file WebSpringMvc/target/web-spring-mvc.war "http://admin:[email protected]:8080/manager/text/deploy?path=/app&update=true"
If the Jenkins job execution is successful, you can check the application execution from the following URL. http://192.168.33.30:8080/app/greeting
Configuring Manager Application Access
[^ 1]: This time, I wanted to build and deploy by command execution, so I used the ** Shell execution ** task.
[^ 2]: This repository contains two Maven projects, ** WebSpringMvc ** for war and ** WebSpringBoot ** for jar. This time, we will use / WebSpringMvc.
Recommended Posts