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. But I want to still use the IntelliJ on my local machine (i.e. my laptop).
I found a config section in IntelliJ which is in Default Setting->Build-executation-deployment-> Deployment and there I can set the address of my remote server and username and password. But I don't know what to do next.
There is a step by step deployment guide for PhpStorm, but for IntelliJ IDEA it would be almost the same.
Here is the example configuration for deploying a .jar file from artifact subdirectory to the remote server via SFTP into /home/serge/artifact directory:
I'd configure the artifact to produce the executable jar. Then adjust the deployment configuration to deploy the jar to the remote server. Or you can use Maven/Gradle to do the same.
Next, you can configure Remote SSH external tool to run the jar on the server (via java -jar jarname.jar:
Running on the remote server via Tools | External Tools | hello:
To automate the process enable Include in project build for the artifact, enable Automatic upload in Tools | Deployment and enable uploading of external changes in Tools | Deployment | Options.
To debug the code use Remote Debug configuration. Copy the JVM options needed for debug and adjust the options in your remote SSH external tool so that the app is started in debug mode and can accept connections (make sure firewall rules are adjusted to permit the connections on the specified port).
remote debug configuration
debug external tool configuration
proof of working
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:
Make changes into code;
Redeploy it into server (restart it if necessary);
Run your debug configuration;
Access your application on server (via browser for example) to trigger required code for execution;
Debug
Related
I have a current setup of intellij 2016 which compiles my java files on the fly. Due to some configuration in intellij it is possible to propagate any changes directly to tomcat. This way I don't have to manually build a new application and deploy it to tomcat which increases user productivity.
We want to remove tomcat and start using wildfly10 but also keep the hotdeploy functionality. On top of that the wildfly server will be hosted in a docker container.
So what I did is that I mounted the wildfly/standalone/deployment/myapp.war using docker to my host directory myapp/target/myapp.war. In addition I configured a jboss remote server configuration with remote stating set to same file system and let maven build an exploded war. This way if a maven build is performed, the contents of the target/myapp.war directory is directly available in my docker container. When I run the container and perform a new maven package, I do see that wildfly states that the new changes are found and redeploying has succeeded. Unfortunately this only goes well once or two times in a row.
So coming from the tomcat hotdeploy where no maven build was involved and any changes where directly available in tomcat, I'm wondering if the same can be achieved with the setup: intellij, maven, wildfly and docker. So if a change of a java file in intellij is compiled and pushed to wildfly without redeploying or maven build?
Wild-fly - eclipse supports 100 % Hot Code replacement
you have to start web-app in debugging mode .
For every change in java code just do a maven install and refresh
the target .
Limitations :
you can only replace statements in method .
you are not allowed to change whole class and new methods .
I'm running a Vaadin web app using the TomEE Maven plugin. When attempting to run debug in IntelliJ, it skips all breakpoints.
From what research I've read, it points to the debugger not attaching to the TomEE plugin.
Is there a way to do this without having to configure a standalone server? Ideally for development, I want to keep the dev setup simple and packaged within the pom.
if you run
mvn tomee:debug
then in intellij you configure a remote server on port 5005 and when the lisne "Listen ...5005..." is in the logs you connect/run this debug configuraton.
Then you debug in the server.
I was wondering if IntelliJ has a built in Application Server (like Tomcat) that I can use without having to download Tomcat directly?
Right now when I go to Run | Edit Configurations, Defaults, Tomcat Server, Local, it asks me to specify the Tomcat home directory.
Previously I had used myEclipse and it came packaged with a Tomcat so I would be suprised if the ultimate version of IntelliJ does not have this.
Intellij does not include built in application server. It has simple web server they refer to as Webstorm. However it is not application server.
Here is excellent resource (official docs) for working with application servers in intellij which you may find to be useful including tips on integrating it IDE via plugins etc:
Working with Application Servers
You need to download an application server manually.
Or you could use a Maven/Gradle dependency to start Tomcat programmaticly from the Main method, or a plugin for starting it via command line e.g. mvn tomcat:run.
Would it be possible to deploy/run (for testing purposes) a standalone Java application on a remote server from intellij? I'm not trying to connect to an already running JVM, but to start a new JVM on the remote host from intellij just like it was running on my local machine?
There is no built-in support for it at the moment. You can deploy an application to an application server running on a remote machine, but if you have a standalone application, there is no built-in feature to deploy it.
That said, you can write an Ant script or a shell script to deploy your app, and use either the Ant integration or the external tool feature to run it from with in IntelliJ IDEA.
I'm really nooby in 'Continuous integration'. And have a question about it.
Is it possible to create jar, ear or war file and deploy it on jboss every time I merge my develop branch (release) with master branch. I user gradle for build my project. I prefer something without user interface. My server runs on ubuntu server.
You should use a build server (like Jenkins) that could be configured to poll your git repository and run the build upon commit and on a successful build it would deploy (by a script or some plugin) the build product (jar/war) onto your JBoss server.