Debugging jsp using spring-boot and IntelliJ

I am developing a web application (military packaging) using spring-boot, jsp and built-in tomcat. The application works fine, and I can debug java files without any problems if I add the maven startup configuration with the spring-boot: run task.

But when I try to add a breakpoint to one of my jsp files, IntelliJ shows this error: "The breakpoint does not belong to any class."

If I configure IntelliJ to use an external tomcat server, then debugging jsp works fine.

Is there a way to debug jsp using the spring-boot maven command? Is this a problem with spring-boot or with maven startup configurations in IntelliJ?

I would really like to use the spring boot capabilities from my dev environment.

Thanks.

+7
spring-boot intellij-idea jsp
source share
1 answer

The problem is that spring boot creates another process for the application. You have to say that you want to debug the download, and not just run the command for maven or gradle in debug mode. :-( See:

Update: For my current project, I just provide a class to initialize the spring boot in a war file. (See Related instructions for using spring boot for military files that are deployed in real web containers).

So, during the development of frontend files, I use springboot: I launch it to quickly reload resources, etc., and to debug java code, I deploy the material to tomcat in debug mode. For release, I just have to decide what type of packaging I want, since my application can work as a jar or war file.

BTW: If you want to use tomcat only material (special filters, etc.), you can use the built-in tomcat for springboot: also run so that your environments are more similar and you do not hunt for phantom errors ;-)

Update 2

According to https://github.com/spring-projects/spring-boot/issues/1138 you can simply run the main method of your boot application for debugging. I think this helps to use the maven target at least once, so everything is compiled / copied, etc. This works for me! :-)

Update 3 In accordance with the spring boot command, they changed the way spring-boot: run works, so starting from 1.2 you can also use debug mode for the maven target, although they recommend starting spring to start, boot applications should always start the main method.

Update 4 I can confirm that starting in spring 1.2, you can directly run maven targets in debug mode to be able to set breakpoints, etc.

+8
source share

All Articles