How to generate class files to target\*.* on the fly so JRebel can reload class files

I've used JRebel with eclipse in the past without any issues; I set "build automatically' and point the output directory to maven default target class and as such I'm able to change the java files on the fly and allow JRebel to reload the classes.

In Idea, however, I'm unable to compile classes on the fly since the default Ajc compiler doesn't seem to compile classes on the fly. I'm not sure if changing to eclipse would help since I'd need Aspectj support.

I've made sure all my module settings are configured to have 'use module compile out path' check to  .... {target\classes}

What am I missing?

The other alternative is to run maven build but it takes a long time, even without tests, since I have 18 modules to run.

0
20 comments

I don't see from your post - have you installed JRebel plugin for IDEA? Though on-the-fly compilation isn't supported by IDEA, the plugin should be able to reload updated classes after you say compile (Ctrl-F9).

IDEA itself also has a HotSwap feature (works if you started your project in a debug mode).

0
Avatar
Permanently deleted user

Yes, I'm using JRebel's official plugin. The plugin itself is working fine since it works when I start my tomcat (I can in the logs). The problem is with the IDE because Jrebel looks at the new classes in the target/classes structure and IntelliJ doesn't generate one.

In eclipse, this happens automatically.

Could it be because I use Ajc compiler?

0
Avatar
Permanently deleted user

You can just reassign Ctrl+F9 to Ctrl+S and that will seem like if you work with Eclipse :)

0
Avatar
Permanently deleted user

That is NOT the same as eclipse a Ctlr F9 'Makes' the ENTIRE project and I have 18 maven modules :)

Besides Idea 'Make' still doesn't work all the time as I use aspectJ, oh, well -- let's not get there as I just closed another thread last week.

How do I complile just one class?

0
Avatar
Permanently deleted user

Ctrl+Shift+F9

0
Avatar
Permanently deleted user

Perfect. Thanks.

0
Avatar
Permanently deleted user

How do you 'assign' Ctlr S ==> Ctrl Shft F9 (or any other keymap)?

0
Avatar
Permanently deleted user

Settings -> Keymap

Or you can actually press Ctrl+` (backquote) and in the the popup select Keymap and Switch to Eclipse shortcuts :)

0
Avatar
Permanently deleted user

I'd like to migrate to Idea's keymap and it'd help to have the option of assigning shortcuts in the interim.

0
Avatar
Permanently deleted user

Thumbs up! :) Then Settings -> Keymap is where you find the assigned shortcuts.

0
Avatar
Permanently deleted user

Hi to all.

Ctrl Shft F9 works for all java files, but doesn't work for resources. 

How can I put all updated resources to target/class directory?

0
Avatar
Permanently deleted user

For resources, you can mark the directory where files are located as the "resources" directory: right click -> Mark Directory as -> Resources Root

The files will then be copied automatically to the target.

0
Avatar
Permanently deleted user

It'd already marked as resource root, but files coping only on rebuilding whole module, but I want on changes. Same as automatic build on save in Eclipse.

Is it possible?

0
Avatar
Permanently deleted user

Did you enable "Build project automatically" in the compiler settings?

Settings -> Build, Execution, Deployment -> Compiler 

0
Avatar
Permanently deleted user

I've added it, but it didn't help =(

It looks like this feature doesn't work.

0
Avatar
Permanently deleted user

Verified - works for me. Try harder! :)

0
Avatar
Permanently deleted user

BTW, if you are using JRebel, you don't need the resources to be copied into the target directory. Instead, you can map them in rebel.xml file within the classpath element (if that was your original goal).

0
Avatar
Permanently deleted user

Thank you, it looks like that I need.  I'll try to do it.

0

Alexey,

Ctrl-Shift-F9 works perfectly for resources. Would be great if you could create a sample project to reproduce the issue.

0
Avatar
Permanently deleted user

Roman,

I've created sample project, and it's works fine

Thank you.

0

Please sign in to leave a comment.