Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Apply Code Changes" while debugging? #32

Closed
nmelander opened this issue Mar 27, 2013 · 13 comments
Closed

"Apply Code Changes" while debugging? #32

nmelander opened this issue Mar 27, 2013 · 13 comments

Comments

@nmelander
Copy link

I find this plugin very good but I can't get hot deployment to work while debugging.

Is this possible?

@kelemen
Copy link
Owner

kelemen commented Mar 27, 2013

Currently you can only execute the build command (you may reconfigure it to run the "classes" task which is more quick). If it does not work for you then you have to create a redeploy task in your Gradle script.

How would you like this feature to work in general?

@nmelander
Copy link
Author

Maybe I should not use the words "Hot Deployment". The application is a Swing GUI application and not a Web project.

We are frequently using the "Apply Code Changes" feature in NetBeans to load classes into a running application. This saves time because it takes a long time to start the application and to load needed data.

So I was wondering if this is possible (maybe I am missing something) or if this feature is planned for the future.

@kelemen
Copy link
Owner

kelemen commented Mar 27, 2013

I don't think you can currently make "Apply Code Changes" to work. I will have a look at it and see how/if it can be implemented.

@kelemen
Copy link
Owner

kelemen commented Mar 27, 2013

I think this is doable, so I will implement it. Though, probably, I will shamelessly steal code from the Maven plugin :)

@nmelander
Copy link
Author

Great! Thanks =) Tell me when it is ready and I test it for you.

@kelemen
Copy link
Owner

kelemen commented Mar 28, 2013

I have experimented how this feature works in the Maven plugin and it seems that the Maven plugin only reloads classes of the currently opened java file (and not every changed file). This is considerably more efficient (and simplier) than checking which files changed. Is it ok with you, if I do the same as the Maven plugin?

@kelemen
Copy link
Owner

kelemen commented Mar 28, 2013

I have implemented this feature (stealing some code from the Maven plugin). Can you build the plugin from the sources and try it? If you don't know how, see the wiki pages.

@nmelander
Copy link
Author

It seems to work nicely when I use a generated debug task. It is not working if I create my own gradle debug task. I have to do this since the application is taking an argument. Is it possible to pass along arguments to JavaExec's args property? Thanks for this quick fix!

@kelemen
Copy link
Owner

kelemen commented Apr 2, 2013

It is strange because I don't think this feature relies on the init script the plugin applies to the project. What happens exactly when you apply code changes with your custom debug task? And how is your debug task defined?

@nmelander
Copy link
Author

The apply code change button was never activated.

I tried the generated debug task with a simple HelloWorld application and it was fine. I then used my own debug task in the real project and it did not work. Now I changed my code to run without arguments, just to see if the generated debug task works better with my project, but it did not. So my problem has do do with something else. I am using subprojects and trying to run one of them.

@kelemen
Copy link
Owner

kelemen commented Apr 2, 2013

DebugUtils.getActiveClassName determines if that button is enabled or not to which the debug task does not matter. It seems as if NetBeans calls ActionProvider of the wrong project. One thing I can think of which might cause this if you don't have build.gradle in the subproject. Also, do you change the file of the debugged project or one of its dependencies (it shouldn't matter but might be important to find the cause)?

@nmelander
Copy link
Author

I will try to debug it or reproduce it in a more simple project. I think I changed files in both the debugged project and in one of the dependencies. I let you know later today or tomorrow.

@nmelander
Copy link
Author

When I debugged the plugin with my project it worked! So I reloaded my project in main IDE and it worked there too...

So I think we can close this Issue. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants