Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the steps to publish a java project to a target host through jenkins

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces the knowledge of "what are the steps to publish a java project to the target host through jenkins". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

To publish a java project:

Pull the substitution code and pack it

Mvn clean package

Back up existing projects to publish on the target server

Transfer the package to the webapss directory of the target server

Secret-free login is required

Restart the tomcat service of the target server

Modify the configuration of the project

Restart the tomcat service of the target server

Project requirements:

Jenkins,tomcat is installed on both hosts

Operation on jenkins host

# two hosts do secret-free login [root@localhost] # ssh-keygen-t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/ root/.ssh/id_rsa): Created directory'/ root/.ssh'.Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in / root/.ssh/id_rsa.Your public key has been saved in / root/.ssh/id_rsa.pub.The key fingerprint is:SHA256:0zPiM+3ypvmYPisJbeL8LhA2QApiAVqwF9C+gyASonU root@localhost .localdomainthe key's randomart image is:+--- [RSA 3072]-+ | OB+ | | Xoo.E | | * =.. | =. =. | | + o +. | S + | |. + o. + o | | = +. +. | | + o oB. | | | + ooBO+ | +-[SHA256]-+ [root@localhost ~] # ssh-copy-id root@192.168.8.131/usr/bin/ssh-copy-id: INFO: Source of key (s) to be installed: "/ root/.ssh/id_rsa.pub" The authenticity of host '192.168.131 (192.168.131)' can't be established.ECDSA key fingerprint is SHA256:WbxvLgdwExwRlMT4gaAC1bVyIovZnAwwX1DX8dv6Rs0.Are you sure you want to continue connecting (yes/no/ [fingerprint])? Yes/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key (s), to filter out any that are already installed/usr/bin/ssh-copy-id: INFO: 1 key (s) remain to be installed-- if you are prompted now it is to install the new keysroot@192.168.8.131's password: Number of key (s) added: 1Now try logging into the machine With: "ssh 'root@192.168.8.131'" and check to make sure that only the key (s) you wanted were added.# installation software [root@localhost] # yum-y install git maven new project

Pull substitution code link: https://gitee.com/neawalke/tomcat-java-demo.git

When the pulled code is a private warehouse

Test access page

This is the end of the content of "what are the steps to publish a java project to a target host through jenkins". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report