How to debug kotlin spring boot app in Eclipse? - eclipse

I'm trying to complete this tutorial. App created on this page with gradle, kotlin, java 12, war, dependencies as described on tutorial by first link.
In a nutshell, all works fine, app build by gradle works, app starts, I can open gradle app in IntelliJ IDEA and start and debug works.
Next I want to compare kotlin app development in Eclipse. I can run app with this run configuration:
App starts normally and works.
But in debug configuration there is no Gradle project option:
How to make proper debug configuration with possibility to debug kotlin files too?

Right click on project name -> Gradle -> Refresh gradle project did the trick.
Kotlin runtime library appears in libraries, java app or spring boot app debug now works, and breakpoint can be set.

Related

Could not find or load main class in Eclipse Run/Debug as after adding firebase-admin to build.gradle of Spring Boot App

I have a Spring Boot App generated by JHipster. It works fine but after adding the firebase-admin dependency in the Gradle build file I cannot run or debug this application in Eclipse.
The error is 'Could not find or load main class' caused by 'java.lang.ClassNotFoundException'.
The missing class is the annotated SpringBootApplication class I'm clicking on in Eclipse.
The application runs if I start Gradle from the command line or Eclipse or deploy the app to the cloud but without 'Debug as' in Eclipse I cannot use hot code replacement for development.
When I remove the dependency the 'Run/Debug as' in Eclipse works fine. I need this dependency to connect to the Firebase Firestore.

Problems wih Eclipse / Spring Boot / Camunda

we are working on a project that uses spring boot, camunda, gradle. we are using Eclipse as IDE. When we start the app in the run mode, everything works fine. Not so in debug mode. During start up the app crashes because camunda / spring says that some objects are added twice to the application context. This happens as well when we enable spring dev tools. The classpath is printed out to the console when stating. That shows that the project root is part of it. Maybe scanning the root folder and the classes folder to create the application context causes the problem.
Starting the app from within gradle does not produce this error. Also if we use IntelliJ instead of Eclipse we do not run into this error.
Any tips appreciased
TIA Kibu
Solved with eclipse Photon (4.9)
Kibu

Live debugging a Spring boot project in eclipse

I am trying to create a Spring boot based MVC application using eclipse.
I created a starter template from spring's starter website and i have imported the maven package into eclipse.
I created a controller and a view and I am able to run the application by going to "debug as" or "run as" and selecting Java Application and then selecting the spring boot application main method from the list.
However with this approach, Eclipse does not seem to auto build my changes in my java classes nor the changes in my template views. (I use Thymeleaf btw) on the fly even though "auto build" is switched on in eclipse.
This forces me to stop the application in eclipse and re run the application for every small change i make and its very difficult.
Is this the only way on eclipse or is there a better way for eclipse would auto build the java and template files on the way so that I can code and debug simultaneously.
Eclipse is most likely compiling because that's what Eclipse does, but maybe you need to install the dev tools so that you get live reloading enabled.

How to debug OSGi applications?

I really need to debug my code by the use of breakpoints, however this seems a complex undertaking with an OSGi container.
I have Eclipse and Felix (both the latest). My project is a raw OSGi project, I am not using PDE, just maven bundle plugin to generate the bundles and then copy them to the /bundle folder in felix, then I perform java -jar bin/felix.jar and the project runs. So no fuss here.
However I cannot debug the application that way. I've tried to read the docs (http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html) but they are outdated/broken and cant make them work...
How can I debug this? Will I have to avoid using OSGi just because debug is not supported...?
Thanks!
Have you considered using an IDE tool like bndtools to do the debugging? You can create a repository from your folder of bundles and run them using a bndrun file. This gives you a debug environment in Eclipse which sounds to be what you want. The bndtools website is here.
Bndtools also does a lot more, but it sounds as if you're happy with your existing Maven build. The tutorial runs through setting up a basic workspace, but the main thing you'll be interested in is Running a framework
Start felix with the following parameters to enable remote debugging.
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044 -jar bin/felix.jar
After you can connect via Eclipse Remote Debugging to your Felix Container.
Run
Debug Configurations
Remote Java Application
Choose as project the project/sources you want to debug
Configure port to 1044
Trigger debugger by clicking on debug

How to configure build.gradle so that my project gets build in tomcat webapps?

I'm new to gradle and I'm not able to configure the build.gradle to deploy my project directly from eclipse to tomcat webapps.
Can anyone please suggest how i can do this or provide some references where i can learn this.
Regards
There is a plugin to deploy your web application to Tomcat, see https://github.com/bmuschko/gradle-tomcat-plugin. There is also a Gradle build-in plugin to directly run your webapp within Jetty from command line, see http://www.gradle.org/docs/current/userguide/jetty_plugin.html.