How to enable hot swapping in debug mode with gradle and jetty? - intellij-idea

I'm using jettyRun for running my simple spring application. I wanted to enable hot swapping with Intellij debuger, but looks like jetty doesn't catch the changes.
On http://docs.codehaus.org/display/GRADLE/Gradle+Jetty+Plugin I seen that it should work with:
jettyRun.scanIntervalSeconds=1
On the other hand, there is some inconsistency. On the gradle homepage this parameter is not listed: http://www.gradle.org/jetty_plugin. Anyway, is there any way to enable this on gradle?

Heh, actually found it myself now.
Looks like this parameter is not needed at all. Hot deploy works anyway.
I just wasn't able to seen that because my vaadin application was keeping session even after F5. To restart it properly it's enough to add ?debug&restartApplication to the application url.
So, Ctrl+Shift+F9 in IntelliJ + F5 in the browser (with ?debug&restartApplication) works fine ;)

Related

How to edit and debug OAF java code in IntelliJ IDEA

I agree that JDeveloper provides some unique ADF-specific functionality, but when it comes to work with java code, IntelliJ IDEA works better for me. Can I move java-related operations to IDEA?
Setup
Create IDEA project from existing sources, setup source folders and connect libraries.
Setup IDEA run configuration. "Listen to remote JWM" means that IDEA will act as a server and Jdev will connect to it as soon as it starts running. It is good if you need to debug processRequest() method - debugger must be connected immediately. I chose "JDK 1.4.x" because it looks closer to VM parameters which Jdev uses when it starts debugging (you can look at those is Jdev log while debugging).
Setup Jdev as a client. Append VM options from IDEA to your existing options.
Running
To start debugging, first, run IDEA run configuration with green bug button, and second, run Jdev with green play button.

Using IntelliJ IDEA and the Dart plugin, where does the Dart exceptions end up?

I've been playing with Angular2 using IntelliJ IDEA (2016.3.5) and the latest Dart plugin, and I just can't figure out where the errors, exceptions, assert failures etc. ends up.
I am running Dartium with DART_FLAGS="--checked" and pub serve seems to default to debug mode as far as I can read. Dart2js is configured to run in checked mode as well and the analysis server is configured for strong mode. I have also tried using the JetBrains Chrome extension so I get everything shown directly in IDEA, including the console saying Observatory listening at http://127.0.0.1:35517/.
When there are no errors the Angular2 Dart app runs just fine in Dartium but if I add an assert some where in the code, ie. on a button trigger, the app just stops working at that point with no error output anywhere. Same goes if there's some other error somewhere that pub serve didn't detect.
Dart and Dartium are both at the currently latest version, 1.22.1.
This will be fixed in Angular3 beta.x due to be released the next days it seems.

Launch Grails 3 app from IntelliJ w/ auto-reloading enabled

It looks like IntelliJ's (Ultimate EAP 15) support for Grails 3 is in the early stages yet. If I do Run -> Debug 'Grails:My App', I'm able to launch an app from inside IntelliJ, I can set breakpoints and it works as expected.
If I make changes however, I see in the console that the file is recompiled, but when I hit reload in the browser, I don't see the changes reflected there. I have to stop and restart the app in IntelliJ before I see them. Anyone know how I can get the auto-reloading working?
After chasing this for a week, this post finally provided an explanation.
It's actually a Grails issue, not a problem with IntelliJ's Grails integration: spaces in a file's path will break automatic reloading. Renaming my project from Grails Demo to GrailsDemo got everything straighted out. (Storing a project in a folder like My Documents will also cause trouble.) The post's author indicates that this started with version 2.4.4 and it's still happening for me in 3.0.4.

DropWizard testing

As I am using eclipse and just set up a dropwizard server. On the command prompt I typed in java -jar target/hello-world-0.0.1-SNAPSHOT.jar server hello-world.yml and is running. Yet when ever I make a change to my eclipse file, like changing the yml file for example it doesn't update. I have to crtl+c and re-run what I typed in above. My question is, is there a faster way of testing so that it updates every time I change something or I just have to deal with the testing. Thanks.
Run from within the IDE
Different Java IDEs permit more efficient workflows. For example, in an IDE you can run up your application using a Runtime Configuration that executes your Service.main() method with parameters of server hello-world.yml. This will save you endless Maven builds.
Unfortunately, with Eclipse the hot swapping of code changes is often cumbersome, so I would recommend that you consider Intellij which is more reliable when it comes to hot swapping code. Even then hot swapping can be risky.
Sometimes a restart is unavoidable
That being said, in your situation hot swapping won't help. You are changing the startup configuration file which is only read at startup. You will have to restart to see the changes unless you create your own dynamic-refresh-on-file-hash-change mechanism (not advised).
One alternative is to put much of your configuration testing in unit tests and verify that your code is responding as expected.
Static assets give an optimal workflow (no restarts)
You may encounter a situation where you only want to change static assets (like JavaScript files) in which case Intellij will allow you to simply recompile on the fly and will copy the changed assets into the /target directory and have them immediately picked up by Dropwizard without a restart.
If you wanted to go one step further you could enlist the services of Grunt.js so that it continuously monitored the src/main/resources/assets (or similar) for changes and then automatically update your /target for you. Again, Intellij will autosave on focus change so this would lead to an optimal workflow where you change the asset, wait one second, refresh browser and see the immediate result.
I wrote a lengthy blog article covering Dropwizard and Ember Data a while ago if you want more details on this approach (and single page web application development in general).

How to enable hot swap in intelliJ

I want to work on intelliJ on my webapps and I don't know how to hot swap code while working.
For example while I was working in Eclipse when I edited jsp files Eclipse automatically, instantly swapped the file so when I refreshed the page my changes were there
When I change class code in Eclipse it worked a bit longer because he republished the app but did it automatically and instantly.
I saw that intelliJ in the runtime configuration has an option 'how class swap'. I did check it but nothing is happening. I had tried compile, make, save and everything else and nothing is happening. I had to reload the app and I had to do dis manually. Secondly intelliJ reloads EVERY application in my webapp directory. I have them a lot so it taking ages. how can I turn on hot swap?
Hotswap only works in debug mode. So you need to connect to your webserver through a debug configuration. Then, after compile either the project or at least the class with the modifications, IntelliJ tries to hotswap that class.
This only works for minor changes. For example, creating new methods on the fly is not possible using this way.
Hotswap works with exploded artifacts on Update action. If it doesn't work with your project, contact support for help and provide the project to reproduce it.