deploy/debug java code on a remote server using Intellij

前端 未结 2 1276
天命终不由人
天命终不由人 2020-12-01 11:34

I want to run my java code on a remote server for faster speed (The server is very powerful). What I want is to connect my Intellij to that remote server and run my code. Bu

2条回答
  •  死守一世寂寞
    2020-12-01 11:39

    If you need to debug your web application running on remote server you can do it this way:

    Deploy your code to remote server. There are several ways to do it:

    • By intergration IDEA with you application server. Go into Settings > Build, Execution, Deployments > Application Servers and add your application server there. You could later use it as deployment target. See documentation.
    • By integration via you building tool, for example, maven have plugins for integration with many app servers. This works well when your build process is complicated.
    • Manually - simple copy build artifacts into target app server machine and deploy manually.

    Connect to server in debug mode. To do this you need to create separate Run/ Debug configuration in IDEA. If you have Enterprise Edition you could choose configuration template for your server (e.q. Tomcat Server) and choose server from your Application Servers list. In Community Edition you have to use default Remote configuration instead.

    When setup is done, your workflow should be the following:

    1. Make changes into code;
    2. Redeploy it into server (restart it if necessary);
    3. Run your debug configuration;
    4. Access your application on server (via browser for example) to trigger required code for execution;
    5. Debug

提交回复
热议问题