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

How to deploy an application to a server in IntelliJ IDEA

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

Share

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

This article mainly introduces "how to deploy the application to the server in IntelliJ IDEA". In the daily operation, I believe that many people have doubts about how to deploy the application to the server in IntelliJ IDEA. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubt of "how to deploy the application to the server in IntelliJ IDEA". Next, please follow the editor to study!

Local development

Whether it's writing Java applications that run in the cloud or running locally, the coding itself hasn't changed much.

Public class IndexServlet extends HttpServlet {

Private static final long serialVersionUID =-112210702214857712L

@ Override

Public void doGet (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

PrintWriter writer = resp.getWriter ()

/ / Demo: through Cloud Toolkit, local application code can be efficiently modified and deployed to the cloud.

Writer.write ("Deploy from alibaba cloud toolkit. 2018-10-24")

Return

}

@ Override

Protected void doPost (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

Return

}}

Source code download

The above code is a standard Java project that prints a string of "Hello World" copywriters on a Web page.

Install the plug-in

Aliyun provides Intellij IDEA-based plug-ins to facilitate developers to efficiently deploy applications written in local IDE to the server.

Plug-in home page: https://www.aliyun.com/product/cloudtoolkit

The installation process of Aliyun's IntelliJ IDEA plug-in is more or less the same as that of ordinary plug-ins. I won't repeat it here. Please install it yourself.

Add Server

As shown in the above figure, in the menu

Open the machine view interface in Tools-Alibaba Cloud-Alibaba Cloud View-Host, as shown below:

Click the Add Host button in the upper right corner and the add machine interface appears.

Deployment

In IntelliJ IDEA, right-click the project project name, click Alibaba Cloud-Deploy to Host..., in the menu that appears and the following deployment window appears:

Set the deployment parameters in the Deploy to Host dialog box, and then click Deploy to perform the initial deployment.

Deployment parameters description:

Deploy File: the deployment file contains two ways.

Maven Build: if the current project is built with Maven, you can build and deploy it directly using Cloud Toolkit.

Upload File: if the current project is not built with Maven, or if a packaged deployment file already exists locally, you can select and upload the local deployment file directly.

Target Deploy host: select Tag from the drop-down list, and then select the server to deploy.

Deploy Location: enter the deployment path on ECS, such as / root/tomcat/webapps.

Commond: enter the application startup command, such as sh / root/restart.sh. Indicates the command that needs to be executed after the deployment of the application package is completed-- for Java programs, it is usually a Tomcat startup command.

At this point, the study on "how to deploy the application to the server in IntelliJ IDEA" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Servers

Wechat

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

12
Report