TomEE Maven plugin debug w/ IntelliJ - java

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.

Related

How to Debug web app tapestry in IntelliJ with jetty runner configuration

I'm using intelij as IDE in application tapesrty5 and for server i'm using jetty runner as plugin for intelij
the problem is when i'm trying to run as debug mode the break point never been trigged
Breakpoint created but never been triggered !

deploy/debug java code on a remote server using Intellij

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

Intellij built in Application 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.

Managing Maven project in Eclipse with git repository

we recently migrated to Maven Build manager & git hub repository for our Java web-app. Also i switched to eclipse as eclipse has good set of plugins.
As a new bie, i am simply running mvn clean package from terminal at the code root directory. And then moving the compiled code i.e., /target/SNAPSHOT/* to tomcat/webapps/ROOT location.
And then starting Tomcat7 server. The process is time taking especially when i do code changes in Java & configuration .xml files.
I want to do it completely in IDE environment as i did earlier in Netbeans, update code -> build and run in debug mode, -> do code changes and then commit.
Heard of egit & m2e in eclipse for maven & github integration, but not sure how to use it.
Please walk me through the steps required in doing so. I am completely new to eclipse.
--
Thanks
You might want to consider using maven-jetty-plugin http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin for running the webapp. You will not need to copy over stuff to tomcat. After configuring this plugin, you can simply run your application by doing mvn jetty:run
I generally do not like running webapps inside Eclipse. It's a personal prefrence, but it is always nice to have an IDE neutral way of building and running your applications. If you have m2e things should work simply fine. I have seen maven-jetty-plugin having hot pluggability where if you changed your web.xml, jetty would reload your application.
We use Git for version control and Maven for dependency management and build automation. Once your project has successfully imported into Eclipse and recognized as a valid java web project, you don't need either Git or Maven in order to build/run it inside IDE. Just creat a server using you existing tomcat installation, add the project to server, then select Run as > Run on Server.
The Complete Guide:
Creating a server
Adding projects to a server
Starting a server
For more details, check out Testing and publishing on your server.

Debugging Maven Web Application on already installed Glassfish using eclipse

My problem is with respect to debugging web application on an already installed glassfish using eclipse.
If I create a web project using eclipse then eclipse will let be deploy and debug application on an already installed glassfish application server. However, if I have created a web project using maven archetype, eclipse does not let me debug the application.
I can use maven's jetty or tomcat plugin and debug the application but I need to debug application on an already installed glassfish. Basically I have followings
1) Web application created using maven archetype
2) Eclipse IDE
3) Glassfish which is already installed outside of Eclipse IDE
I came across maven's glassfish plugin but as far as I understood it is not for debugging the application.
Please let me know your suggestions.
Thanks
If I create a web project using eclipse then eclipse will let be deploy and debug application on an already installed glassfish application server. However, if I have created a web project using maven archetype, eclipse does not let me debug the application.
This is not true. Whether you use the Maven Eclipse Plugin (which provides WTP support) or m2eclipse (with the optional Maven Integration for WTP installed from the m2eclipse Extras), you can deploy a project created outside Eclipse to an existing "Server" (that you can start in Debug mode), as long as you imported it appropriately (Import... > Existing Project into Workspace if you use the former, Import... > Maven Projects if you use the later).
Basically I have followings 1) Web application created using maven archetype 2) Eclipse IDE 3) Glassfish which is already installed outside of Eclipse IDE
I use the same setup with several projects with no problem (and can debug them on my locally installed GlassFish server).
I came across maven's glassfish plugin but as far as I understood it is not for debugging the application.
There is no need for extra Maven plugins, you can just rely on your IDE if you follow the right steps.
I don't know about eclipse, but IntelliJ IDEA has a remote debug feature. You start your server with something like
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5055
and then the IDE will connect to that port and you'll have a regular debug.
I'm sure eclipse has this feature.
EDIT: This article shows how to use this feature with eclipse.
I´m going to write it most for me in order to keep trace of my solution:
If you are using the maven.failsafe plugin just force the execution of glassfish internally the current JVM started by maven avoiding the fork with the parameter
-DforkCount=0
in such way you are able to debug both test and server from the usual way, ie. running a debug task from eclipse and setting break points both in test and in server side.
Extra parameter information could be found here, including setting different debug port:
http://maven.apache.org/surefire/maven-failsafe-plugin/examples/debugging.html

Categories

Resources